php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25302 referancing object members in GLOBALS does not work properly
Submitted: 2003-08-28 15:05 UTC Modified: 2003-09-07 20:05 UTC
From: rani_s_m2001 at yahoo dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.3.2 OS: windows xp
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: rani_s_m2001 at yahoo dot com
New email:
PHP Version: OS:

 

 [2003-08-28 15:05 UTC] rani_s_m2001 at yahoo dot com
Description:
------------
when creating an object on the globals array, referancing its members to a variable does not work properly.

it works as expected in normal arrays.



Reproduce code:
---------------
<?php

 class a
 {
  var $r;
  function a()
  {
   $this->r=1;
  }


 }

 $GLOBALS["a"]=&new a();
 $a=&$GLOBALS["a"]->r;

 print($a);
  $GLOBALS["a"]->r=2;
//should print 2, instead prints 1
 print($a);

?>


Expected result:
----------------
12

Actual result:
--------------
11

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-07 20:05 UTC] sniper@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

There are dozens of other ways too to "shoot-yourself-in-foot"..just don't do it.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 01 01:01:28 2024 UTC