php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20670 Object reference with global variables bug
Submitted: 2002-11-27 03:36 UTC Modified: 2002-12-09 06:37 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: sitnikov at infonet dot ee Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 4.3.0-dev OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sitnikov at infonet dot ee
New email:
PHP Version: OS:

 

 [2002-11-27 03:36 UTC] sitnikov at infonet dot ee
$globalref_bar===NULL  after  $o2 = &new Bar();

Source
----------------------------
<?
    $globalref_foo = array();
    $globalref_bar = null;

        class Foo {
                function Foo()
                {
                        global $globalref_foo;
                        $globalref_foo[] = &$this;
                }
        }

        class Bar {
                function Bar()
                {
                        global $globalref_bar;
                        $globalref_bar = &$this;
                }
        }

        $o1 = &new Foo();
        $o2 = &new Bar();

        var_dump($globalref_foo);
        var_dump($globalref_bar);
        var_dump($o1);
        var_dump($o2);
?>

Output:
----------------------------
array(1) {
  [0]=>
  &object(foo)(0) {
  }
}
NULL
object(foo)(0) {
}
object(bar)(0) {
}
-----------------------------

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-09 06:37 UTC] andi@php.net
Will be fixed in Engine 2.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Jul 06 16:05:46 2022 UTC