|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-10-10 04:06 UTC] googleguy@php.net
[2017-10-10 04:11 UTC] requinix@php.net
[2017-10-12 00:11 UTC] anrdaemon at freemail dot ru
[2021-07-12 08:26 UTC] nikic@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: nikic
[2021-07-12 08:26 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
Description: ------------ It is possible to access values (and names to an extent) of all object properties regardless their access level using reset/end/each. This behavior also prevents the expected behavior from using reset/next/current with clasess implementing Iterator/ArrayAccess interfaces. Test script: --------------- <?php class MyClass { private $var1 = 'Some value 1'; protected $var2 = 'Some value 2'; protected $var3 = 'Some value 3'; } $obj = new MyClass; foreach($obj as $key => $value) { print "$key => $value\n"; } reset($obj); while($val = each($obj)) print_r($val); Expected result: ---------------- No output. Actual result: -------------- The class content is dumped from second loop.