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
 [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

Pull Requests

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: Thu Dec 26 15:01:32 2024 UTC