#29931 [Fbk->Csd]: Accessing a class' array via foreach causes no output
| From: | mattmecham at gmail dot com | Date: | Thu, 02 Sep 2004 09:23:08 +0000 |
| Subject: | #29931 [Fbk->Csd]: Accessing a class' array via foreach causes no output | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-65622@lists.php.net to get a copy of this message | ||
ID: 29931
User updated by: mattmecham at gmail dot com
Reported By: mattmecham at gmail dot com
-Status: Feedback
+Status: Closed
Bug Type: Reproducible crash
Operating System: Apache/1.3.31 (Unix)
PHP Version: 5.0.1
New Comment:
Thanks for the reply Derick.
It's fixed in the CVS. FWIW, I couldn't reproduce on my OS X server
(just upgraded to 5.0.1) but could on the linux box.
Another bug report bites the dust.
Previous Comments:
------------------------------------------------------------------------
[2004-09-02 08:10:23] derick@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.0-win32-latest.zip
Your code works fine for me, can you please try the latest snapshot?
------------------------------------------------------------------------
[2004-09-01 17:07:07] mattmecham at gmail dot com
Description:
------------
Unless something dramatic has changed in the way objects are handled,
the code here will cause the browser to show "This document contains no
data" whatever the subsequent output from the script. No entries into
the apache error_log are made and E_ALL shows no errors.
Problem seems to be with "foreach( $newclass->test_array...".
Commenting this out removes the problem as does:
$tmp = $newclass->test_array
foreach( $tmp as $i )
Can give entire phpinfo() if required.
Reproduce code:
---------------
error_reporting ( E_ALL );
class someclass
{
var $test_array = array();
}
$newclass = new someclass();
# Populate with dummy data..
for( $i=0; $i < 100 ; $i++ )
{
$newclass->test_array[] = $i;
}
foreach( $newclass->test_array as $i )
{
print $i."\n";
}
print "Test";
exit();
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29931&edit=1