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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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 Apr 28 07:01:30 2024 UTC