From: xuefer at gmail dot com Operating system: gentoo linux PHP version: 5CVS-2007-07-28 (CVS) PHP Bug Type: Scripting Engine problem Bug description: suggest a fix for global object got destructed in output buffer handler
Description: ------------ it seems that the implicit ob_end_flush() is called after object destructions. uncomment any ONE of the comments gives "okay". but this is not the official trick that supported by php. the php bug system suggest me this bug is by design in #39546 #39629 etc. there's many register_xxx arround my php files, which install data into a global object, and the output buffer handler will inject the data into the output in the correct place. if this bug is not fixed, the only way i can do is to rewrite the object into array/functions anyway, i have a suggested fix to change the work flow a bit: 1. flush and pop all OBs but leave 1 top OB on shutdown 2. destruct objects 3. flush the last OB if there's any no matter if this bug is gonna be fixed, there shall be a page that give explanation and work arround to this issue. Reproduce code: --------------- <?php class Obj { } function callback($content) { return isset($GLOBALS['a']) ? $content : 'oops'; } ob_start('callback'); $a = new Obj(); //$b = $a; echo 'okay'; //ob_end_flush(); ?> Expected result: ---------------- okay Actual result: -------------- oops -- Edit bug report at http://bugs.php.net/?id=42132&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42132&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42132&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42132&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42132&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42132&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42132&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42132&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42132&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42132&r=support Expected behavior: http://bugs.php.net/fix.php?id=42132&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42132&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42132&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42132&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42132&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42132&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42132&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42132&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42132&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42132&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42132&r=mysqlcfg