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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
41 - 21 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC