lbarnaud Thu May 21 13:26:29 2009 UTC Added files: (Branch: PHP_5_2) /php-src/ext/spl/tests bug45622b.phpt
Modified files: /php-src/ext/spl spl_array.c /php-src/ext/spl/tests arrayObject_magicMethods6.phpt Log: MFH: Better fix for #45622 (patch by robinf at php do net) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.24&r2=1.71.2.17.2.25&diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.24 php-src/ext/spl/spl_array.c:1.71.2.17.2.25 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.24 Thu May 14 16:44:54 2009 +++ php-src/ext/spl/spl_array.c Thu May 21 13:26:29 2009 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.24 2009/05/14 16:44:54 lbarnaud Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.25 2009/05/21 13:26:29 lbarnaud Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -671,12 +671,12 @@ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); - if (std_object_handlers.has_property(object, member, has_set_exists TSRMLS_CC)) { - return 1; - } else if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0) { + if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0 + && !std_object_handlers.has_property(object, member, 2 TSRMLS_CC)) { return spl_array_has_dimension(object, member, has_set_exists TSRMLS_CC); } - return 0; + return std_object_handlers.has_property(object, member, has_set_exists TSRMLS_CC); + } /* }}} */ static void spl_array_unset_property(zval *object, zval *member TSRMLS_DC) /* {{{ */ http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/arrayObject_magicMethods6.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-src/ext/spl/tests/arrayObject_magicMethods6.phpt diff -u php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.1.2.2 php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.1.2.3 --- php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.1.2.2 Thu May 14 16:44:54 2009 +++ php-src/ext/spl/tests/arrayObject_magicMethods6.phpt Thu May 21 13:26:29 2009 @@ -133,11 +133,8 @@ } --> isset existent, non-existent and dynamic: -In UsesMagic::__isset(a) bool(true) -In UsesMagic::__isset(nonexistent) bool(false) -In UsesMagic::__isset(dynamic) bool(true) Original wrapped object: object(C)#%d (5) { http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug45622b.phpt?view=markup&rev=1.1 Index: php-src/ext/spl/tests/bug45622b.phpt +++ php-src/ext/spl/tests/bug45622b.phpt --TEST-- Ensure fix to bug45622 doesn't cause __isset() to be called when ArrayObject::ARRAY_AS_PROPS is used. --FILE-- <?php class UsesMagic extends ArrayObject { function __get($n) { echo "In " . __METHOD__ . "!\n"; } function __set($n, $v) { echo "In " . __METHOD__ . "!\n"; } function __isset($n) { echo "In " . __METHOD__ . "!\n"; } function __unset($n) { echo "In " . __METHOD__ . "!\n"; } } $ao = new UsesMagic(array(), ArrayObject::ARRAY_AS_PROPS); echo "Doesn't trigger __get.\n"; echo $ao->prop1; echo "Doesn't trigger __set.\n"; $ao->prop2 = 'foo'; echo "Doesn't trigger __unset.\n"; unset($ao->prop3); echo "Shouldn't trigger __isset.\n"; isset($ao->prop4); ?> --EXPECTF-- Doesn't trigger __get. Notice: Undefined index: prop1 in %s on line 11 Doesn't trigger __set. Doesn't trigger __unset. Notice: Undefined index: prop3 in %s on line 17 Shouldn't trigger __isset. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php