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

From: Date: Tue, 20 Dec 2016 04:34:49 +0000
Subject: Bug #73713 [Opn]: Static var in class func initialized after same func of parent class is called
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206141@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73713&edit=1 ID: 73713 User updated by: thomas at beamstyle dot com dot hk Reported by: thomas at beamstyle dot com dot hk Summary: Static var in class func initialized after same func of parent class is called Status: Open Type: Bug Package: Class/Object related Operating System: Windows PHP Version: 5.6.25 Block user comment: N Private report: N New Comment: Hello there, doesn't seem so active here. Does anyone happy to see this issue? Previous Comments: ------------------------------------------------------------------------ [2016-12-10 18:46:46] thomas at beamstyle dot com dot hk PHP version typo ------------------------------------------------------------------------ [2016-12-10 18:45:40] thomas at beamstyle dot com dot hk 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 this bug report at https://bugs.php.net/bug.php?id=73713&edit=1

« previous php.bugs (#206141) next »