Date: 05/11/00
- Next message: bill <email protected>: "[PHP-DEV] PHP 4.0 Bug #4416: phpinfo doesn't close center tags"
- Previous message: yuan_sheng <email protected>: "[PHP-DEV] PHP 4.0 Bug #4414: why it send charset in raw header? Content-Type: text/html;charset=iso-8859-1"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: holloway <email protected>
Operating system: Linux RedHat 6.0
PHP version: 4.0 Release Candidate 2
PHP Bug Type: Scripting Engine problem
Bug description: Nested obj ref in array doesn't see scalar changes
<?
class B {
var $_x;
function B($val) {
$this->_x = $val;
}
function getVal() {
return $this->_x;
}
function setVal ($v) {
$this->_x = $v;
}
}
class A {
var $_bObjArr;
var $_b;
function A ($value) {
// Creates a new B object.
$this->_b = new B($value);
// Should copy its reference pointer to element
// 1 of an array.
$this->_bObjArr[1] = $this->_b;
}
function setBValInArr($value) {
$tmp_bobj = $this->_bObjArr[1];
$tmp_bobj->setVal($value);
}
function setScalarBVal($value) {
$this->_b->setVal($value);
}
function getScalarVal () {
return $this->_b->getVal();
}
function getArrVal () {
$tmp_b = $this->_bObjArr[1];
return $tmp_b->getVal();
}
}
// Inside A object constructor, instantiates a B object, sets value of its
// $_x variable to 4, creates a copy of its reference pointer into an
// array.
$a = new A(4);
print "B obj. instantiated with x value 4.<br><br>";
print "Scalar retrieved value = " . $a->getScalarVal() . "<br>";
print "Array pointer retrieved value = " . $a->getArrVal() . "<br><br>";
$a->setScalarBVal(99);
print "\$_x set to <b>99</b> by SCALAR, retrieved by SCALAR. ";
print "Retrieved value = <b>" . $a->getScalarVal() . "</b><br><br>";
$a->setScalarBVal(99);
print "\$_x set to <b>99</b> by SCALAR, retrieved by ARRAY PTR. ";
print "Retrieved value = <b>" . $a->getArrVal() . "</b><br><br>";
$a->setBValInArr(99);
print "\$_x set to <b>99</b> by ARRAY PTR, retrieved by SCALAR. ";
print "Retrieved value = <b>" . $a->getScalarVal() . "</b><br><br>";
$a->setBValInArr(99);
print "\$_x set to <b>99</b> by ARRAY PTR, retrieved by ARRAY PTR. ";
print "Retrieved value = <b>" . $a->getArrVal() . "</b><br><br>";
?>
I configured PHP 4.0RC2 as static with configure line
./configure --with-mysql --with-apache=../apache_1.3.x --enable-track-vars --enable-track-sid
I don't think my php.ini is relevant. I'll be glad to provide it.
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: bill <email protected>: "[PHP-DEV] PHP 4.0 Bug #4416: phpinfo doesn't close center tags"
- Previous message: yuan_sheng <email protected>: "[PHP-DEV] PHP 4.0 Bug #4414: why it send charset in raw header? Content-Type: text/html;charset=iso-8859-1"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

