cvs: php-src /ext/spl spl_array.c /ext/spl/tests arrayObject_magicMethods6.phpt bug45622b.phpt

From: Date: Thu, 21 May 2009 13:25:48 +0000
Subject: cvs: php-src /ext/spl spl_array.c /ext/spl/tests arrayObject_magicMethods6.phpt bug45622b.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-58096@lists.php.net to get a copy of this message
lbarnaud Thu May 21 13:25:48 2009 UTC Added files: /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: 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.164&r2=1.165&diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.164 php-src/ext/spl/spl_array.c:1.165 --- php-src/ext/spl/spl_array.c:1.164 Thu Mar 26 20:02:12 2009 +++ php-src/ext/spl/spl_array.c Thu May 21 13:25:48 2009 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_array.c,v 1.164 2009/03/26 20:02:12 felipe Exp $ */ +/* $Id: spl_array.c,v 1.165 2009/05/21 13:25:48 lbarnaud Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -749,12 +749,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.2&r2=1.3&diff_format=u Index: php-src/ext/spl/tests/arrayObject_magicMethods6.phpt diff -u php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.2 php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.3 --- php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.2 Fri Oct 17 14:40:13 2008 +++ php-src/ext/spl/tests/arrayObject_magicMethods6.phpt Thu May 21 13:25:48 2009 @@ -143,11 +143,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)#1 (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.

« previous php.cvs (#58096) next »