ID: 31194
Updated by: [EMAIL PROTECTED]
Reported By: yubing at cernet dot edu dot cn
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Redhat Linux 8.0
PHP Version: 4.3.10
New Comment:
Do not file bugs when you have Zend extensions (zend_extension=)
loaded. Examples are Zend Optimizer, Zend Debugger, Turck MM Cache,
APC, Xdebug and ionCube loader. These extensions often modify engine
behavior which is not related to PHP itself.
.
Previous Comments:
------------------------------------------------------------------------
[2004-12-20 10:51:12] yubing at cernet dot edu dot cn
faint, maybe it's because of the problem of ZendOptmizer.
------------------------------------------------------------------------
[2004-12-20 10:41:00] yubing at cernet dot edu dot cn
Description:
------------
foreach on array containing objects without "$key =>" is not compatible
with pre-versions
Is that because of the porting of those code from v5.0.2 ?
b2evo and xoops use many this kind of statements to fetch the database
objects.
Reproduce code:
---------------
$a = array();
$user->name = "peter";
$user->age = "24";
$a[0] = $user;
$user->name = "ice";
$user->age = "25";
$a[1] = $user;
foreach ( $a as $u){
// foreach ( $a as $key => $u) works ok
print $u->name.": ".$u->age."\n";
var_dump($u);
}
Expected result:
----------------
peter:24
ice:25
object(stdClass)(2) {
["name"]=>
string(5) "peter"
["age"]=>
string(2) "24"
}
object(stdClass)(2) {
["name"]=>
string(3) "ice"
["age"]=>
string(2) "25"
}
Actual result:
--------------
NULL:NULL
NULL:NULL
array(2) {
[0]=>
object(stdClass)(2) {
["name"]=>
string(5) "peter"
["age"]=>
string(2) "24"
}
[1]=>
int(0)
}
array(2) {
[0]=>
object(stdClass)(2) {
["name"]=>
string(3) "ice"
["age"]=>
string(2) "25"
}
[1]=>
int(1)
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31194&edit=1