1027c1027 < static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) --- > static void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior TSRMLS_DC) 1032a1033 > **move_pointer, /* whether to move internal pointer or not */ 1040,1042c1041,1045 < < if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 || < zend_get_parameters_ex(ZEND_NUM_ARGS(), &value, &array, &strict) == FAILURE) { --- > int iterations = 0; > int mv_pointer = 0; > > if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 4 || > zend_get_parameters_ex(ZEND_NUM_ARGS(), &value, &array, &strict, &move_pointer) == FAILURE) { 1046,1049c1049,1066 < if (Z_TYPE_PP(value) == IS_OBJECT) { < php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong datatype for first argument"); < RETURN_FALSE; < } --- > switch (ZEND_NUM_ARGS()){ > case 4: > convert_to_boolean_ex(move_pointer); > if (Z_LVAL_PP(move_pointer)){ > mv_pointer = 1; > } > /* intentional fall-through*/ > case 3: > convert_to_boolean_ex(strict); > if (Z_LVAL_PP(strict)) { > is_equal_func = is_identical_function; > } > /* intentional fall-through*/ > case 2: > if (Z_TYPE_PP(value) == IS_OBJECT) { > php_error(E_WARNING, "%s(): Wrong datatype for first argument", get_active_function_name(TSRMLS_C)); > RETURN_FALSE; > } 1051,1060c1068,1074 < if (Z_TYPE_PP(array) != IS_ARRAY) { < php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong datatype for second argument"); < RETURN_FALSE; < } < < if (ZEND_NUM_ARGS() == 3) { < convert_to_boolean_ex(strict); < if (Z_LVAL_PP(strict)) { < is_equal_func = is_identical_function; < } --- > if (Z_TYPE_PP(array) != IS_ARRAY) { > php_error(E_WARNING, "%s(): Wrong datatype for second argument", get_active_function_name(TSRMLS_C)); > RETURN_FALSE; > } > break; > default: > break; 1062c1076 < --- > 1065c1079 < while(zend_hash_get_current_data_ex(target_hash, (void **)&entry, &pos) == SUCCESS) { --- > while(zend_hash_get_current_data_ex(target_hash, (void **)&entry, &pos) == SUCCESS) { 1068a1083,1085 > if (mv_pointer){ > zend_hash_move_pointer(target_hash, iterations,0); > } 1073a1091,1093 > if (mv_pointer){ > zend_hash_move_pointer(target_hash, iterations,0); > } 1076a1097,1099 > if (mv_pointer){ > zend_hash_move_pointer(target_hash, iterations,0); > } 1081,1082c1104,1105 < } < --- > > } 1083a1107 > iterations++; 1098c1122 < /* {{{ proto mixed array_search(mixed needle, array haystack [, bool strict]) --- > /* {{{ proto mixed array_search(mixed needle, array haystack [, bool strict [, bool move_pointer]]) 3422a3447 >