cvs: ZendEngine2 / zend_builtin_functions.c /tests bug42211.phpt

From: Date: Wed, 08 Aug 2007 13:32:59 +0000
Subject: cvs: ZendEngine2 / zend_builtin_functions.c /tests bug42211.phpt
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-5956@lists.php.net to get a copy of this message
dmitry Wed Aug 8 13:32:59 2007 UTC Modified files: /ZendEngine2 zend_builtin_functions.c /ZendEngine2/tests bug42211.phpt Log: Fixed bug #42211 (property_exists() fails to find protected properties from a parent class) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.346&r2=1.347&diff_format=u Index: ZendEngine2/zend_builtin_functions.c diff -u ZendEngine2/zend_builtin_functions.c:1.346 ZendEngine2/zend_builtin_functions.c:1.347 --- ZendEngine2/zend_builtin_functions.c:1.346 Thu Aug 2 20:32:34 2007 +++ ZendEngine2/zend_builtin_functions.c Wed Aug 8 13:32:58 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_builtin_functions.c,v 1.346 2007/08/02 20:32:34 tony2001 Exp $ */ +/* $Id: zend_builtin_functions.c,v 1.347 2007/08/08 13:32:58 dmitry Exp $ */ #include "zend.h" #include "zend_API.h" @@ -1014,7 +1014,8 @@ } zend_u_unmangle_property_name(Z_TYPE_PP(property), property_info->name, property_info->name_length, &class_name, &prop_name); if (class_name.s[0] == '*') { - if (instanceof_function(EG(scope), ce TSRMLS_CC)) { + if (instanceof_function(EG(scope), ce TSRMLS_CC) || + (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC))) { RETURN_TRUE; } RETURN_FALSE; http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug42211.phpt?r1=1.1&r2=1.2&diff_format=u Index: ZendEngine2/tests/bug42211.phpt diff -u /dev/null ZendEngine2/tests/bug42211.phpt:1.2 --- /dev/null Wed Aug 8 13:32:59 2007 +++ ZendEngine2/tests/bug42211.phpt Wed Aug 8 13:32:58 2007 @@ -0,0 +1,30 @@ +--TEST-- +Bug #42211 (property_exists() fails to find protected properties from a parent class) +--FILE-- +<?php +class A { + function foo() { + var_dump(property_exists('B', 'publicBar')); + var_dump(property_exists('B', 'protectedBar')); + var_dump(property_exists('B', 'privateBar')); + } +} + +class B extends A { + static public $publicBar = "ok"; + static protected $protectedBar = "ok"; + static private $privateBar = "fail"; +} + +$a = new A(); +$a->foo(); +$b = new B(); +$b->foo(); +--EXPECT-- +bool(true) +bool(false) +bool(false) +bool(true) +bool(true) +bool(false) +

« previous php.zend-engine.cvs (#5956) next »