andrei Fri Jul 14 18:03:13 2006 UTC Modified files: /php-src unicode-progress.txt /php-src/ext/standard array.c Log: Update array_search()/in_array() for params API and mark with U. http://cvs.php.net/viewvc.cgi/php-src/unicode-progress.txt?r1=1.18&r2=1.19&diff_format=u Index: php-src/unicode-progress.txt diff -u php-src/unicode-progress.txt:1.18 php-src/unicode-progress.txt:1.19 --- php-src/unicode-progress.txt:1.18 Fri Jul 14 17:55:27 2006 +++ php-src/unicode-progress.txt Fri Jul 14 18:03:13 2006 @@ -55,9 +55,6 @@ array_reverse() Params API, test - array_search(), in_array() - Params API, test - array_splice() Params API, test @@ -100,10 +97,12 @@ array_merge_recursive() array_product() array_push(), array_pop(), array_shift(), array_unshift() + array_search() array_sum() array_values() compact() count() + in_array() min() max() range() http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.356&r2=1.357&diff_format=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.356 php-src/ext/standard/array.c:1.357 --- php-src/ext/standard/array.c:1.356 Fri Jul 14 17:55:27 2006 +++ php-src/ext/standard/array.c Fri Jul 14 18:03:13 2006 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.356 2006/07/14 17:55:27 andrei Exp $ */ +/* $Id: array.c,v 1.357 2006/07/14 18:03:13 andrei Exp $ */ #include "php.h" #include "php_ini.h" @@ -1225,40 +1225,31 @@ */ static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) { - zval **value, /* value to check for */ - **array, /* array to check in */ - **strict, /* strict comparison or not */ + zval *value, /* value to check for */ + *array, /* array to check in */ **entry, /* pointer to array entry */ res; /* comparison result */ HashTable *target_hash; /* array hashtable */ HashPosition pos; /* hash iterator */ + zend_bool strict = 0; /* strict comparison or not */ ulong num_key; uint str_key_len; zstr string_key; int (*is_equal_func)(zval *, zval *, zval * TSRMLS_DC) = 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; - } - - - if (Z_TYPE_PP(array) != IS_ARRAY) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong datatype for second argument"); - RETURN_FALSE; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "za|b", &value, &array, + &strict) == FAILURE) { + return; } - if (ZEND_NUM_ARGS() == 3) { - convert_to_boolean_ex(strict); - if (Z_LVAL_PP(strict)) { - is_equal_func = is_identical_function; - } + if (strict) { + is_equal_func = is_identical_function; } - target_hash = HASH_OF(*array); + target_hash = HASH_OF(array); zend_hash_internal_pointer_reset_ex(target_hash, &pos); while (zend_hash_get_current_data_ex(target_hash, (void **)&entry, &pos) == SUCCESS) { - is_equal_func(&res, *value, *entry TSRMLS_CC); + is_equal_func(&res, value, *entry TSRMLS_CC); if (Z_LVAL(res)) { if (behavior == 0) { RETURN_TRUE; @@ -1285,7 +1276,7 @@ } -/* {{{ proto bool in_array(mixed needle, array haystack [, bool strict]) +/* {{{ proto bool in_array(mixed needle, array haystack [, bool strict]) U Checks if the given value exists in the array */ PHP_FUNCTION(in_array) { @@ -1293,7 +1284,7 @@ } /* }}} */ -/* {{{ proto mixed array_search(mixed needle, array haystack [, bool strict]) +/* {{{ proto mixed array_search(mixed needle, array haystack [, bool strict]) U Searches the array for a given value and returns the corresponding key if successful */ PHP_FUNCTION(array_search) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php