Permalink
Browse files

- Fixed bug #50146 (property_exists: Closure object cannot have prope…

…rties)
  • Loading branch information...
1 parent eea23b2 commit dcf91e6266311be4023096f83b5416ff19766dd5 @felipensp felipensp committed Nov 11, 2009
Showing with 25 additions and 1 deletion.
  1. +2 −0 NEWS
  2. +20 −0 Zend/tests/bug50146.phpt
  3. +3 −1 Zend/zend_closures.c
View
2 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
View
20 Zend/tests/bug50146.phpt
@@ -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
View
4 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;
}
/* }}} */

0 comments on commit dcf91e6

Please sign in to comment.