]> 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)
NEWS
Zend/tests/bug50146.phpt [new file with mode: 0644]
Zend/zend_closures.c

diff --git a/NEWS b/NEWS
index c1de96b6438d03f424d42a4fbfa8439f6f9be39e..9ea1888def2d33ae277e795906db7605e271c9dd 100644 (file)
--- 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 (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 ea641e5df7e4748e31c579429891fa90e637e827..e36c7ce99b5ddaf0a5bed4279d674d233fa05217 100644 (file)
@@ -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;
 }
 /* }}} */