diff options
author | Jason Greene <jason@php.net> | 2001-02-20 16:44:57 +0000 |
---|---|---|
committer | Jason Greene <jason@php.net> | 2001-02-20 16:44:57 +0000 |
commit | ffa08fc26e2cd8db5e49f43b607d50e05fa622c8 (patch) | |
tree | 4bcc09aefef7fe1ac0e0eabd29efae1777d4abeb /ext/standard/array.c | |
parent | f9fe6880555ed9566c7e8fcfd5a23e4c7e34956e (diff) | |
download | php-git-ffa08fc26e2cd8db5e49f43b607d50e05fa622c8.tar.gz |
Changed default behavior of array_search to match in_array
(strict was default on, and is now default off)
Diffstat (limited to 'ext/standard/array.c')
-rw-r--r-- | ext/standard/array.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index 7fe829f8e2..df81431799 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1051,15 +1051,8 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) HashPosition pos; /* hash iterator */ ulong num_key; char *string_key; - int (*compare_func)(zval *, zval *, zval *); - - if (behavior == 0) { - compare_func = is_equal_function; - } else { - /* Lets not return a key unless the values are exact */ - compare_func = is_identical_function; - } - + int (*compare_func)(zval *, zval *, zval *) = is_equal_function; + if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &value, &array, &strict) == FAILURE) { WRONG_PARAM_COUNT; @@ -1079,9 +1072,7 @@ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) convert_to_boolean_ex(strict); if (Z_LVAL_PP(strict)) { compare_func = is_identical_function; - } else { - compare_func = is_equal_function; - } + } } target_hash = HASH_OF(*array); |