Re: [PHP-DEV] PHP 4.0 Bug #4661: Class variable corruption From: Stanislav Malyshev (stas <email protected>)
Date: 05/29/00

>> <?
>> class ProductList {
>>
>> var $grp_index;
>> var $name_index;
>>
>> /* Constructor */
>> function ProductList() {
>> $this->$grp_index = 1; # Yuck!!!
>> }
>>
>> function nextEntry() {
>> echo $this->$grp_index;
>> echo "<br>";
>> $this->$name_index = 2;
>> echo $this->$grp_index;
>> }
>> }
>> $pl = new ProductList;
>> $pl->nextEntry();
>> ?>
>>

This is not a bug. You are working whith class variable which name is
contained in $grp_index and $name_index, which both are empty - this means
you are working with $pl-><NULL> variable. If you want to get to
$this->name_index, write $this->name_index, without extra dollar. Please
read http://www.zend.com/manual/ or http://www.php.net/manual/ for syntax
about calling class variables. Also, please close this bug since it is not
a bug (at least, not a bug in PHP).

-- 
Stanislav Malyshev   stas <email protected>          
+972-3-6139665

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