lbarnaud Thu May 14 16:44:54 2009 UTC Added files: (Branch: PHP_5_2) /php-src/ext/spl/tests bug45622.phpt
Modified files: /php-src/ext/spl/tests arrayObject___construct_basic4.phpt arrayObject___construct_basic5.phpt arrayObject_setFlags_basic1.phpt arrayObject_magicMethods6.phpt /php-src/ext/spl spl_array.c Log: MFB: Fixed bug #45622 (isset($arrayObject->p) misbehaves with ArrayObject::ARRAY_AS_PROPS set) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/arrayObject___construct_basic4.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/spl/tests/arrayObject___construct_basic4.phpt diff -u php-src/ext/spl/tests/arrayObject___construct_basic4.phpt:1.1.2.1 php-src/ext/spl/tests/arrayObject___construct_basic4.phpt:1.1.2.2 --- php-src/ext/spl/tests/arrayObject___construct_basic4.phpt:1.1.2.1 Fri Oct 17 14:26:36 2008 +++ php-src/ext/spl/tests/arrayObject___construct_basic4.phpt Thu May 14 16:44:54 2009 @@ -1,7 +1,5 @@ --TEST-- SPL: ArrayObject::__construct basic usage with ArrayObject::ARRAY_AS_PROPS. ---XFAIL-- -Will fail until the fix to bug 45622 is backported from PHP53 to PHP52. --FILE-- <?php class C { http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/arrayObject___construct_basic5.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/spl/tests/arrayObject___construct_basic5.phpt diff -u php-src/ext/spl/tests/arrayObject___construct_basic5.phpt:1.1.2.1 php-src/ext/spl/tests/arrayObject___construct_basic5.phpt:1.1.2.2 --- php-src/ext/spl/tests/arrayObject___construct_basic5.phpt:1.1.2.1 Fri Oct 17 14:26:36 2008 +++ php-src/ext/spl/tests/arrayObject___construct_basic5.phpt Thu May 14 16:44:54 2009 @@ -1,7 +1,5 @@ --TEST-- SPL: ArrayObject::__construct basic usage with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS. ---XFAIL-- -Will fail unless the PHP53 fix to bug 45622 is backported to PHP52 --FILE-- <?php class C { http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/arrayObject_setFlags_basic1.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/spl/tests/arrayObject_setFlags_basic1.phpt diff -u php-src/ext/spl/tests/arrayObject_setFlags_basic1.phpt:1.1.2.1 php-src/ext/spl/tests/arrayObject_setFlags_basic1.phpt:1.1.2.2 --- php-src/ext/spl/tests/arrayObject_setFlags_basic1.phpt:1.1.2.1 Fri Oct 17 14:26:36 2008 +++ php-src/ext/spl/tests/arrayObject_setFlags_basic1.phpt Thu May 14 16:44:54 2009 @@ -1,7 +1,5 @@ --TEST-- SPL: ArrayObject::setFlags basic usage with ArrayObject::ARRAY_AS_PROPS. ---XFAIL-- -Currently fails on php.net due to bug 45622. --FILE-- <?php class C extends ArrayObject { http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/arrayObject_magicMethods6.phpt?r1=1.1.2.1&r2=1.1.2.2&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.1 php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.1.2.2 --- php-src/ext/spl/tests/arrayObject_magicMethods6.phpt:1.1.2.1 Fri Oct 17 14:26:36 2008 +++ php-src/ext/spl/tests/arrayObject_magicMethods6.phpt Thu May 14 16:44:54 2009 @@ -133,8 +133,11 @@ } --> 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) { @@ -183,4 +186,4 @@ int(3) ["priv:private"]=> string(6) "secret" -} \ No newline at end of file +} http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.23&r2=1.71.2.17.2.24&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.23 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.23 Thu May 14 16:43:38 2009 +++ php-src/ext/spl/spl_array.c Thu May 14 16:44:54 2009 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.23 2009/05/14 16:43:38 lbarnaud Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.24 2009/05/14 16:44:54 lbarnaud Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -671,13 +671,12 @@ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); - if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0) { - if (!std_object_handlers.has_property(object, member, 2 TSRMLS_CC)) { - return spl_array_has_dimension(object, member, has_set_exists TSRMLS_CC); - } - return 0; /* if prop doesn't exist at all mode 0/1 cannot return 1 */ + 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) { + return spl_array_has_dimension(object, member, has_set_exists TSRMLS_CC); } - return std_object_handlers.has_property(object, member, has_set_exists TSRMLS_CC); + return 0; } /* }}} */ static void spl_array_unset_property(zval *object, zval *member TSRMLS_DC) /* {{{ */ http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug45622.phpt?view=markup&rev=1.1 Index: php-src/ext/spl/tests/bug45622.phpt +++ php-src/ext/spl/tests/bug45622.phpt --TEST-- SPL: Bug #45622 (isset($arrayObject->p) misbehaves with ArrayObject::ARRAY_AS_PROPS set --FILE-- <?php class C extends ArrayObject { public $p = 'object property'; } $ao = new C(array('p'=>'array element')); $ao->setFlags(ArrayObject::ARRAY_AS_PROPS); echo "\n--> Access the real property:\n"; var_dump(isset($ao->p)); var_dump($ao->p); echo "\n--> Remove the real property and access the array element:\n"; unset($ao->p); var_dump(isset($ao->p)); var_dump($ao->p); echo "\n--> Remove the array element and try access again:\n"; unset($ao->p); var_dump(isset($ao->p)); var_dump($ao->p); echo "\n--> Re-add the real property:\n"; $ao->p = 'object property'; var_dump(isset($ao->p)); var_dump($ao->p); ?> --EXPECTF-- --> Access the real property: bool(true) %unicode|string%(15) "object property" --> Remove the real property and access the array element: bool(true) %unicode|string%(13) "array element" --> Remove the array element and try access again: bool(false) Notice: Undefined index: p in %s on line %d NULL --> Re-add the real property: bool(true) %unicode|string%(15) "object property" -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php