|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-02-05 16:53 UTC] helly@php.net
[2004-03-15 10:29 UTC] sniper@php.net
[2004-03-15 10:33 UTC] andrey@php.net
[2004-03-15 10:40 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 01:00:02 2025 UTC |
Description: ------------ casting an object to array gives the possibility to get the values of protected/private member variables : IMO, when casting to array with (array) only the public-ly visible members should returned. Andrey Reproduce code: --------------- <?php class some { public $pub = 1; protected $prot = 2; private $priv = 3; } var_dump((array)new some()); ?> Expected result: ---------------- array(3) { ["pub"]=> int(1) } Actual result: -------------- array(3) { ["pub"]=> int(1) ["*prot"]=> int(2) ["somepriv"]=> int(3) }