Make WordPress Core

Opened 21 years ago

Closed 21 years ago

#2297 closed defect (bug) (fixed)

printr does not properly clean up after itself

Reported by: doit-cu Owned by:
Priority: normal Milestone:
Component: General Version: 2.0
Severity: normal Keywords: bg|has-patch bg|commit
Cc: Focuses:

Description

I'm not sure what the purpose of this funtion is (print_r accepts a bool which does the same thing...). However, this function does not properly cleanup the ob portion. You need to add ob_clean_end(); on line 47 of functions-compat.php in order to fix this. ob_starts can be nested, but ob_clean_end only ends the top most ob_start, so if you were to ob_start outside this funtion, ob_clean_end inside the function would not kill that ob_start (only the one inside the function). Not ending output buffering inside the function makes it a bloody pain to try to debug your code.

Thank you,
--Joel

Attachments (1)

printr_cleanup.diff​ (345 bytes ) - added by doit-cu 21 years ago.

Download all attachments as: .zip

Change History (4)

#1 @davidhouse
21 years ago

  • Keywords bg|has-patch added

This is a compat function, the second parameter to print_r was only added in PHP 4.3, our minimum requirements are below that. Bug valid though.

#2 @davidhouse
21 years ago

  • Keywords bg|commit added

#3 @ryan
21 years ago

  • Resolution → fixed
  • Status new → closed

(In [3689]) ob_end_clean() in printr(). Props doit-cu. fixes #2297

Note: See TracTickets for help on using tickets.