php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #55211 ArrayObject::getArrayObject() should only returns public properties of an object
Submitted: 2011-07-14 20:46 UTC Modified: 2020-11-18 12:29 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: suman dot madavapeddi at gmail dot com Assigned: cmb (profile)
Status: Closed Package: SPL related
PHP Version: 5.3.6 OS: windows 7 Professional
Private report: No CVE-ID: None
 [2011-07-14 20:46 UTC] 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
)

Patches

getarraycopy-skip-object-protected-private-properties (last revision 2011-07-25 06:33 UTC by laruence@php.net)
getarraycopy-skip-protected-and-private (last revision 2011-07-24 04:17 UTC by laruence@php.net)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-23 15:00 UTC] dsp@php.net
-Status: Open +Status: Verified
 [2011-07-24 04:17 UTC] 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-25 02:33 UTC] 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
 [2018-08-05 02:01 UTC] carusogabriel@php.net
-Summary: ArrayObject::getArrayObject () +Summary: ArrayObject::getArrayObject() should only returns public properties of an object
 [2020-11-18 12:14 UTC] cmb@php.net
-Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: cmb
 [2020-11-18 12:14 UTC] cmb@php.net
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.
 [2020-11-18 12:29 UTC] cmb@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 05:01:29 2024 UTC