From: Felipe Pena Date: Wed, 11 Nov 2009 18:59:37 +0000 (+0000) Subject: - Fixed bug #50146 (property_exists: Closure object cannot have properties) X-Git-Tag: php-5.3.2RC1~253 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dcf91e6266311be4023096f83b5416ff19766dd5;p=php - Fixed bug #50146 (property_exists: Closure object cannot have properties) --- diff --git a/NEWS b/NEWS index c1de96b643..9ea1888def 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,8 @@ PHP NEWS - Fixed bug #50152 (ReflectionClass::hasProperty hehaves like isset() not property_exists). (Felipe) +- Fixed bug #50146 (property_exists: Closure object cannot have properties). + (Felipe) - Fixed bug #50073 (parse_url() incorrect when ? in fragment). (Ilia) - Fixed bug #50023 (pdo_mysql doesn't use PHP_MYSQL_UNIX_SOCK_ADDR). (Ilia) - Fixed bug #49908 (throwing exception in __autoload crashes when interface diff --git a/Zend/tests/bug50146.phpt b/Zend/tests/bug50146.phpt new file mode 100644 index 0000000000..7aa26a6509 --- /dev/null +++ b/Zend/tests/bug50146.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #50146 (property_exists: Closure object cannot have properties) +--FILE-- +hasProperty('b')); + +var_dump(isset($obj->a)); + +?> +--EXPECTF-- +bool(false) +bool(false) + +Catchable fatal error: Closure object cannot have properties in %s on line %d diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index ea641e5df7..e36c7ce99b 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -152,7 +152,9 @@ static zval **zend_closure_get_property_ptr_ptr(zval *object, zval *member TSRML static int zend_closure_has_property(zval *object, zval *member, int has_set_exists TSRMLS_DC) /* {{{ */ { - ZEND_CLOSURE_PROPERTY_ERROR(); + if (has_set_exists != 2) { + ZEND_CLOSURE_PROPERTY_ERROR(); + } return 0; } /* }}} */