WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 18 months ago

#16306 closed defect (bug) (invalid)

clear output buffer before xml responses to prevent whitespace

Reported by: ps2602 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.4
Component: General Keywords:
Focuses: Cc:

Description

Clear output buffer before xml responses to prevent whitespace or other extraneous characters from being sent.

Attachments (1)

classes.php.diff (33 bytes) - added by ps2602 3 years ago.

Download all attachments as: .zip

Change History (6)

ps26023 years ago

comment:1 ps26023 years ago

  • Type changed from enhancement to defect (bug)

comment:2 westi3 years ago

What is the bug you are trying to fix here?

comment:3 ps26023 years ago

For some reason, there are a quite a few plugins that output white space which breaks xml parsing in all browsers or breaks file output. I keep coming across this problem in both ms-files.php and now the send method of the WP_Ajax_Response class so I just added ob_clean to the method in order to prevent plugins from being able to inadvertently break functionality in wordpress. I read up on ticket #14730 and I understand the viewpoint that ob_clean should not be used to cover the mistakes of plugin authors. However, finding unnecessary output in a plugin and contacting the author every time I come across this issue (which seems to happen often) seems counter-productive when users can be protected from such mistakes with a one-liner.

Last edited 3 years ago by ps2602 (previous) (diff)

comment:4 nacin3 years ago

This would affect more than just WP_Ajax_Response and ms-files.php. It would also affect all RSS feeds too.

I'm not convinced this is a good idea. We can only hold the hands of plugin authors so much.

comment:5 bpetty18 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

This is indeed a bug in the respective plugins and themes triggering this.

I also think that the most likely cause of issues like this is due to use of EOF ?> on PHP files, which has also since been dropped entirely in core in r19712, after this ticket was opened, and probably dropped in a ton of plugins by now too.

Since there's been no interest in this for nearly 2 years now too, I'm closing this out. Re-open if you think this is still a valid concern.

Note: See TracTickets for help on using tickets.