php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73516 Static variable and pointer problem
Submitted: 2016-11-14 13:42 UTC Modified: -
From: info at project dot mn Assigned:
Status: Open Package: Class/Object related
PHP Version: 5.6.28 OS: Any OS
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-11-14 13:42 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 03:01:26 2019 UTC