#32793 [Opn->Bgs]: foreach chage the type from object to string
| From: | tony2001@php.net | Date: | Thu, 21 Apr 2005 20:22:21 +0000 |
| Subject: | #32793 [Opn->Bgs]: foreach chage the type from object to string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-78015@lists.php.net to get a copy of this message | ||
ID: 32793
Updated by: tony2001@php.net
Reported By: ijb_green at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Linux 2.6.9-1.667
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:
------------------------------------------------------------------------
[2005-04-21 22:10:13] ijb_green at hotmail dot com
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 this bug report at http://bugs.php.net/?id=32793&edit=1