Bug #73516 [NEW]: Static variable and pointer problem
| From: | info at project dot mn | Date: | Mon, 14 Nov 2016 13:42:17 +0000 |
| Subject: | Bug #73516 [NEW]: Static variable and pointer problem | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-205361@lists.php.net to get a copy of this message | ||
From: info at project dot mn
Operating system: Any OS
PHP version: 5.6.28
Package: Class/Object related
Bug Type: Bug
Bug description:Static variable and pointer problem
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 bug report at https://bugs.php.net/bug.php?id=73516&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73516&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73516&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73516&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73516&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73516&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73516&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73516&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73516&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73516&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73516&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73516&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73516&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73516&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73516&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73516&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73516&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73516&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73516&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73516&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73516&r=mysqlcfg