#40604 [NEW]: Objects disappear from the global scope

From: Date: Fri, 23 Feb 2007 08:49:07 +0000
Subject: #40604 [NEW]: Objects disappear from the global scope
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-109382@lists.php.net to get a copy of this message
From: dagdamor at simps dot ru Operating system: Windows PHP version: 5.2.1 PHP Bug Type: Class/Object related Bug description: Objects disappear from the global scope Description: ------------ Objects seem to disappear from the global scope when you try to access them from the output buffer callback function. Regular variables (i.e. not objects) don't disappear and work alright. After some additional research I've noticed that if your PHP program has many objects in the global scope, some of them don't disappear, while others do. Looks very strange... I hope this is not documentation misinterpretation, because I used global variables, objects including in OB callbacks in PHP4, and it worked fine. In other words, I hope this is not "You can't use global variables there" case. Reproduce code: --------------- <?php function handler($content) { global $obj; return isset($obj)?"OK":"Error"; } class MyClass {} $obj=new MyClass(); ob_start("handler"); ?> Expected result: ---------------- OK Actual result: -------------- Error -- Edit bug report at http://bugs.php.net/?id=40604&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40604&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40604&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40604&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40604&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40604&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40604&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40604&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40604&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40604&r=support Expected behavior: http://bugs.php.net/fix.php?id=40604&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40604&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40604&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40604&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40604&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40604&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40604&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40604&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40604&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40604&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40604&r=mysqlcfg

« previous php.bugs (#109382) next »