felipe Wed, 11 Nov 2009 18:59:37 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=290516
Log: - Fixed bug #50146 (property_exists: Closure object cannot have properties) Bug: http://bugs.php.net/50146 (Closed) property_exists: Closure object cannot have properties Changed paths: U php/php-src/branches/PHP_5_3/NEWS A php/php-src/branches/PHP_5_3/Zend/tests/bug50146.phpt U php/php-src/branches/PHP_5_3/Zend/zend_closures.c A php/php-src/trunk/Zend/tests/bug50146.phpt U php/php-src/trunk/Zend/zend_closures.c Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2009-11-11 18:52:12 UTC (rev 290515) +++ php/php-src/branches/PHP_5_3/NEWS 2009-11-11 18:59:37 UTC (rev 290516) @@ -22,6 +22,8 @@ - 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 Added: php/php-src/branches/PHP_5_3/Zend/tests/bug50146.phpt =================================================================== --- php/php-src/branches/PHP_5_3/Zend/tests/bug50146.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/Zend/tests/bug50146.phpt 2009-11-11 18:59:37 UTC (rev 290516) @@ -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 Property changes on: php/php-src/branches/PHP_5_3/Zend/tests/bug50146.phpt ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Added: svn:eol-style + native Modified: php/php-src/branches/PHP_5_3/Zend/zend_closures.c =================================================================== --- php/php-src/branches/PHP_5_3/Zend/zend_closures.c 2009-11-11 18:52:12 UTC (rev 290515) +++ php/php-src/branches/PHP_5_3/Zend/zend_closures.c 2009-11-11 18:59:37 UTC (rev 290516) @@ -152,7 +152,9 @@ 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; } /* }}} */ Added: php/php-src/trunk/Zend/tests/bug50146.phpt =================================================================== --- php/php-src/trunk/Zend/tests/bug50146.phpt (rev 0) +++ php/php-src/trunk/Zend/tests/bug50146.phpt 2009-11-11 18:59:37 UTC (rev 290516) @@ -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 Property changes on: php/php-src/trunk/Zend/tests/bug50146.phpt ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Added: svn:eol-style + native Modified: php/php-src/trunk/Zend/zend_closures.c =================================================================== --- php/php-src/trunk/Zend/zend_closures.c 2009-11-11 18:52:12 UTC (rev 290515) +++ php/php-src/trunk/Zend/zend_closures.c 2009-11-11 18:59:37 UTC (rev 290516) @@ -161,7 +161,9 @@ 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; } /* }}} */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php