From:             redeye at erisx dot de
Operating system: Linux, Windows
PHP version:      5.0.0b1 (beta1)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  Incorrect behaviour of PPP using foreach

Description:
------------
Using a foreach ( or while ) loop to print the
content of an object should to my understanding
skip private and protected values ( or methods ).

Actually these values are returned but missing
their respective keys, so at least their source
is hidden.

Reproduce code:
---------------
<pre><?php

class test {
    private   $foo = 'test foo';
    private   $bar = 'test bar';
    protected $foobar = 'test foobar';
}

$test = new test;
foreach ( $test AS $key => $val ){
    echo $key." => ".$val."\r\n";
}

?></pre>

Expected result:
----------------
empty page :)

Actual result:
--------------
 => test foo
 => test bar
 => test foobar

-- 
Edit bug report at http://bugs.php.net/?id=24837&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24837&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24837&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=24837&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24837&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24837&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24837&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24837&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24837&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24837&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24837&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24837&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24837&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24837&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24837&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24837&r=gnused

Reply via email to