Bug #73516 [Opn->Csd]: Static variable and pointer problem

From: Date: Wed, 08 Jan 2020 13:41:53 +0000
Subject: Bug #73516 [Opn->Csd]: Static variable and pointer problem
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224779@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73516&edit=1 ID: 73516 Updated by: nikic@php.net Reported by: info at project dot mn Summary: Static variable and pointer problem -Status: Open +Status: Closed Type: Bug Package: Class/Object related Operating System: Any OS PHP Version: 5.6.28 -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: This has been fixed in PHP 7.3, where we removed the internal use of references for static class members. Previous Comments: ------------------------------------------------------------------------ [2016-11-14 13:42:15] info at project dot mn Description: ------------ Object oriented concept not work when i use pointer(&) on static variable.Static variable of Parent and child class has diffrent value at same time Test script: --------------- class a1{ public static $obj=''; } class b1 extends a1{ } class c{ public $forprint='cccObject'; } class d{ public $forprint='dddObject'; } $c=new c(); $d=new d(); b1::$obj=& $d; a1::$obj=& $c; echo b1::$obj->forprint; //out put must be print cccObject but it print dddObject in php Actual result: -------------- dddObject ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73516&edit=1

« previous php.bugs (#224779) next »