PHP 4.0 Bug #4554: An array of objects within an object does not evaluate properly within a string

From: Date: Tue, 23 May 2000 01:36:44 +0000
Subject: PHP 4.0 Bug #4554: An array of objects within an object does not evaluate properly within a string
Groups: php.dev 
Request: Send a blank email to php-dev+get-19266@lists.php.net to get a copy of this message
From: jordanh@remotepoint.com Operating system: RedHat Linux 5.2 / 2.2.14 SMP PHP version: 4.0 Release Candidate 2 PHP Bug Type: Scripting Engine problem Bug description: An array of objects within an object does not evaluate properly within a string <? class child_t { var $x; } class parent_t { var $childs; function makeChildArray() { for ($i = 0; $i < 10; $i++) { $this->childs[$i] = new child_t; $this->childs[$i]->x = "Value #$i"; } } } /* main() */ $parent = new parent_t; $parent->makeChildArray(); /* Display the values from the "childs" array: */ for ($i = 0; isset($parent->childs[$i]->x); $i++) { /* BUG: See attached note! */ echo "I am in a string context: $parent->childs[$i]->x!<br>"; echo "I am <u>not</u> in the string context:" .$parent->childs[$i]->x."<br>"; } ?> Compiled with: --with-gettext --with-mysql --with-apache=../apache_1.3.12 The first few lines of the above script is as follows: I am in a string context: Array[0]->x! I am not in the string context:Value #0 I am in a string context: Array[1]->x! I am not in the string context:Value #1 Good Luck! Jordan.

« previous php.dev (#19266) next »