Hi internals,
casting an object to array gives the possibility to get the values of protected/private member variables :
<?php
class some {
public $pub = 1;
protected $prot = 2;
private $priv = 3;


}
var_dump((array)new some());

?>
Produces :
array(3) {
  ["pub"]=>
  int(1)
  ["*prot"]=>
  int(2)
  ["somepriv"]=>
  int(3)
}

IMO, when casting to array with (array) only the public-ly visible members should returned.

Andrey

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to