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

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




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

[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