php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43713 each() - Wrong properties name in return value
Submitted: 2007-12-30 20:44 UTC Modified: 2007-12-30 20:56 UTC
From: felipe@php.net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3CVS-2007-12-30 (CVS) OS:
Private report: No CVE-ID: None
 [2007-12-30 20:44 UTC] felipe@php.net
Description:
------------
I suppose that the result is unexpected.

Reproduce code:
---------------
<?php

class foo {
    public $test1 = 1;
    private $test2 = 2;
    protected $test3 = 3;
    
    public function __construct()
    {
        while (list($key, $value) = each($this)) {
            print $key . ' => '. $value ."\n";
        }
    }
}

new foo;


Expected result:
----------------
test1 => 1
test2 => 2
test3 => 3

Actual result:
--------------
test1 => 1
footest2 => 2
*test3 => 3


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-30 20:56 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 08 09:03:37 2021 UTC