#30328 [NEW]: Crash when passing undefned variable to __get() and return its name

From: Date: Tue, 05 Oct 2004 10:37:03 +0000
Subject: #30328 [NEW]: Crash when passing undefned variable to __get() and return its name
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-67127@lists.php.net to get a copy of this message
From: flying at dom dot natm dot ru Operating system: windows 2000 PHP version: 5.0.2 PHP Bug Type: Reproducible crash Bug description: Crash when passing undefned variable to __get() and return its name Description: ------------ PHP 5.0.2 on Windows 2000 SP4. There is reproducible crash happens when one tries to pass undefined variable to a class with defined __get() function. Example code: <?php class Test { function __construct() {} public function __get($name) { echo '__get() called: '.$name; return($name); } }; $test = new Test(); echo $test->$testvar; ?> Running this code from under Apache results in HTTP 500 error, running it from shell results to some garbage to be shown on screen and program exit. However running it as: php.exe test.php >log results in following text appearing in log: Notice: Undefined variable: testvar in C:\web\test.php on line 13 __get() called: Moreover changing return($name); inside __get() to returning anything else (either static value or some other variable) results in crash disappearing. -- Edit bug report at http://bugs.php.net/?id=30328&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30328&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30328&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30328&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30328&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30328&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30328&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30328&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30328&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30328&r=support Expected behavior: http://bugs.php.net/fix.php?id=30328&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30328&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30328&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30328&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30328&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30328&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30328&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30328&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30328&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30328&r=mysqlcfg

« previous php.bugs (#67127) next »