#29931 [Opn->Fbk]: Accessing a class' array via foreach causes no output

From: Date: Thu, 02 Sep 2004 06:10:24 +0000
Subject: #29931 [Opn->Fbk]: Accessing a class' array via foreach causes no output
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-65605@lists.php.net to get a copy of this message
ID: 29931 Updated by: derick@php.net Reported By: mattmecham at gmail dot com -Status: Open +Status: Feedback Bug Type: Reproducible crash Operating System: Apache/1.3.31 (Unix) PHP Version: 5.0.1 New Comment: 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? Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#65605) next »