#32793 [NEW]: foreach chage the type from object to string

From: Date: Thu, 21 Apr 2005 20:10:13 +0000
Subject: #32793 [NEW]: foreach chage the type from object to string
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-78014@lists.php.net to get a copy of this message
From: ijb_green at hotmail dot com Operating system: Linux 2.6.9-1.667 PHP version: 4.3.10 PHP Bug Type: Class/Object related Bug description: foreach chage the type from object to string Description: ------------ When i iterate a array that contains Objects asociated with a numeric key foreach statement changes the type of the variable from object to string then i can't access to the object methods but i can acces to its attributes. Reproduce code: --------------- foreach ($Resultados as $Clave=>$Objeto){ if($Clave!="Count" ||$Clave!="LegislaturaRomano"){ printf("<td class='tddatosazul'>%s</td>",$Objeto->denomiCorta); //Access to the object attribute printf("<td class='tddatosazul'>%s</td>",//access object's method here it fails $Objeto->getTotalInicitivasDictaminadas()); ... Expected result: ---------------- Display the result of the method getTotalInicitivasDictaminadas it only adds two values Actual result: -------------- Fatal error: Call to a member function on a non-object -- Edit bug report at http://bugs.php.net/?id=32793&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32793&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32793&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32793&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32793&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32793&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32793&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32793&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32793&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32793&r=support Expected behavior: http://bugs.php.net/fix.php?id=32793&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32793&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32793&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32793&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32793&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32793&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32793&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32793&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32793&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32793&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32793&r=mysqlcfg

« previous php.bugs (#78014) next »