From:             mattmecham at gmail dot com
Operating system: Apache/1.3.31 (Unix)
PHP version:      5.0.1
PHP Bug Type:     Reproducible crash
Bug description:  Accessing a class' array via foreach causes no output

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 bug report at http://bugs.php.net/?id=29931&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=29931&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=29931&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=29931&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=29931&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=29931&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=29931&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=29931&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=29931&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=29931&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=29931&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=29931&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=29931&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=29931&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=29931&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=29931&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=29931&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=29931&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=29931&r=float

Reply via email to