Bug #67332 [NEW]: The local static variables

From: Date: Fri, 23 May 2014 07:41:25 +0000
Subject: Bug #67332 [NEW]: The local static variables
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185907@lists.php.net to get a copy of this message
From: dreamsxin at qq dot com Operating system: Ubuntu PHP version: 5.4.28 Package: Scripting Engine problem Bug Type: Bug Bug description:The local static variables Description: ------------ Local static variables, in the parent and child classes, is the same. In 5.5.7 has same proplem. https://bugs.php.net/bug.php?id=53155 Test script: --------------- <?php class Test { public static function hello() { static $my; if ($my) { $my = '2'; } else { $my = '1'; } var_dump($my); } } class Test2 extends Test { } Test::hello(); Test::hello(); Test2::hello(); Expected result: ---------------- string(1) "1" string(1) "2" string(1) "2" Actual result: -------------- string(1) "1" string(1) "2" string(1) "1" -- Edit bug report at https://bugs.php.net/bug.php?id=67332&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67332&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67332&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67332&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=67332&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=67332&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=67332&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=67332&r=needscript Try newer version: https://bugs.php.net/fix.php?id=67332&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=67332&r=support Expected behavior: https://bugs.php.net/fix.php?id=67332&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=67332&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=67332&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=67332&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67332&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=67332&r=dst IIS Stability: https://bugs.php.net/fix.php?id=67332&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=67332&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=67332&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=67332&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=67332&r=mysqlcfg

« previous php.bugs (#185907) next »