]> granicus.if.org Git - php/commitdiff
- Fixed bug #50146 (property_exists: Closure object cannot have properties)
authorFelipe Pena <felipe@php.net>
Wed, 11 Nov 2009 18:59:37 +0000 (18:59 +0000)
committerFelipe Pena <felipe@php.net>
Wed, 11 Nov 2009 18:59:37 +0000 (18:59 +0000)
Zend/tests/bug50146.phpt [new file with mode: 0644]
Zend/zend_closures.c

diff --git a/Zend/tests/bug50146.phpt b/Zend/tests/bug50146.phpt
new file mode 100644 (file)
index 0000000..7aa26a6
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+Bug #50146 (property_exists: Closure object cannot have properties)
+--FILE--
+<?php
+
+$obj = function(){};
+
+var_dump(property_exists($obj,'foo'));
+
+$ref = new ReflectionObject($obj);
+var_dump($ref->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
index 84425ba99d38e3cdc8f32bb908bbdf22c86dee9d..6caca0f5f8bb39c1e8a921887fc6c81d2dfc97b2 100644 (file)
@@ -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;
 }
 /* }}} */