ID: 30694 Updated by: [EMAIL PROTECTED] Reported By: guth at fiifo dot u-psud dot fr -Status: Assigned +Status: Wont fix Bug Type: Zend Engine 2 problem Operating System: Linux PHP Version: 5.0.2 Assigned To: andi New Comment:
I don't think this is a bug. In general, ZEII makes a much clearer destinction between objects and arrays. The conversion between them is still defined for BC reasons. I think defining the conversion to mean that only public variables will be in the resulting array is fair and makes sense as array's have no sense of access modifiers *and* it doesn't break BC as protected doesn't exist in PHP 4. Previous Comments: ------------------------------------------------------------------------ [2004-11-09 17:16:08] [EMAIL PROTECTED] Assigning to Andi. But I'd like to add that using objects as arrays of properties should be deprecated IMO, as there are plenty of functions respecting scope (see get_object_vars(), for example) and personally I do not see any sense in duplicating their functionality. ------------------------------------------------------------------------ [2004-11-05 17:40:36] guth at fiifo dot u-psud dot fr Description: ------------ Hello, array_key_exists should return true for protected and private vars if the are called from that scope. Bad english to explain more, so look at the code. Vincent Guth Reproduce code: --------------- <?php class A { protected $b = 'test'; public $c = 'test'; public function __construct() { var_dump(array_key_exists('b', $this)); var_dump(array_key_exists('c', $this)); } } new A; ?> Expected result: ---------------- bool(true) bool(true) Actual result: -------------- bool(false) bool(true) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30694&edit=1