ID:               26946
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Verified
+Status:           Wont fix
 Bug Type:         Zend Engine 2 problem
 Operating System: *
 PHP Version:      5CVS-2004-03-15
 New Comment:

So? They are not meant to hide data, only to enforce contracts. 


Previous Comments:
------------------------------------------------------------------------

[2004-03-15 10:33:01] [EMAIL PROTECTED]

But print_r()'s output has to be parsed while a simple cast is enough
to get the data straightly.

------------------------------------------------------------------------

[2004-03-15 10:29:46] [EMAIL PROTECTED]

print_r() shows them too, even without the cast..



------------------------------------------------------------------------

[2004-02-05 16:53:50] [EMAIL PROTECTED]

The solution is to manually loop through the property hash table and
return properties only with respect to visibility like we do inside
FE_FETCH opcode handler.

------------------------------------------------------------------------

[2004-01-17 11:12:18] [EMAIL PROTECTED]

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)

}


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=26946&edit=1

Reply via email to