Make WordPress Core

Opened 14 years ago

Closed 12 years ago

#16306 closed defect (bug) (invalid)

clear output buffer before xml responses to prevent whitespace

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


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 14 years ago.

Download all attachments as: .zip

Change History (6)

14 years ago

#1 @ps2602
14 years ago

  • Type changed from enhancement to defect (bug)

#2 @westi
14 years ago

What is the bug you are trying to fix here?

#3 @ps2602
14 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 14 years ago by ps2602 (previous) (diff)

#4 @nacin
14 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.

#5 @bpetty
12 years 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.