From: [EMAIL PROTECTED]
Operating system: Linux (Redhat 6.2) on an i686
PHP version: 4.0.4pl1
PHP Bug Type: Scripting Engine problem
Bug description: Passing out class property by reference problem
<?
function xmpdump($xValue, $sLabel="")
{
echo "$sLabel<xmp>";
var_dump($xValue);
echo "</xmp>";
}
class test
{
var $sValue;
var $Count = 0;
function getTest(&$refObj)
{
if (isset($this->sValue))
{
$refObj = &$this->sValue;
xmpdump($refObj, "Reference before being passed back");
return;
}
else
{
$refObj = "phil".$this->Count;
$this->Count++;
$this->sValue = &$refObj;
xmpdump($refObj, "Value before being passed back");
return;
}
}
}
$tst = new test();
$tst->getTest($tstObj0);
xmpdump($tstObj0, "Value after being passed back");
$tst->getTest($tstObj1);
xmpdump($tstObj1, "Refence after being passed back");
?>
The dump of $tstObj1 is NULL, despite the dump of $refObj immediately before it in the
function working correctly.
--
Edit Bug report at: http://bugs.php.net/?id=9481&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]