RE: [PHP-CVS] cvs: php-src /ext/standard array.c /ext/standard/tests/array bug34934.phpt
Hi Marcus, Thank you for catch. I reverted the patch and marked bug as bogus. Dmitry. > -Original Message- > From: Marcus Boerger [mailto:[EMAIL PROTECTED] > Sent: Friday, October 21, 2005 10:01 PM > To: Dmitry Stogov > Cc: php-cvs@lists.php.net > Subject: Re: [PHP-CVS] cvs: php-src /ext/standard array.c > /ext/standard/tests/array bug34934.phpt > > > Hello Dmitry, > > this is wrong! We agreed upon not allowing ArrayAccess in > array* functions. If you change this then change the macros > in array.c from Z_ARRVAL to HASH_OF and ensure that all > functions also work with ArrayAccess. Since you cannot do > that you might probably explain why the bug report is bogus! > > marcus > > > Friday, October 21, 2005, 5:20:31 PM, you wrote: > > > dmitry Fri Oct 21 11:20:31 2005 EDT > > > Modified files: > > /php-src/ext/standard array.c > > /php-src/ext/standard/tests/array bug34934.phpt > > Log: > > Fixed bug #34934 (offsetExists is not called from > array_key_exists) > > > > > > > http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.327&r2=1 > > .328&ty=u > > Index: php-src/ext/standard/array.c > > diff -u php-src/ext/standard/array.c:1.327 > php-src/ext/standard/array.c:1.328 > > --- php-src/ext/standard/array.c:1.327 Tue Oct 4 16:47:48 2005 > > +++ php-src/ext/standard/array.cFri Oct 21 11:20:30 2005 > > @@ -21,7 +21,7 @@ > > > > > +- > -+ > > */ > > > > -/* $Id: array.c,v 1.327 2005/10/04 20:47:48 tony2001 Exp $ */ > > +/* $Id: array.c,v 1.328 2005/10/21 15:20:30 dmitry Exp $ */ > > > > #include "php.h" > > #include "php_ini.h" > > @@ -4658,6 +4658,17 @@ > > RETURN_FALSE; > > } > > > > + if (Z_TYPE_PP(array) == IS_OBJECT && > > + Z_OBJ_HT_PP(array)->has_dimension && > > + (Z_OBJ_HT_PP(array)->has_dimension != > std_object_handlers.has_dimension || > > +instanceof_function_ex(Z_OBJCE_PP(array), > > U_CLASS_ENTRY(zend_ce_arrayaccess), 1 TSRMLS_CC))) { > > + if (Z_OBJ_HT_PP(array)->has_dimension(*array, > *key, 0 TSRMLS_CC)) { > > + RETURN_TRUE; > > + } else { > > + RETURN_FALSE; > > + } > > + } > > + > > switch (Z_TYPE_PP(key)) { > > case IS_STRING: > > case IS_UNICODE: > > > http://cvs.php.net/diff.php/php-src/ext/standard/tests/array/bug34934. > > phpt?r1=1.1&r2=1.2&ty=u > > Index: php-src/ext/standard/tests/array/bug34934.phpt > > diff -u /dev/null php-src/ext/standard/tests/array/bug34934.phpt:1.2 > > --- /dev/null Fri Oct 21 11:20:31 2005 > > +++ php-src/ext/standard/tests/array/bug34934.phpt Fri > Oct 21 11:20:30 2005 > > @@ -0,0 +1,18 @@ > > +--TEST-- > > +Bug #34934 (offsetExists is not called from array_key_exists) > > +--FILE-- > > + > +class MyArray extends ArrayObject { > > + function offsetExists($mKey) { > > + echo __METHOD__ . "($mKey)\n"; > > + return true; > > + } > > +} > > + > > +$a = new MyArray(); > > + > > +var_dump(array_key_exists("test", $a)); > +?>> > > +--EXPECT-- > > +MyArray::offsetExists(test) > > +bool(true) > > > > > Best regards, > Marcus > > -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard array.c /ext/standard/tests/array bug34934.phpt
dmitry Mon Oct 24 03:01:44 2005 EDT Removed files: /php-src/ext/standard/tests/array bug34934.phpt Modified files: /php-src/ext/standard array.c Log: Reverted fix for bug #34934. The bug marked as bogus. http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.329&r2=1.330&ty=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.329 php-src/ext/standard/array.c:1.330 --- php-src/ext/standard/array.c:1.329 Fri Oct 21 11:54:46 2005 +++ php-src/ext/standard/array.cMon Oct 24 03:01:42 2005 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: array.c,v 1.329 2005/10/21 15:54:46 tony2001 Exp $ */ +/* $Id: array.c,v 1.330 2005/10/24 07:01:42 dmitry Exp $ */ #include "php.h" #include "php_ini.h" @@ -4658,17 +4658,6 @@ RETURN_FALSE; } - if (Z_TYPE_PP(array) == IS_OBJECT && - Z_OBJ_HT_PP(array)->has_dimension && - (Z_OBJ_HT_PP(array)->has_dimension != std_object_handlers.has_dimension || -instanceof_function_ex(Z_OBJCE_PP(array), U_CLASS_ENTRY(zend_ce_arrayaccess), 1 TSRMLS_CC))) { - if (Z_OBJ_HT_PP(array)->has_dimension(*array, *key, 0 TSRMLS_CC)) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } - } - switch (Z_TYPE_PP(key)) { case IS_STRING: case IS_UNICODE: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/standard array.c /ext/standard/tests/array bug34934.phpt
Hello Dmitry, this is wrong! We agreed upon not allowing ArrayAccess in array* functions. If you change this then change the macros in array.c from Z_ARRVAL to HASH_OF and ensure that all functions also work with ArrayAccess. Since you cannot do that you might probably explain why the bug report is bogus! marcus Friday, October 21, 2005, 5:20:31 PM, you wrote: > dmitry Fri Oct 21 11:20:31 2005 EDT > Modified files: > /php-src/ext/standard array.c > /php-src/ext/standard/tests/array bug34934.phpt > Log: > Fixed bug #34934 (offsetExists is not called from array_key_exists) > > > http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.327&r2=1.328&ty=u > Index: php-src/ext/standard/array.c > diff -u php-src/ext/standard/array.c:1.327 php-src/ext/standard/array.c:1.328 > --- php-src/ext/standard/array.c:1.327 Tue Oct 4 16:47:48 2005 > +++ php-src/ext/standard/array.cFri Oct 21 11:20:30 2005 > @@ -21,7 +21,7 @@ > +--+ > */ > > -/* $Id: array.c,v 1.327 2005/10/04 20:47:48 tony2001 Exp $ */ > +/* $Id: array.c,v 1.328 2005/10/21 15:20:30 dmitry Exp $ */ > > #include "php.h" > #include "php_ini.h" > @@ -4658,6 +4658,17 @@ > RETURN_FALSE; > } > > + if (Z_TYPE_PP(array) == IS_OBJECT && > + Z_OBJ_HT_PP(array)->has_dimension && > + (Z_OBJ_HT_PP(array)->has_dimension != > std_object_handlers.has_dimension || > +instanceof_function_ex(Z_OBJCE_PP(array), > U_CLASS_ENTRY(zend_ce_arrayaccess), 1 TSRMLS_CC))) { > + if (Z_OBJ_HT_PP(array)->has_dimension(*array, *key, 0 TSRMLS_CC)) { > + RETURN_TRUE; > + } else { > + RETURN_FALSE; > + } > + } > + > switch (Z_TYPE_PP(key)) { > case IS_STRING: > case IS_UNICODE: > http://cvs.php.net/diff.php/php-src/ext/standard/tests/array/bug34934.phpt?r1=1.1&r2=1.2&ty=u > Index: php-src/ext/standard/tests/array/bug34934.phpt > diff -u /dev/null php-src/ext/standard/tests/array/bug34934.phpt:1.2 > --- /dev/null Fri Oct 21 11:20:31 2005 > +++ php-src/ext/standard/tests/array/bug34934.phpt Fri Oct 21 11:20:30 > 2005 > @@ -0,0 +1,18 @@ > +--TEST-- > +Bug #34934 (offsetExists is not called from array_key_exists) > +--FILE-- > + +class MyArray extends ArrayObject { > + function offsetExists($mKey) { > + echo __METHOD__ . "($mKey)\n"; > + return true; > + } > +} > + > +$a = new MyArray(); > + > +var_dump(array_key_exists("test", $a)); +?>> > +--EXPECT-- > +MyArray::offsetExists(test) > +bool(true) Best regards, Marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard array.c /ext/standard/tests/array bug34934.phpt
dmitry Fri Oct 21 11:20:31 2005 EDT Modified files: /php-src/ext/standard array.c /php-src/ext/standard/tests/array bug34934.phpt Log: Fixed bug #34934 (offsetExists is not called from array_key_exists) http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.327&r2=1.328&ty=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.327 php-src/ext/standard/array.c:1.328 --- php-src/ext/standard/array.c:1.327 Tue Oct 4 16:47:48 2005 +++ php-src/ext/standard/array.cFri Oct 21 11:20:30 2005 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: array.c,v 1.327 2005/10/04 20:47:48 tony2001 Exp $ */ +/* $Id: array.c,v 1.328 2005/10/21 15:20:30 dmitry Exp $ */ #include "php.h" #include "php_ini.h" @@ -4658,6 +4658,17 @@ RETURN_FALSE; } + if (Z_TYPE_PP(array) == IS_OBJECT && + Z_OBJ_HT_PP(array)->has_dimension && + (Z_OBJ_HT_PP(array)->has_dimension != std_object_handlers.has_dimension || +instanceof_function_ex(Z_OBJCE_PP(array), U_CLASS_ENTRY(zend_ce_arrayaccess), 1 TSRMLS_CC))) { + if (Z_OBJ_HT_PP(array)->has_dimension(*array, *key, 0 TSRMLS_CC)) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } + } + switch (Z_TYPE_PP(key)) { case IS_STRING: case IS_UNICODE: http://cvs.php.net/diff.php/php-src/ext/standard/tests/array/bug34934.phpt?r1=1.1&r2=1.2&ty=u Index: php-src/ext/standard/tests/array/bug34934.phpt diff -u /dev/null php-src/ext/standard/tests/array/bug34934.phpt:1.2 --- /dev/null Fri Oct 21 11:20:31 2005 +++ php-src/ext/standard/tests/array/bug34934.phpt Fri Oct 21 11:20:30 2005 @@ -0,0 +1,18 @@ +--TEST-- +Bug #34934 (offsetExists is not called from array_key_exists) +--FILE-- + +--EXPECT-- +MyArray::offsetExists(test) +bool(true) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php