#32981 [Opn->Fbk]: ReflectionMethod::getStaticVariables() causes apache2.0.54 seg fault

From: Date: Mon, 09 May 2005 09:36:41 +0000
Subject: #32981 [Opn->Fbk]: ReflectionMethod::getStaticVariables() causes apache2.0.54 seg fault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-78791@lists.php.net to get a copy of this message
ID: 32981 Updated by: sniper@php.net Reported By: phpbug at swift-web dot com -Status: Open +Status: Feedback Bug Type: Reproducible crash Operating System: Gentoo 2.6.11 PHP Version: 5.0.4 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.0-win32-latest.zip Seems to work fine fore me with latest CVS HEAD (5.1-dev) but do try and see if it's fixed in the 5.0 too. Previous Comments: ------------------------------------------------------------------------ [2005-05-09 10:15:43] phpbug at swift-web dot com 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 this bug report at http://bugs.php.net/?id=32981&edit=1

« previous php.bugs (#78791) next »