From: [EMAIL PROTECTED]
Operating system: all
PHP version: 5CVS-2004-01-17 (dev)
PHP Bug Type: Zend Engine 2 problem
Bug description: casting an object instance to array exports protected/private data
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 bug report at http://bugs.php.net/?id=26946&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26946&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26946&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26946&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26946&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26946&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26946&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26946&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26946&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26946&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26946&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26946&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26946&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26946&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26946&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26946&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26946&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26946&r=float