php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29931 Accessing a class' array via foreach causes no output
Submitted: 2004-09-01 17:07 UTC Modified: 2004-09-02 11:23 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mattmecham at gmail dot com Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 5.0.1 OS: Apache/1.3.31 (Unix)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mattmecham at gmail dot com
New email:
PHP Version: OS:

 

 [2004-09-01 17:07 UTC] 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();


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-02 08:10 UTC] 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-02 11:23 UTC] mattmecham at gmail dot com
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 12 10:01:31 2024 UTC