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.4.0alpha1~191^2~2409 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fc9c17690de92fe9b1ad820f8293b71c01009f57;p=php - Fixed bug #50146 (property_exists: Closure object cannot have properties) --- 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 84425ba99d..6caca0f5f8 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -161,7 +161,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; } /* }}} */