Bug #73713 [NEW]: Static var in class func initialized after same func of parent class is called

From: Date: Sat, 10 Dec 2016 18:45:42 +0000
Subject: Bug #73713 [NEW]: Static var in class func initialized after same func of parent class is called
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205897@lists.php.net to get a copy of this message
From: thomas at beamstyle dot com dot hk Operating system: Windows PHP version: 5.6.29 Package: Class/Object related Bug Type: Bug Bug description:Static var in class func initialized after same func of parent class is called Description: ------------ ----- When all 3 classes are in one file, everything works fine, and Test Script A (main) gives expected output. However, when you separate the classes into 3 files and using autoloading (PSR-4 via composer, but probably doesn't matter what standard we use), this fails... ----- Also, one more interesting fact is if you try Test Script B (on the side), It seems to work as expected, though it should not make any difference based on my class declaration. Test script: --------------- Class declaration: http://beamstyle.com.hk/download/script.txt Test Script A (Main): \Namespace2\B::test() . '<br>'; \Namespace2\C::test() . '<br>'; \Namespace2\B::test() . '<br>'; \Namespace2\C::test() . '<br>'; Test Script B (On the side): \Namespace2\C::test() . '<br>'; \Namespace2\B::test() . '<br>'; \Namespace2\C::test() . '<br>'; \Namespace2\B::test() . '<br>'; Expected result: ---------------- $var===null for the class: Namespace2\B $var===null for the class: Namespace2\C $var!==null for the class: Namespace2\B $var!==null for the class: Namespace2\C Actual result: -------------- $var===null for the class: Namespace2\B $var!==null for the class: Namespace2\C $var!==null for the class: Namespace2\B $var!==null for the class: Namespace2\C -- Edit bug report at https://bugs.php.net/bug.php?id=73713&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73713&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73713&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73713&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73713&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73713&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73713&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73713&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73713&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73713&r=support Expected behavior: https://bugs.php.net/fix.php?id=73713&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73713&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73713&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73713&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73713&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73713&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73713&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73713&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73713&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73713&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73713&r=mysqlcfg

« previous php.bugs (#205897) next »