php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21108 ?: evaluates to copy of object
Submitted: 2002-12-20 04:53 UTC Modified: 2002-12-20 05:10 UTC
From: RNova at gmx dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.2.3 OS: Windows 98
Private report: No CVE-ID: None
 [2002-12-20 04:53 UTC] RNova at gmx dot net
Since I do not know the internals of PHP, it's probably best to just give an example:

$a = 11;

function &f()  {
    return TRUE ? $GLOBALS['a'] : $GLOBALS['a'];
}

function &g()  {
    return $GLOBALS['a'];
}

$b =& f();
$b = 12;
echo $a."<hr>";
$c =& g();
$c = 13;
echo $a;

-----
output: 11<hr>13
expected output: 12<hr>13

Thanks for fixing this,
Cheers,
    Rai

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-20 05:10 UTC] derick@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the existing bug instead.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC