|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27063 SPL: ArrayObject does not handle PPP correctly
Submitted: 2004-01-27 13:47 UTC Modified: 2004-04-25 13:15 UTC
From: adam at trachtenberg dot com Assigned: helly
Status: Closed Package: Scripting Engine problem
PHP Version: 5.0.0RC2 OS: *
Private report: No CVE-ID:
 [2004-01-27 13:47 UTC] adam at trachtenberg dot com
The ArrayObject class does not correctly set protected 
and private property names.

Reproduce code:
class Test {
	public $public = 'Public';
	protected $protected = 'Protected';
	private $private = 'Private';


foreach (new ArrayObject(new Test) as $property => $value) {
	print "$property: $value\n";

Expected result:
public: Public
protected: Protected
private: Private

Actual result:
public: Public
*protected: Protected
Testprivate: Private


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-27 13:55 UTC] adam at trachtenberg dot com
Upon further thought, it's unclear to me if Protected 
and Private properties should be displayed at all. 
Technically, the ArrayObject class has no legal way to 
access non-public properties as it is neither the class 
nor a child, but that may limit its usefulness.
 [2004-01-27 14:05 UTC]
It should simply respect property visibility.
 [2004-02-05 16:56 UTC]
See comment on #26946
 [2004-04-22 22:16 UTC]
Here's a patch to fix the open SPL issues:
It would be nice to have it tested prior to comitting it after RC2.
 [2004-04-25 13:15 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Mon Nov 30 00:01:32 2015 UTC