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

From: Date: Thu, 25 Jun 2020 08:07:49 +0000
Subject: Bug #73713 [Opn->Fbk]: 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-227641@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
 Updated by:         nikic@php.net
 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
+Status:             Feedback
 Type:               Bug
 Package:            Class/Object related
 Operating System:   Windows
 PHP Version:        5.6.25
 Block user comment: N
 Private report:     N

 New Comment:

It looks like the script.txt is no longer available, so it's no longer possible to understand
what this bug report was about :(


Previous Comments:
------------------------------------------------------------------------
[2016-12-20 04:34:46] thomas at beamstyle dot com dot hk

Hello there, doesn't seem so active here.  Does anyone happy to see this issue?

------------------------------------------------------------------------
[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


Thread (5 messages)

« previous php.bugs (#227641) next »