Patch for Bug #20681: object lookup with array_search()
| From: | Moriyoshi Koizumi | Date: | Wed, 04 Dec 2002 07:24:57 +0000 |
| Subject: | Patch for Bug #20681: object lookup with array_search() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-92055@lists.php.net to get a copy of this message | ||
Hi,
I'm trying to make a slight change on array_search(), which allows object
lookup with array_search() in ZendEngine2.
I think this feature doesn't break backwards compatiblity.
If there seems no problem, I'll commit the patch and close that PR.
Moriyoshi
Index: ext/standard/array.c =================================================================== RCS file: /repository/php4/ext/standard/array.c,v retrieving revision 1.206 diff -u -r1.206 array.c --- ext/standard/array.c 3 Dec 2002 15:02:06 -0000 1.206 +++ ext/standard/array.c 4 Dec 2002 07:21:07 -0000 @@ -1056,12 +1056,12 @@ zend_get_parameters_ex(ZEND_NUM_ARGS(), &value, &array, &strict) == FAILURE) { WRONG_PARAM_COUNT; } - +#ifndef ZEND_ENGINE_2 if (Z_TYPE_PP(value) == IS_OBJECT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong datatype for first argument"); RETURN_FALSE; } - +#endif if (Z_TYPE_PP(array) != IS_ARRAY) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong datatype for second argument"); RETURN_FALSE;
Index: ext/standard/array.c =================================================================== RCS file: /repository/php4/ext/standard/array.c,v retrieving revision 1.206 diff -u -r1.206 array.c --- ext/standard/array.c 3 Dec 2002 15:02:06 -0000 1.206 +++ ext/standard/array.c 4 Dec 2002 07:21:07 -0000 @@ -1056,12 +1056,12 @@ zend_get_parameters_ex(ZEND_NUM_ARGS(), &value, &array, &strict) == FAILURE) { WRONG_PARAM_COUNT; } - +#ifndef ZEND_ENGINE_2 if (Z_TYPE_PP(value) == IS_OBJECT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong datatype for first argument"); RETURN_FALSE; } - +#endif if (Z_TYPE_PP(array) != IS_ARRAY) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong datatype for second argument"); RETURN_FALSE;