Edit report at https://bugs.php.net/bug.php?id=55211&edit=1
ID: 55211
Updated by: cmb@php.net
Reported by: suman dot madavapeddi at gmail dot com
Summary: ArrayObject::getArrayObject() should only returns
public properties of an object
Status: Verified
-Type: Bug
+Type: Documentation Problem
Package: SPL related
Operating System: windows 7 Professional
PHP Version: 5.3.6
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Well, I doubt that this is a real bug, since casting an object to
array exhibits the same behavior. Thus I'm changing to
documentation problem.
Previous Comments:
------------------------------------------------------------------------
[2011-07-25 02:33:59] laruence@php.net
The following patch has been added/updated:
Patch Name: getarraycopy-skip-object-protected-private-properties
Revision: 1311575639
URL: https://bugs.php.net/patch-display.php?bug=55211&patch=getarraycopy-skip-object-protected-private-properties&revision=1311575639
------------------------------------------------------------------------
[2011-07-24 04:17:05] laruence@php.net
The following patch has been added/updated:
Patch Name: getarraycopy-skip-protected-and-private
Revision: 1311481025
URL: https://bugs.php.net/patch-display.php?bug=55211&patch=getarraycopy-skip-protected-and-private&revision=1311481025
------------------------------------------------------------------------
[2011-07-14 20:46:31] suman dot madavapeddi at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/arrayobject.getarraycopy%23Description
---
when it is referred to an object it should return only public properties of an
object .But, Instead it is returning all the Properties of an Object
Test script:
---------------
class MyClass{
public $pbvar = "public Variable";
private $prvar = "Private Variable";
protected $pdvar = "Protected Variable";
}
$ar = new ArrayObject( new MyClass());
$arc = $ar->getArrayCopy();
print_r($arc);
Expected result:
----------------
Array
(
[pbvar] => public Variable
)
Actual result:
--------------
Array
(
[pbvar] => public Variable
[MyClass5prvar] => Private Variable
[*pdvar] => Protected Variable
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55211&edit=1