From: phpbug at swift-web dot com Operating system: Gentoo 2.6.11 PHP version: 5.0.4 PHP Bug Type: Reproducible crash Bug description: ReflectionMethod::getStaticVariables() causes apache2.0.54 seg fault
Description: ------------ Discovered if I am using ReflectionMethod::getStaticVariables() on a method that has a static variable that is set to boolean true or false then php crashes (Apache 2 exists with following error) [notice] child pid 28346 exit signal Segmentation fault (11) I tried with php version 5.0.3 initially but upgraded to 5.0.4 and problem still exists. Reproduce code: --------------- class demo_class { static function myDemo($toggle) { static $enabled = true; // do whatever } } $class = new ReflectionClass('demo_class'); foreach ($class->getMethods() as $method) { $arr_static_vars[] = $method->getStaticVariables(); } echo "done"; // (normally would output $arr_static_var but just put above // line for simplicity in this example) Expected result: ---------------- See a screen with just the word 'done' on it Actual result: -------------- Page loading stops immediately (and keeps last page shown displayed. Apache logs show: [notice] child pid 28346 exit signal Segmentation fault (11) (pid of course varies) If I change the third line in my sample code to: static $enabled = 1; (or string) the page does not crash and things display properly I haven't tested this to see if it also crashes showing static variables for the entire class (as opposed to the one in the method) but if they inherit the same code I guess it would also crash but again I haven't confirmed that. -- Edit bug report at http://bugs.php.net/?id=32981&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32981&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32981&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32981&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32981&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32981&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32981&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32981&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32981&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32981&r=support Expected behavior: http://bugs.php.net/fix.php?id=32981&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32981&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32981&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32981&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32981&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32981&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32981&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32981&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32981&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32981&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32981&r=mysqlcfg