diff options
Diffstat (limited to 'ext/standard')
633 files changed, 6373 insertions, 22538 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index 73b3d35a08..245eeba7d8 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -700,9 +700,8 @@ PHP_FUNCTION(krsort) cmp = php_get_key_compare_func(sort_type, 1); - if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 0) == FAILURE) { - RETURN_FALSE; - } + zend_hash_sort(Z_ARRVAL_P(array), cmp, 0); + RETURN_TRUE; } /* }}} */ @@ -723,9 +722,8 @@ PHP_FUNCTION(ksort) cmp = php_get_key_compare_func(sort_type, 0); - if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 0) == FAILURE) { - RETURN_FALSE; - } + zend_hash_sort(Z_ARRVAL_P(array), cmp, 0); + RETURN_TRUE; } /* }}} */ @@ -791,13 +789,13 @@ PHP_FUNCTION(count) /* first, we check if the handler is defined */ if (Z_OBJ_HT_P(array)->count_elements) { RETVAL_LONG(1); - if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_LVAL_P(return_value))) { + if (SUCCESS == Z_OBJ_HT(*array)->count_elements(Z_OBJ_P(array), &Z_LVAL_P(return_value))) { return; } } /* if not and the object implements Countable we call its count() method */ if (instanceof_function(Z_OBJCE_P(array), zend_ce_countable)) { - zend_call_method_with_0_params(array, NULL, NULL, "count", &retval); + zend_call_method_with_0_params(Z_OBJ_P(array), NULL, NULL, "count", &retval); if (Z_TYPE(retval) != IS_UNDEF) { RETVAL_LONG(zval_get_long(&retval)); zval_ptr_dtor(&retval); @@ -827,13 +825,9 @@ static void php_natsort(INTERNAL_FUNCTION_PARAMETERS, int fold_case) /* {{{ */ ZEND_PARSE_PARAMETERS_END(); if (fold_case) { - if (zend_hash_sort(Z_ARRVAL_P(array), php_array_natural_case_compare, 0) == FAILURE) { - return; - } + zend_hash_sort(Z_ARRVAL_P(array), php_array_natural_case_compare, 0); } else { - if (zend_hash_sort(Z_ARRVAL_P(array), php_array_natural_compare, 0) == FAILURE) { - return; - } + zend_hash_sort(Z_ARRVAL_P(array), php_array_natural_compare, 0); } RETURN_TRUE; @@ -872,9 +866,8 @@ PHP_FUNCTION(asort) cmp = php_get_data_compare_func(sort_type, 0); - if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 0) == FAILURE) { - RETURN_FALSE; - } + zend_hash_sort(Z_ARRVAL_P(array), cmp, 0); + RETURN_TRUE; } /* }}} */ @@ -895,9 +888,8 @@ PHP_FUNCTION(arsort) cmp = php_get_data_compare_func(sort_type, 1); - if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 0) == FAILURE) { - RETURN_FALSE; - } + zend_hash_sort(Z_ARRVAL_P(array), cmp, 0); + RETURN_TRUE; } /* }}} */ @@ -918,9 +910,8 @@ PHP_FUNCTION(sort) cmp = php_get_data_compare_func(sort_type, 0); - if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 1) == FAILURE) { - RETURN_FALSE; - } + zend_hash_sort(Z_ARRVAL_P(array), cmp, 1); + RETURN_TRUE; } /* }}} */ @@ -941,9 +932,8 @@ PHP_FUNCTION(rsort) cmp = php_get_data_compare_func(sort_type, 1); - if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 1) == FAILURE) { - RETURN_FALSE; - } + zend_hash_sort(Z_ARRVAL_P(array), cmp, 1); + RETURN_TRUE; } /* }}} */ @@ -1013,7 +1003,6 @@ static void php_usort(INTERNAL_FUNCTION_PARAMETERS, compare_func_t compare_func, { zval *array; zend_array *arr; - zend_bool retval; PHP_ARRAY_CMP_FUNC_VARS; PHP_ARRAY_CMP_FUNC_BACKUP(); @@ -1032,13 +1021,13 @@ static void php_usort(INTERNAL_FUNCTION_PARAMETERS, compare_func_t compare_func, /* Copy array, so the in-place modifications will not be visible to the callback function */ arr = zend_array_dup(arr); - retval = zend_hash_sort(arr, compare_func, renumber) != FAILURE; + zend_hash_sort(arr, compare_func, renumber); zval_ptr_dtor(array); ZVAL_ARR(array, arr); PHP_ARRAY_CMP_FUNC_RESTORE(); - RETURN_BOOL(retval); + RETURN_TRUE; } /* }}} */ @@ -1251,7 +1240,9 @@ PHP_FUNCTION(key) } /* }}} */ -/* {{{ proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]]) +/* {{{ + * proto mixed min(array values) + * proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]]) Return the lowest value in an array or a series of arguments */ PHP_FUNCTION(min) { @@ -1267,14 +1258,14 @@ PHP_FUNCTION(min) zval *result; if (Z_TYPE(args[0]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "When only one parameter is given, it must be an array"); - RETVAL_NULL(); + zend_type_error("When only one parameter is given, it must be an array"); + return; } else { if ((result = zend_hash_minmax(Z_ARRVAL(args[0]), php_array_data_compare, 0)) != NULL) { ZVAL_COPY_DEREF(return_value, result); } else { - php_error_docref(NULL, E_WARNING, "Array must contain at least one element"); - RETVAL_FALSE; + zend_throw_error(NULL, "Array must contain at least one element"); + return; } } } else { @@ -1296,7 +1287,9 @@ PHP_FUNCTION(min) } /* }}} */ -/* {{{ proto mixed max(mixed arg1 [, mixed arg2 [, mixed ...]]) +/* {{{ + * proto mixed max(array values) + * proto mixed max(mixed arg1 [, mixed arg2 [, mixed ...]]) Return the highest value in an array or a series of arguments */ PHP_FUNCTION(max) { @@ -1312,14 +1305,14 @@ PHP_FUNCTION(max) zval *result; if (Z_TYPE(args[0]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "When only one parameter is given, it must be an array"); - RETVAL_NULL(); + zend_type_error("When only one parameter is given, it must be an array"); + return; } else { if ((result = zend_hash_minmax(Z_ARRVAL(args[0]), php_array_data_compare, 1)) != NULL) { ZVAL_COPY_DEREF(return_value, result); } else { - php_error_docref(NULL, E_WARNING, "Array must contain at least one element"); - RETVAL_FALSE; + zend_throw_error(NULL, "Array must contain at least one element"); + return; } } } else { @@ -1406,7 +1399,7 @@ static int php_array_walk(zval *array, zval *userdata, int recursive) /* {{{ */ SEPARATE_ARRAY(zv); thash = Z_ARRVAL_P(zv); if (GC_IS_RECURSIVE(thash)) { - php_error_docref(NULL, E_WARNING, "recursion detected"); + zend_throw_error(NULL, "Recursion detected"); result = FAILURE; break; } @@ -1457,7 +1450,7 @@ static int php_array_walk(zval *array, zval *userdata, int recursive) /* {{{ */ target_hash = Z_OBJPROP_P(array); pos = zend_hash_iterator_pos(ht_iter, target_hash); } else { - php_error_docref(NULL, E_WARNING, "Iterated value is no longer an array or object"); + zend_type_error("Iterated value is no longer an array or object"); result = FAILURE; break; } @@ -1713,16 +1706,16 @@ static zend_always_inline int php_valid_var_name(const char *var_name, size_t va } /* }}} */ -PHPAPI int php_prefix_varname(zval *result, const zval *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore) /* {{{ */ +PHPAPI int php_prefix_varname(zval *result, zend_string *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore) /* {{{ */ { - ZVAL_NEW_STR(result, zend_string_alloc(Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0)); - memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix)); + ZVAL_NEW_STR(result, zend_string_alloc(ZSTR_LEN(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0)); + memcpy(Z_STRVAL_P(result), ZSTR_VAL(prefix), ZSTR_LEN(prefix)); if (add_underscore) { - Z_STRVAL_P(result)[Z_STRLEN_P(prefix)] = '_'; + Z_STRVAL_P(result)[ZSTR_LEN(prefix)] = '_'; } - memcpy(Z_STRVAL_P(result) + Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); + memcpy(Z_STRVAL_P(result) + ZSTR_LEN(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); return SUCCESS; } @@ -1901,7 +1894,7 @@ static zend_long php_extract_overwrite(zend_array *arr, zend_array *symbol_table } /* }}} */ -static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -1957,7 +1950,7 @@ static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *s } /* }}} */ -static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2008,7 +2001,7 @@ static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbo } /* }}} */ -static zend_long php_extract_ref_prefix_same(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_ref_prefix_same(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2082,7 +2075,7 @@ prefix: } /* }}} */ -static zend_long php_extract_prefix_same(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_prefix_same(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2148,7 +2141,7 @@ prefix: } /* }}} */ -static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2195,7 +2188,7 @@ static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_ } /* }}} */ -static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2242,7 +2235,7 @@ static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_tabl } /* }}} */ -static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2297,7 +2290,7 @@ static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *sym } /* }}} */ -static zend_long php_extract_prefix_invalid(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_prefix_invalid(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2438,9 +2431,10 @@ static zend_long php_extract_skip(zend_array *arr, zend_array *symbol_table) /* Imports variables into symbol table from an array */ PHP_FUNCTION(extract) { - zval *var_array_param, *prefix = NULL; + zval *var_array_param; zend_long extract_refs; zend_long extract_type = EXTR_OVERWRITE; + zend_string *prefix = NULL; zend_long count; zend_array *symbol_table; @@ -2448,7 +2442,7 @@ PHP_FUNCTION(extract) Z_PARAM_ARRAY_EX2(var_array_param, 0, 1, 0) Z_PARAM_OPTIONAL Z_PARAM_LONG(extract_type) - Z_PARAM_ZVAL(prefix) + Z_PARAM_STR(prefix) ZEND_PARSE_PARAMETERS_END(); extract_refs = (extract_type & EXTR_REFS); @@ -2458,22 +2452,18 @@ PHP_FUNCTION(extract) extract_type &= 0xff; if (extract_type < EXTR_OVERWRITE || extract_type > EXTR_IF_EXISTS) { - php_error_docref(NULL, E_WARNING, "Invalid extract type"); + zend_throw_error(NULL, "Invalid extract type"); return; } if (extract_type > EXTR_SKIP && extract_type <= EXTR_PREFIX_IF_EXISTS && ZEND_NUM_ARGS() < 3) { - php_error_docref(NULL, E_WARNING, "specified extract type requires the prefix parameter"); + zend_throw_error(NULL, "Specified extract type requires the prefix parameter"); return; } if (prefix) { - if (!try_convert_to_string(prefix)) { - return; - } - - if (Z_STRLEN_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRLEN_P(prefix))) { - php_error_docref(NULL, E_WARNING, "prefix is not a valid identifier"); + if (ZSTR_LEN(prefix) && !php_valid_var_name(ZSTR_VAL(prefix), ZSTR_LEN(prefix))) { + zend_throw_error(NULL, "Prefix is not a valid identifier"); return; } } @@ -2483,6 +2473,7 @@ PHP_FUNCTION(extract) } symbol_table = zend_rebuild_symbol_table(); + ZEND_ASSERT(symbol_table && "A symbol table should always be available here"); if (extract_refs) { switch (extract_type) { @@ -2565,7 +2556,7 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu } else if (Z_TYPE_P(entry) == IS_ARRAY) { if (Z_REFCOUNTED_P(entry)) { if (Z_IS_RECURSIVE_P(entry)) { - php_error_docref(NULL, E_WARNING, "recursion detected"); + zend_throw_error(NULL, "Recursion detected"); return; } Z_PROTECT_RECURSION_P(entry); @@ -2597,9 +2588,7 @@ PHP_FUNCTION(compact) } symbol_table = zend_rebuild_symbol_table(); - if (UNEXPECTED(symbol_table == NULL)) { - return; - } + ZEND_ASSERT(symbol_table && "A symbol table should always be available here"); /* compact() is probably most used with a single array of var_names or multiple string names, rather than a combination of both. @@ -2616,7 +2605,7 @@ PHP_FUNCTION(compact) } /* }}} */ -/* {{{ proto array array_fill(int start_key, int num, mixed val) +/* {{{ proto array|false array_fill(int start_key, int num, mixed val) Create an array containing num elements starting with index start_key each initialized to val */ PHP_FUNCTION(array_fill) { @@ -2718,8 +2707,9 @@ PHP_FUNCTION(array_fill_keys) #define RANGE_CHECK_DOUBLE_INIT_ARRAY(start, end) do { \ double __calc_size = ((start - end) / step) + 1; \ if (__calc_size >= (double)HT_MAX_SIZE) { \ - php_error_docref(NULL, E_WARNING, "The supplied range exceeds the maximum array size: start=%0.0f end=%0.0f", end, start); \ - RETURN_FALSE; \ + zend_throw_error(NULL, \ + "The supplied range exceeds the maximum array size: start=%0.0f end=%0.0f", end, start); \ + return; \ } \ size = (uint32_t)_php_math_round(__calc_size, 0, PHP_ROUND_HALF_UP); \ array_init_size(return_value, size); \ @@ -2729,8 +2719,9 @@ PHP_FUNCTION(array_fill_keys) #define RANGE_CHECK_LONG_INIT_ARRAY(start, end) do { \ zend_ulong __calc_size = ((zend_ulong) start - end) / lstep; \ if (__calc_size >= HT_MAX_SIZE - 1) { \ - php_error_docref(NULL, E_WARNING, "The supplied range exceeds the maximum array size: start=" ZEND_LONG_FMT " end=" ZEND_LONG_FMT, end, start); \ - RETURN_FALSE; \ + zend_throw_error(NULL, \ + "The supplied range exceeds the maximum array size: start=" ZEND_LONG_FMT " end=" ZEND_LONG_FMT, end, start); \ + return; \ } \ size = (uint32_t)(__calc_size + 1); \ array_init_size(return_value, size); \ @@ -2749,24 +2740,11 @@ PHP_FUNCTION(range) Z_PARAM_ZVAL(zlow) Z_PARAM_ZVAL(zhigh) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL(zstep) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + Z_PARAM_NUMBER(zstep) + ZEND_PARSE_PARAMETERS_END(); if (zstep) { - if (Z_TYPE_P(zstep) == IS_DOUBLE) { - is_step_double = 1; - } else if (Z_TYPE_P(zstep) == IS_STRING) { - int type = is_numeric_string(Z_STRVAL_P(zstep), Z_STRLEN_P(zstep), NULL, NULL, 0); - if (type == IS_DOUBLE) { - is_step_double = 1; - } - if (type == 0) { - /* bad number */ - php_error_docref(NULL, E_WARNING, "Invalid range string - must be numeric"); - RETURN_FALSE; - } - } - + is_step_double = Z_TYPE_P(zstep) == IS_DOUBLE; step = zval_get_double(zstep); /* We only want positive step values. */ @@ -2839,8 +2817,8 @@ double_str: high = zval_get_double(zhigh); if (zend_isinf(high) || zend_isinf(low)) { - php_error_docref(NULL, E_WARNING, "Invalid range supplied: start=%0.0f end=%0.0f", low, high); - RETURN_FALSE; + zend_throw_error(NULL, "Invalid range supplied: start=%0.0f end=%0.0f", low, high); + return; } if (low > high) { /* Negative steps */ @@ -2932,8 +2910,8 @@ long_str: } err: if (err) { - php_error_docref(NULL, E_WARNING, "step exceeds the specified range"); - RETURN_FALSE; + zend_throw_error(NULL, "step exceeds the specified range"); + return; } } /* }}} */ @@ -3173,7 +3151,7 @@ static void php_splice(HashTable *in_hash, zend_long offset, zend_long length, H } /* }}} */ -/* {{{ proto int array_push(array stack, mixed var [, mixed ...]) +/* {{{ proto int|false array_push(array stack, mixed var [, mixed ...]) Pushes elements onto the end of the array */ PHP_FUNCTION(array_push) { @@ -3240,7 +3218,7 @@ PHP_FUNCTION(array_pop) } ZVAL_COPY_DEREF(return_value, val); - if (!p->key && Z_ARRVAL_P(stack)->nNextFreeElement > 0 && p->h >= (zend_ulong)(Z_ARRVAL_P(stack)->nNextFreeElement - 1)) { + if (!p->key && (zend_long)p->h == (Z_ARRVAL_P(stack)->nNextFreeElement - 1)) { Z_ARRVAL_P(stack)->nNextFreeElement = Z_ARRVAL_P(stack)->nNextFreeElement - 1; } @@ -3471,6 +3449,9 @@ PHP_FUNCTION(array_splice) /* Initialize return value */ array_init_size(return_value, size > 0 ? (uint32_t)size : 0); rem_hash = Z_ARRVAL_P(return_value); + } else { + /* The return value will not be used, but make sure it still has the correct type. */ + RETVAL_EMPTY_ARRAY(); } /* Perform splice */ @@ -3482,14 +3463,14 @@ PHP_FUNCTION(array_splice) Returns elements specified by offset and length */ PHP_FUNCTION(array_slice) { - zval *input, /* Input array */ - *z_length = NULL, /* How many elements to get */ - *entry; /* An array entry */ - zend_long offset, /* Offset to get elements from */ - length = 0; - zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array or not */ - int num_in, /* Number of elements in the input array */ - pos; /* Current position in the array */ + zval *input; /* Input array */ + zval *entry; /* An array entry */ + zend_long offset; /* Offset to get elements from */ + zend_long length = 0; /* How many elements to get */ + zend_bool length_is_null = 1; /* Whether an explicit length has been omitted */ + zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array */ + uint32_t num_in; /* Number of elements in the input array */ + uint32_t pos; /* Current position in the array */ zend_string *string_key; zend_ulong num_key; @@ -3497,7 +3478,7 @@ PHP_FUNCTION(array_slice) Z_PARAM_ARRAY(input) Z_PARAM_LONG(offset) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL(z_length) + Z_PARAM_LONG_EX(length, length_is_null, 1, 0) Z_PARAM_BOOL(preserve_keys) ZEND_PARSE_PARAMETERS_END(); @@ -3505,14 +3486,12 @@ PHP_FUNCTION(array_slice) num_in = zend_hash_num_elements(Z_ARRVAL_P(input)); /* We want all entries from offset to the end if length is not passed or is null */ - if (ZEND_NUM_ARGS() < 3 || Z_TYPE_P(z_length) == IS_NULL) { + if (length_is_null) { length = num_in; - } else { - length = zval_get_long(z_length); } /* Clamp the offset.. */ - if (offset > num_in) { + if (offset > (zend_long) num_in) { RETURN_EMPTY_ARRAY(); } else if (offset < 0 && (offset = (num_in + offset)) < 0) { offset = 0; @@ -3598,7 +3577,7 @@ PHPAPI int php_array_merge_recursive(HashTable *dest, HashTable *src) /* {{{ */ ZVAL_DEREF(dest_zval); thash = Z_TYPE_P(dest_zval) == IS_ARRAY ? Z_ARRVAL_P(dest_zval) : NULL; if ((thash && GC_IS_RECURSIVE(thash)) || (src_entry == dest_entry && Z_ISREF_P(dest_entry) && (Z_REFCOUNT_P(dest_entry) % 2))) { - php_error_docref(NULL, E_WARNING, "recursion detected"); + zend_throw_error(NULL, "Recursion detected"); return 0; } @@ -3719,7 +3698,7 @@ PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src) /* {{{ * if (Z_IS_RECURSIVE_P(dest_zval) || Z_IS_RECURSIVE_P(src_zval) || (Z_ISREF_P(src_entry) && Z_ISREF_P(dest_entry) && Z_REF_P(src_entry) == Z_REF_P(dest_entry) && (Z_REFCOUNT_P(dest_entry) % 2))) { - php_error_docref(NULL, E_WARNING, "recursion detected"); + zend_throw_error(NULL, "Recursion detected"); return 0; } @@ -3768,8 +3747,8 @@ static zend_always_inline void php_array_replace_wrapper(INTERNAL_FUNCTION_PARAM zval *arg = args + i; if (Z_TYPE_P(arg) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(arg)); - RETURN_NULL(); + zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(arg)); + return; } } @@ -3812,8 +3791,8 @@ static zend_always_inline void php_array_merge_wrapper(INTERNAL_FUNCTION_PARAMET zval *arg = args + i; if (Z_TYPE_P(arg) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(arg)); - RETURN_NULL(); + zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(arg)); + return; } count += zend_hash_num_elements(Z_ARRVAL_P(arg)); } @@ -3954,7 +3933,7 @@ PHP_FUNCTION(array_keys) /* Base case: empty input */ if (!elem_count) { - RETURN_ZVAL(input, 1, 0) + RETURN_ZVAL(input, 1, 0); } /* Initialize return array */ @@ -4013,7 +3992,7 @@ PHP_FUNCTION(array_keys) } /* }}} */ -/* {{{ proto mixed array_key_first(array stack) +/* {{{ proto int|string|false array_key_first(array stack) Get the key of the first element of the array */ PHP_FUNCTION(array_key_first) { @@ -4029,7 +4008,7 @@ PHP_FUNCTION(array_key_first) } /* }}} */ -/* {{{ proto mixed array_key_last(array stack) +/* {{{ proto int|string|false array_key_last(array stack) Get the key of the last element of the array */ PHP_FUNCTION(array_key_last) { @@ -4155,7 +4134,7 @@ zend_bool array_column_param_helper(zval *param, return 1; default: - php_error_docref(NULL, E_WARNING, "The %s key should be either a string or an integer", name); + zend_type_error("The %s key should be either a string or an integer", name); return 0; } } @@ -4169,9 +4148,12 @@ static inline zval *array_column_fetch_prop(zval *data, zval *name, zval *rv) /* /* The has_property check is first performed in "exists" mode (which returns true for * properties that are null but exist) and then in "has" mode to handle objects that * implement __isset (which is not called in "exists" mode). */ - if (Z_OBJ_HANDLER_P(data, has_property)(data, name, ZEND_PROPERTY_EXISTS, NULL) - || Z_OBJ_HANDLER_P(data, has_property)(data, name, ZEND_PROPERTY_ISSET, NULL)) { - prop = Z_OBJ_HANDLER_P(data, read_property)(data, name, BP_VAR_R, NULL, rv); + zend_string *str, *tmp_str; + + str = zval_get_tmp_string(name, &tmp_str); + if (Z_OBJ_HANDLER_P(data, has_property)(Z_OBJ_P(data), str, ZEND_PROPERTY_EXISTS, NULL) + || Z_OBJ_HANDLER_P(data, has_property)(Z_OBJ_P(data), str, ZEND_PROPERTY_ISSET, NULL)) { + prop = Z_OBJ_HANDLER_P(data, read_property)(Z_OBJ_P(data), str, BP_VAR_R, NULL, rv); if (prop) { ZVAL_DEREF(prop); if (prop != rv) { @@ -4179,6 +4161,7 @@ static inline zval *array_column_fetch_prop(zval *data, zval *name, zval *rv) /* } } } + zend_tmp_string_release(tmp_str); } else if (Z_TYPE_P(data) == IS_ARRAY) { if (Z_TYPE_P(name) == IS_STRING) { prop = zend_symtable_find(Z_ARRVAL_P(data), Z_STR_P(name)); @@ -4214,7 +4197,7 @@ PHP_FUNCTION(array_column) if ((column && !array_column_param_helper(column, "column")) || (index && !array_column_param_helper(index, "index"))) { - RETURN_FALSE; + return; } array_init_size(return_value, zend_hash_num_elements(input)); @@ -4369,8 +4352,8 @@ PHP_FUNCTION(array_pad) input_size = zend_hash_num_elements(Z_ARRVAL_P(input)); pad_size_abs = ZEND_ABS(pad_size); if (pad_size_abs < 0 || pad_size_abs - input_size > Z_L(1048576)) { - php_error_docref(NULL, E_WARNING, "You may only pad up to 1048576 elements at a time"); - RETURN_FALSE; + zend_throw_error(NULL, "You may only pad up to 1048576 elements at a time"); + return; } if (input_size >= pad_size_abs) { @@ -4690,7 +4673,7 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa } if (argc < req_args) { - php_error_docref(NULL, E_WARNING, "at least %d parameters are required, %d given", req_args, argc); + zend_argument_count_error("At least %d parameters are required, %d given", req_args, argc); return; } @@ -4700,8 +4683,8 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa for (i = 0; i < argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); - RETURN_NULL(); + zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); + return; } } @@ -4785,12 +4768,12 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int param_spec = "+f"; intersect_data_compare_func = php_array_user_compare; } else { - php_error_docref(NULL, E_WARNING, "data_compare_type is %d. This should never happen. Please report as a bug", data_compare_type); + ZEND_ASSERT(0 && "Invalid data_compare_type"); return; } if (ZEND_NUM_ARGS() < req_args) { - php_error_docref(NULL, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); + zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); return; } @@ -4837,12 +4820,12 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int fci_key = &fci2; fci_key_cache = &fci2_cache; } else { - php_error_docref(NULL, E_WARNING, "data_compare_type is %d. key_compare_type is %d. This should never happen. Please report as a bug", data_compare_type, key_compare_type); + ZEND_ASSERT(0 && "Invalid data_compare_type / key_compare_type"); return; } if (ZEND_NUM_ARGS() < req_args) { - php_error_docref(NULL, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); + zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); return; } @@ -4851,7 +4834,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int } } else { - php_error_docref(NULL, E_WARNING, "behavior is %d. This should never happen. Please report as a bug", behavior); + ZEND_ASSERT(0 && "Invalid behavior"); return; } @@ -4871,7 +4854,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int for (i = 0; i < arr_argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); + zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); arr_argc = i; /* only free up to i - 1 */ goto out; } @@ -5089,7 +5072,7 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty argc = ZEND_NUM_ARGS(); if (data_compare_type == DIFF_COMP_DATA_USER) { if (argc < 3) { - php_error_docref(NULL, E_WARNING, "at least 3 parameters are required, %d given", ZEND_NUM_ARGS()); + zend_argument_count_error("At least 3 parameters are required, %d given", ZEND_NUM_ARGS()); return; } if (zend_parse_parameters(ZEND_NUM_ARGS(), "+f", &args, &argc, &BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE) { @@ -5098,7 +5081,7 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty diff_data_compare_func = zval_user_compare; } else { if (argc < 2) { - php_error_docref(NULL, E_WARNING, "at least 2 parameters are required, %d given", ZEND_NUM_ARGS()); + zend_argument_count_error("At least 2 parameters are required, %d given", ZEND_NUM_ARGS()); return; } if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argc) == FAILURE) { @@ -5111,8 +5094,8 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty for (i = 0; i < argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); - RETURN_NULL(); + zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); + return; } } @@ -5201,7 +5184,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_ } if (ZEND_NUM_ARGS() < req_args) { - php_error_docref(NULL, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); + zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); return; } @@ -5248,12 +5231,12 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_ fci_key = &fci2; fci_key_cache = &fci2_cache; } else { - php_error_docref(NULL, E_WARNING, "data_compare_type is %d. key_compare_type is %d. This should never happen. Please report as a bug", data_compare_type, key_compare_type); + ZEND_ASSERT(0 && "Invalid data_compare_type / key_compare_type"); return; } if (ZEND_NUM_ARGS() < req_args) { - php_error_docref(NULL, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); + zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS()); return; } @@ -5262,7 +5245,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_ } } else { - php_error_docref(NULL, E_WARNING, "behavior is %d. This should never happen. Please report as a bug", behavior); + ZEND_ASSERT(0 && "Invalid behavior"); return; } @@ -5282,7 +5265,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_ for (i = 0; i < arr_argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); + zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); arr_argc = i; /* only free up to i - 1 */ goto out; } @@ -5450,7 +5433,7 @@ PHP_FUNCTION(array_diff) zval dummy; if (ZEND_NUM_ARGS() < 2) { - php_error_docref(NULL, E_WARNING, "at least 2 parameters are required, %d given", ZEND_NUM_ARGS()); + zend_argument_count_error("At least 2 parameters are required, %d given", ZEND_NUM_ARGS()); return; } @@ -5459,16 +5442,16 @@ PHP_FUNCTION(array_diff) ZEND_PARSE_PARAMETERS_END(); if (Z_TYPE(args[0]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Expected parameter 1 to be an array, %s given", zend_zval_type_name(&args[0])); - RETURN_NULL(); + zend_type_error("Expected parameter 1 to be an array, %s given", zend_zval_type_name(&args[0])); + return; } num = zend_hash_num_elements(Z_ARRVAL(args[0])); if (num == 0) { for (i = 1; i < argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); - RETURN_NULL(); + zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); + return; } } RETURN_EMPTY_ARRAY(); @@ -5484,8 +5467,8 @@ PHP_FUNCTION(array_diff) if (!value) { for (i = 1; i < argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); - RETURN_NULL(); + zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); + return; } } RETURN_EMPTY_ARRAY(); @@ -5495,8 +5478,8 @@ PHP_FUNCTION(array_diff) for (i = 1; i < argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); - RETURN_NULL(); + zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); + return; } if (!found) { ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL(args[i]), value) { @@ -5525,8 +5508,8 @@ PHP_FUNCTION(array_diff) num = 0; for (i = 1; i < argc; i++) { if (Z_TYPE(args[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); - RETURN_NULL(); + zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i])); + return; } num += zend_hash_num_elements(Z_ARRVAL(args[i])); } @@ -5633,7 +5616,7 @@ PHPAPI int php_multisort_compare(const void *a, const void *b) /* {{{ */ #define MULTISORT_ABORT \ efree(func); \ efree(arrays); \ - RETURN_FALSE; + return; static void array_bucket_p_sawp(void *p, void *q) /* {{{ */ { Bucket *t; @@ -5710,7 +5693,7 @@ PHP_FUNCTION(array_multisort) sort_order = Z_LVAL_P(arg) == PHP_SORT_DESC ? PHP_SORT_DESC : PHP_SORT_ASC; parse_state[MULTISORT_ORDER] = 0; } else { - php_error_docref(NULL, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1); + zend_type_error("Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1); MULTISORT_ABORT; } break; @@ -5726,19 +5709,19 @@ PHP_FUNCTION(array_multisort) sort_type = (int)Z_LVAL_P(arg); parse_state[MULTISORT_TYPE] = 0; } else { - php_error_docref(NULL, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1); + zend_type_error("Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1); MULTISORT_ABORT; } break; default: - php_error_docref(NULL, E_WARNING, "Argument #%d is an unknown sort flag", i + 1); + zend_type_error("Argument #%d is an unknown sort flag", i + 1); MULTISORT_ABORT; break; } } else { - php_error_docref(NULL, E_WARNING, "Argument #%d is expected to be an array or a sort flag", i + 1); + zend_type_error("Argument #%d is expected to be an array or a sort flag", i + 1); MULTISORT_ABORT; } } @@ -5749,7 +5732,7 @@ PHP_FUNCTION(array_multisort) array_size = zend_hash_num_elements(Z_ARRVAL_P(arrays[0])); for (i = 0; i < num_arrays; i++) { if (zend_hash_num_elements(Z_ARRVAL_P(arrays[i])) != (uint32_t)array_size) { - php_error_docref(NULL, E_WARNING, "Array sizes are inconsistent"); + zend_throw_error(NULL, "Array sizes are inconsistent"); MULTISORT_ABORT; } } @@ -5821,7 +5804,7 @@ PHP_FUNCTION(array_multisort) } /* }}} */ -/* {{{ proto mixed array_rand(array input [, int num_req]) +/* {{{ proto int|string|array array_rand(array input [, int num_req]) Return key/keys for random entry/entries in the array */ PHP_FUNCTION(array_rand) { @@ -5845,7 +5828,7 @@ PHP_FUNCTION(array_rand) num_avail = zend_hash_num_elements(Z_ARRVAL_P(input)); if (num_avail == 0) { - php_error_docref(NULL, E_WARNING, "Array is empty"); + zend_throw_error(NULL, "Array is empty"); return; } @@ -5886,7 +5869,7 @@ PHP_FUNCTION(array_rand) } if (num_req <= 0 || num_req > num_avail) { - php_error_docref(NULL, E_WARNING, "Second argument has to be between 1 and the number of elements in the array"); + zend_throw_error(NULL, "Second argument has to be between 1 and the number of elements in the array"); return; } @@ -5932,7 +5915,7 @@ PHP_FUNCTION(array_rand) } /* }}} */ -/* {{{ proto mixed array_sum(array input) +/* {{{ proto int|float array_sum(array input) Returns the sum of the array entries */ PHP_FUNCTION(array_sum) { @@ -5957,7 +5940,7 @@ PHP_FUNCTION(array_sum) } /* }}} */ -/* {{{ proto mixed array_product(array input) +/* {{{ proto int|float array_product(array input) Returns the product of the array entries */ PHP_FUNCTION(array_product) { @@ -6169,8 +6152,6 @@ PHP_FUNCTION(array_map) Z_PARAM_VARIADIC('+', arrays, n_arrays) ZEND_PARSE_PARAMETERS_END(); - RETVAL_NULL(); - if (n_arrays == 1) { zend_ulong num_key; zend_string *str_key; @@ -6178,7 +6159,7 @@ PHP_FUNCTION(array_map) int ret; if (Z_TYPE(arrays[0]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Expected parameter 2 to be an array, %s given", zend_zval_type_name(&arrays[0])); + zend_type_error("Expected parameter 2 to be an array, %s given", zend_zval_type_name(&arrays[0])); return; } maxlen = zend_hash_num_elements(Z_ARRVAL(arrays[0])); @@ -6219,7 +6200,7 @@ PHP_FUNCTION(array_map) for (i = 0; i < n_arrays; i++) { if (Z_TYPE(arrays[i]) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 2, zend_zval_type_name(&arrays[i])); + zend_type_error("Expected parameter %d to be an array, %s given", i + 2, zend_zval_type_name(&arrays[i])); efree(array_pos); return; } @@ -6378,7 +6359,7 @@ PHP_FUNCTION(array_chunk) /* Do bounds checking for size parameter. */ if (size < 1) { - php_error_docref(NULL, E_WARNING, "Size parameter expected to be greater than 0"); + zend_throw_error(NULL, "Size parameter expected to be greater than 0"); return; } @@ -6443,8 +6424,8 @@ PHP_FUNCTION(array_combine) num_values = zend_hash_num_elements(values); if (num_keys != num_values) { - php_error_docref(NULL, E_WARNING, "Both parameters should have an equal number of elements"); - RETURN_FALSE; + zend_throw_error(NULL, "Both parameters should have an equal number of elements"); + return; } if (!num_keys) { diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 9f315d0581..b5b8e910be 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -29,7 +29,6 @@ ZEND_BEGIN_MODULE_GLOBALS(assert) zend_bool active; zend_bool bail; zend_bool warning; - zend_bool quiet_eval; zend_bool exception; ZEND_END_MODULE_GLOBALS(assert) @@ -46,7 +45,6 @@ enum { ASSERT_CALLBACK, ASSERT_BAIL, ASSERT_WARNING, - ASSERT_QUIET_EVAL, ASSERT_EXCEPTION }; @@ -81,7 +79,6 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("assert.bail", "0", PHP_INI_ALL, OnUpdateBool, bail, zend_assert_globals, assert_globals) STD_PHP_INI_ENTRY("assert.warning", "1", PHP_INI_ALL, OnUpdateBool, warning, zend_assert_globals, assert_globals) PHP_INI_ENTRY("assert.callback", NULL, PHP_INI_ALL, OnChangeCallback) - STD_PHP_INI_ENTRY("assert.quiet_eval", "0", PHP_INI_ALL, OnUpdateBool, quiet_eval, zend_assert_globals, assert_globals) STD_PHP_INI_ENTRY("assert.exception", "0", PHP_INI_ALL, OnUpdateBool, exception, zend_assert_globals, assert_globals) PHP_INI_END() @@ -104,7 +101,6 @@ PHP_MINIT_FUNCTION(assert) /* {{{ */ REGISTER_LONG_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ASSERT_EXCEPTION", ASSERT_EXCEPTION, CONST_CS|CONST_PERSISTENT); INIT_CLASS_ENTRY(ce, "AssertionError", NULL); @@ -147,9 +143,6 @@ PHP_FUNCTION(assert) { zval *assertion; zval *description = NULL; - int val; - char *myeval = NULL; - char *compiled_string_description; if (! ASSERTG(active)) { RETURN_TRUE; @@ -161,51 +154,7 @@ PHP_FUNCTION(assert) Z_PARAM_ZVAL(description) ZEND_PARSE_PARAMETERS_END(); - if (Z_TYPE_P(assertion) == IS_STRING) { - zval retval; - int old_error_reporting = 0; /* shut up gcc! */ - - if (zend_forbid_dynamic_call("assert() with string argument") == FAILURE) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, "Calling assert() with a string argument is deprecated"); - - myeval = Z_STRVAL_P(assertion); - - if (ASSERTG(quiet_eval)) { - old_error_reporting = EG(error_reporting); - EG(error_reporting) = 0; - } - - compiled_string_description = zend_make_compiled_string_description("assert code"); - if (zend_eval_stringl(myeval, Z_STRLEN_P(assertion), &retval, compiled_string_description) == FAILURE) { - efree(compiled_string_description); - if (!description) { - zend_throw_error(NULL, "Failure evaluating code: %s%s", PHP_EOL, myeval); - } else { - zend_string *str = zval_get_string(description); - zend_throw_error(NULL, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, ZSTR_VAL(str), myeval); - zend_string_release_ex(str, 0); - } - if (ASSERTG(bail)) { - zend_bailout(); - } - RETURN_FALSE; - } - efree(compiled_string_description); - - if (ASSERTG(quiet_eval)) { - EG(error_reporting) = old_error_reporting; - } - - convert_to_boolean(&retval); - val = Z_TYPE(retval) == IS_TRUE; - } else { - val = zend_is_true(assertion); - } - - if (val) { + if (zend_is_true(assertion)) { RETURN_TRUE; } @@ -220,8 +169,8 @@ PHP_FUNCTION(assert) const char *filename = zend_get_executed_filename(); ZVAL_STRING(&args[0], SAFE_STRING(filename)); - ZVAL_LONG (&args[1], lineno); - ZVAL_STRING(&args[2], SAFE_STRING(myeval)); + ZVAL_LONG(&args[1], lineno); + ZVAL_NULL(&args[2]); ZVAL_FALSE(&retval); @@ -255,18 +204,10 @@ PHP_FUNCTION(assert) } } else if (ASSERTG(warning)) { if (!description) { - if (myeval) { - php_error_docref(NULL, E_WARNING, "Assertion \"%s\" failed", myeval); - } else { - php_error_docref(NULL, E_WARNING, "Assertion failed"); - } + php_error_docref(NULL, E_WARNING, "Assertion failed"); } else { zend_string *str = zval_get_string(description); - if (myeval) { - php_error_docref(NULL, E_WARNING, "%s: \"%s\" failed", ZSTR_VAL(str), myeval); - } else { - php_error_docref(NULL, E_WARNING, "%s failed", ZSTR_VAL(str)); - } + php_error_docref(NULL, E_WARNING, "%s failed", ZSTR_VAL(str)); zend_string_release_ex(str, 0); } } @@ -328,22 +269,6 @@ PHP_FUNCTION(assert_options) RETURN_LONG(oldint); break; - case ASSERT_QUIET_EVAL: - oldint = ASSERTG(quiet_eval); - if (ac == 2) { - zend_string *value_str = zval_try_get_string(value); - if (UNEXPECTED(!value_str)) { - return; - } - - key = zend_string_init("assert.quiet_eval", sizeof("assert.quiet_eval")-1, 0); - zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0); - zend_string_release_ex(key, 0); - zend_string_release_ex(value_str, 0); - } - RETURN_LONG(oldint); - break; - case ASSERT_WARNING: oldint = ASSERTG(warning); if (ac == 2) { @@ -391,10 +316,10 @@ PHP_FUNCTION(assert_options) break; default: - php_error_docref(NULL, E_WARNING, "Unknown value " ZEND_LONG_FMT, what); + zend_throw_error(NULL, "Unknown value " ZEND_LONG_FMT, what); break; } - RETURN_FALSE; + return; } /* }}} */ diff --git a/ext/standard/base64.c b/ext/standard/base64.c index 0dd4045887..744b4f173c 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -941,7 +941,7 @@ PHP_FUNCTION(base64_encode) } /* }}} */ -/* {{{ proto string base64_decode(string str[, bool strict]) +/* {{{ proto string|false base64_decode(string str[, bool strict]) Decodes string using MIME base64 algorithm */ PHP_FUNCTION(base64_decode) { diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 9b937319c2..83b3189f00 100644..100755 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -121,481 +121,7 @@ static void user_shutdown_function_dtor(zval *zv); static void user_tick_function_dtor(user_tick_function_entry *tick_function_entry); /* {{{ arginfo */ -/* {{{ main/main.c */ -ZEND_BEGIN_ARG_INFO(arginfo_set_time_limit, 0) - ZEND_ARG_INFO(0, seconds) -ZEND_END_ARG_INFO() -/* }}} */ - -/* {{{ main/sapi.c */ -ZEND_BEGIN_ARG_INFO(arginfo_header_register_callback, 0) - ZEND_ARG_INFO(0, callback) -ZEND_END_ARG_INFO() -/* }}} */ - -/* {{{ main/output.c */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_start, 0, 0, 0) - ZEND_ARG_INFO(0, user_function) - ZEND_ARG_INFO(0, chunk_size) - ZEND_ARG_INFO(0, flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_ob_flush, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_ob_clean, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_ob_end_flush, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_ob_end_clean, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_ob_get_flush, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_ob_get_clean, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_ob_get_contents, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_ob_get_level, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_ob_get_length, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_ob_list_handlers, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_get_status, 0, 0, 0) - ZEND_ARG_INFO(0, full_status) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_implicit_flush, 0, 0, 0) - ZEND_ARG_INFO(0, flag) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_output_reset_rewrite_vars, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_output_add_rewrite_var, 0) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() -/* }}} */ -/* {{{ main/streams/userspace.c */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_wrapper_register, 0, 0, 2) - ZEND_ARG_INFO(0, protocol) - ZEND_ARG_INFO(0, classname) - ZEND_ARG_INFO(0, flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_stream_wrapper_unregister, 0) - ZEND_ARG_INFO(0, protocol) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_stream_wrapper_restore, 0) - ZEND_ARG_INFO(0, protocol) -ZEND_END_ARG_INFO() -/* }}} */ -/* {{{ array.c */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_krsort, 0, 0, 1) - ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ - ZEND_ARG_INFO(0, sort_flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ksort, 0, 0, 1) - ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ - ZEND_ARG_INFO(0, sort_flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_count, 0, 0, 1) - ZEND_ARG_INFO(0, var) - ZEND_ARG_INFO(0, mode) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_natsort, 0) - ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_natcasesort, 0) - ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_asort, 0, 0, 1) - ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ - ZEND_ARG_INFO(0, sort_flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_arsort, 0, 0, 1) - ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ - ZEND_ARG_INFO(0, sort_flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_sort, 0, 0, 1) - ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ - ZEND_ARG_INFO(0, sort_flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_rsort, 0, 0, 1) - ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ - ZEND_ARG_INFO(0, sort_flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_usort, 0) - ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ - ZEND_ARG_INFO(0, cmp_function) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_uasort, 0) - ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ - ZEND_ARG_INFO(0, cmp_function) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_uksort, 0) - ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ - ZEND_ARG_INFO(0, cmp_function) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_end, 0) - ZEND_ARG_INFO(1, arg) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_prev, 0) - ZEND_ARG_INFO(1, arg) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_next, 0) - ZEND_ARG_INFO(1, arg) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_reset, 0) - ZEND_ARG_INFO(1, arg) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_current, 0) - ZEND_ARG_INFO(0, arg) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_key, 0) - ZEND_ARG_INFO(0, arg) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_min, 0, 0, 1) - ZEND_ARG_VARIADIC_INFO(0, args) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_max, 0, 0, 1) - ZEND_ARG_VARIADIC_INFO(0, args) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_walk, 0, 0, 2) - ZEND_ARG_INFO(1, input) /* ARRAY_INFO(1, arg, 0) */ - ZEND_ARG_INFO(0, funcname) - ZEND_ARG_INFO(0, userdata) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_walk_recursive, 0, 0, 2) - ZEND_ARG_INFO(1, input) /* ARRAY_INFO(1, arg, 0) */ - ZEND_ARG_INFO(0, funcname) - ZEND_ARG_INFO(0, userdata) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_in_array, 0, 0, 2) - ZEND_ARG_INFO(0, needle) - ZEND_ARG_INFO(0, haystack) /* ARRAY_INFO(0, haystack, 0) */ - ZEND_ARG_INFO(0, strict) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_search, 0, 0, 2) - ZEND_ARG_INFO(0, needle) - ZEND_ARG_INFO(0, haystack) /* ARRAY_INFO(0, haystack, 0) */ - ZEND_ARG_INFO(0, strict) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_extract, 0, 0, 1) - ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arg) /* ARRAY_INFO(0, arg, 0) */ - ZEND_ARG_INFO(0, extract_type) - ZEND_ARG_INFO(0, prefix) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_compact, 0, 0, 1) - ZEND_ARG_VARIADIC_INFO(0, var_names) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_fill, 0) - ZEND_ARG_INFO(0, start_key) - ZEND_ARG_INFO(0, num) - ZEND_ARG_INFO(0, val) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_fill_keys, 0) - ZEND_ARG_INFO(0, keys) /* ARRAY_INFO(0, keys, 0) */ - ZEND_ARG_INFO(0, val) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_range, 0, 0, 2) - ZEND_ARG_INFO(0, low) - ZEND_ARG_INFO(0, high) - ZEND_ARG_INFO(0, step) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_shuffle, 0) - ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_push, 0, 0, 1) - ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */ - ZEND_ARG_VARIADIC_INFO(0, vars) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_pop, 0) - ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */ -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_shift, 0) - ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */ -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_unshift, 0, 0, 1) - ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */ - ZEND_ARG_VARIADIC_INFO(0, vars) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_splice, 0, 0, 2) - ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */ - ZEND_ARG_INFO(0, offset) - ZEND_ARG_INFO(0, length) - ZEND_ARG_INFO(0, replacement) /* ARRAY_INFO(0, arg, 1) */ -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_slice, 0, 0, 2) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(1, arg, 0) */ - ZEND_ARG_INFO(0, offset) - ZEND_ARG_INFO(0, length) - ZEND_ARG_INFO(0, preserve_keys) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_merge, 0, 0, 0) - ZEND_ARG_VARIADIC_INFO(0, arrays) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_merge_recursive, 0, 0, 0) - ZEND_ARG_VARIADIC_INFO(0, arrays) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_replace, 0, 0, 1) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */ - ZEND_ARG_VARIADIC_INFO(0, arrays) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_replace_recursive, 0, 0, 1) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */ - ZEND_ARG_VARIADIC_INFO(0, arrays) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_keys, 0, 0, 1) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ - ZEND_ARG_INFO(0, search_value) - ZEND_ARG_INFO(0, strict) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_key_first, 0) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_key_last, 0) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ -ZEND_END_ARG_INFO() - - -ZEND_BEGIN_ARG_INFO(arginfo_array_values, 0) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_count_values, 0) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_column, 0, 0, 2) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ - ZEND_ARG_INFO(0, column_key) - ZEND_ARG_INFO(0, index_key) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_reverse, 0, 0, 1) - ZEND_ARG_INFO(0, input) /* ARRAY_INFO(0, arg, 0) */ - ZEND_ARG_INFO(0, preserve_keys) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_pad, 0) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ - ZEND_ARG_INFO(0, pad_size) - ZEND_ARG_INFO(0, pad_value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_flip, 0) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_change_key_case, 0, 0, 1) - ZEND_ARG_INFO(0, input) /* ARRAY_INFO(0, arg, 0) */ - ZEND_ARG_INFO(0, case) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_unique, 0, 0, 1) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ - ZEND_ARG_INFO(0, flags) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_intersect_key, 0, 0, 2) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_VARIADIC_INFO(0, arrays) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_intersect_ukey, 0) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ - ZEND_ARG_INFO(0, callback_key_compare_func) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_intersect, 0, 0, 2) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_VARIADIC_INFO(0, arrays) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_uintersect, 0) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ - ZEND_ARG_INFO(0, callback_data_compare_func) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_intersect_assoc, 0, 0, 2) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_VARIADIC_INFO(0, arrays) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_uintersect_assoc, 0) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ - ZEND_ARG_INFO(0, callback_data_compare_func) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_intersect_uassoc, 0) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ - ZEND_ARG_INFO(0, callback_key_compare_func) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_uintersect_uassoc, 0) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ - ZEND_ARG_INFO(0, callback_data_compare_func) - ZEND_ARG_INFO(0, callback_key_compare_func) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_diff_key, 0, 0, 2) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_VARIADIC_INFO(0, arrays) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_diff_ukey, 0) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ - ZEND_ARG_INFO(0, callback_key_comp_func) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_diff, 0, 0, 2) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_VARIADIC_INFO(0, arrays) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_udiff, 0) - ZEND_ARG_INFO(0, arr1) - ZEND_ARG_INFO(0, arr2) - ZEND_ARG_INFO(0, callback_data_comp_func) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_diff_assoc, 0, 0, 2) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_VARIADIC_INFO(0, arrays) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_diff_uassoc, 0) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ - ZEND_ARG_INFO(0, callback_data_comp_func) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_udiff_assoc, 0) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ - ZEND_ARG_INFO(0, callback_key_comp_func) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_udiff_uassoc, 0) - ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */ - ZEND_ARG_INFO(0, callback_data_comp_func) - ZEND_ARG_INFO(0, callback_key_comp_func) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_multisort, 0, 0, 1) - ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_order) - ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_flags) - ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, arr2) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_rand, 0, 0, 1) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ - ZEND_ARG_INFO(0, num_req) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_sum, 0) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_product, 0) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_reduce, 0, 0, 2) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(0, initial) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_filter, 0, 0, 1) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ - ZEND_ARG_INFO(0, callback) - ZEND_ARG_INFO(0, use_keys) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_map, 0, 0, 2) - ZEND_ARG_INFO(0, callback) - ZEND_ARG_VARIADIC_INFO(0, arrays) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_key_exists, 0) - ZEND_ARG_INFO(0, key) - ZEND_ARG_INFO(0, search) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_chunk, 0, 0, 2) - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */ - ZEND_ARG_INFO(0, size) - ZEND_ARG_INFO(0, preserve_keys) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_array_combine, 0) - ZEND_ARG_INFO(0, keys) /* ARRAY_INFO(0, keys, 0) */ - ZEND_ARG_INFO(0, values) /* ARRAY_INFO(0, values, 0) */ -ZEND_END_ARG_INFO() -/* }}} */ /* {{{ basic_functions.c */ ZEND_BEGIN_ARG_INFO(arginfo_get_magic_quotes_gpc, 0) ZEND_END_ARG_INFO() @@ -607,18 +133,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_constant, 0) ZEND_ARG_INFO(0, const_name) ZEND_END_ARG_INFO() -#ifdef HAVE_INET_NTOP -ZEND_BEGIN_ARG_INFO(arginfo_inet_ntop, 0) - ZEND_ARG_INFO(0, in_addr) -ZEND_END_ARG_INFO() -#endif - -#ifdef HAVE_INET_PTON -ZEND_BEGIN_ARG_INFO(arginfo_inet_pton, 0) - ZEND_ARG_INFO(0, ip_address) -ZEND_END_ARG_INFO() -#endif - ZEND_BEGIN_ARG_INFO(arginfo_ip2long, 0) ZEND_ARG_INFO(0, ip_address) ZEND_END_ARG_INFO() @@ -803,7 +317,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_unregister_tick_function, 0) ZEND_ARG_INFO(0, function_name) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_uploaded_file, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_uploaded_file, _IS_BOOL, 0) ZEND_ARG_INFO(0, path) ZEND_END_ARG_INFO() @@ -834,46 +348,12 @@ ZEND_BEGIN_ARG_INFO(arginfo_sys_getloadavg, 0) ZEND_END_ARG_INFO() #endif /* }}} */ -/* {{{ assert.c */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_assert, 0, 0, 1) - ZEND_ARG_INFO(0, assertion) - ZEND_ARG_INFO(0, description) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_assert_options, 0, 0, 1) - ZEND_ARG_INFO(0, what) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() -/* }}} */ -/* {{{ base64.c */ -ZEND_BEGIN_ARG_INFO(arginfo_base64_encode, 0) - ZEND_ARG_INFO(0, str) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_base64_decode, 0, 0, 1) - ZEND_ARG_INFO(0, str) - ZEND_ARG_INFO(0, strict) -ZEND_END_ARG_INFO() - -/* }}} */ /* {{{ browscap.c */ ZEND_BEGIN_ARG_INFO_EX(arginfo_get_browser, 0, 0, 0) ZEND_ARG_INFO(0, browser_name) ZEND_ARG_INFO(0, return_array) ZEND_END_ARG_INFO() /* }}} */ -/* {{{ crc32.c */ -ZEND_BEGIN_ARG_INFO(arginfo_crc32, 0) - ZEND_ARG_INFO(0, str) -ZEND_END_ARG_INFO() - -/* }}} */ -/* {{{ crypt.c */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_crypt, 0, 0, 1) - ZEND_ARG_INFO(0, str) - ZEND_ARG_INFO(0, salt) -ZEND_END_ARG_INFO() -/* }}} */ /* {{{ cyr_convert.c */ ZEND_BEGIN_ARG_INFO(arginfo_convert_cyr_string, 0) ZEND_ARG_INFO(0, str) @@ -1094,12 +574,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_fgetc, 0) ZEND_ARG_INFO(0, fp) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetss, 0, 0, 1) - ZEND_ARG_INFO(0, fp) - ZEND_ARG_INFO(0, length) - ZEND_ARG_INFO(0, allowable_tags) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_fscanf, 0, 0, 2) ZEND_ARG_INFO(0, stream) ZEND_ARG_INFO(0, format) @@ -1310,27 +784,27 @@ ZEND_BEGIN_ARG_INFO(arginfo_filetype, 0) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_writable, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_writable, _IS_BOOL, 0) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_readable, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_readable, _IS_BOOL, 0) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_executable, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_executable, _IS_BOOL, 0) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_file, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_file, _IS_BOOL, 0) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_dir, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_dir, _IS_BOOL, 0) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_link, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_link, _IS_BOOL, 0) ZEND_ARG_INFO(0, filename) ZEND_END_ARG_INFO() @@ -1396,95 +870,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_pfsockopen, 0, 0, 1) ZEND_ARG_INFO(0, timeout) ZEND_END_ARG_INFO() /* }}} */ -/* {{{ ftok.c */ -#if HAVE_FTOK -ZEND_BEGIN_ARG_INFO(arginfo_ftok, 0) - ZEND_ARG_INFO(0, pathname) - ZEND_ARG_INFO(0, proj) -ZEND_END_ARG_INFO() -#endif -/* }}} */ -/* {{{ head.c */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_header, 0, 0, 1) - ZEND_ARG_INFO(0, header) - ZEND_ARG_INFO(0, replace) - ZEND_ARG_INFO(0, http_response_code) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_header_remove, 0, 0, 0) - ZEND_ARG_INFO(0, name) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_setcookie, 0, 0, 1) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, value) - ZEND_ARG_INFO(0, expires_or_options) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, domain) - ZEND_ARG_INFO(0, secure) - ZEND_ARG_INFO(0, httponly) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_setrawcookie, 0, 0, 1) - ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, value) - ZEND_ARG_INFO(0, expires_or_options) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, domain) - ZEND_ARG_INFO(0, secure) - ZEND_ARG_INFO(0, httponly) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_headers_sent, 0, 0, 0) - ZEND_ARG_INFO(1, file) - ZEND_ARG_INFO(1, line) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_headers_list, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_http_response_code, 0, 0, 0) - ZEND_ARG_INFO(0, response_code) -ZEND_END_ARG_INFO() -/* }}} */ -/* {{{ hrtime.c */ -ZEND_BEGIN_ARG_INFO(arginfo_hrtime, 0) - ZEND_ARG_INFO(0, get_as_number) -ZEND_END_ARG_INFO() -/* }}} */ -/* {{{ html.c */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars, 0, 0, 1) - ZEND_ARG_INFO(0, string) - ZEND_ARG_INFO(0, quote_style) - ZEND_ARG_INFO(0, encoding) - ZEND_ARG_INFO(0, double_encode) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars_decode, 0, 0, 1) - ZEND_ARG_INFO(0, string) - ZEND_ARG_INFO(0, quote_style) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_html_entity_decode, 0, 0, 1) - ZEND_ARG_INFO(0, string) - ZEND_ARG_INFO(0, quote_style) - ZEND_ARG_INFO(0, encoding) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlentities, 0, 0, 1) - ZEND_ARG_INFO(0, string) - ZEND_ARG_INFO(0, quote_style) - ZEND_ARG_INFO(0, encoding) - ZEND_ARG_INFO(0, double_encode) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_get_html_translation_table, 0, 0, 0) - ZEND_ARG_INFO(0, table) - ZEND_ARG_INFO(0, quote_style) - ZEND_ARG_INFO(0, encoding) -ZEND_END_ARG_INFO() - -/* }}} */ /* {{{ http.c */ ZEND_BEGIN_ARG_INFO_EX(arginfo_http_build_query, 0, 0, 1) ZEND_ARG_INFO(0, formdata) @@ -1545,12 +930,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_iptcparse, 0) ZEND_ARG_INFO(0, iptcdata) ZEND_END_ARG_INFO() /* }}} */ - -/* {{{ lcg.c */ -ZEND_BEGIN_ARG_INFO(arginfo_lcg_value, 0) -ZEND_END_ARG_INFO() -/* }}} */ - /* {{{ levenshtein.c */ ZEND_BEGIN_ARG_INFO_EX(arginfo_levenshtein, 0, 0, 2) ZEND_ARG_INFO(0, str1) @@ -1613,71 +992,71 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_round, 0, 0, 1) ZEND_ARG_INFO(0, mode) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_sin, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_sin, IS_DOUBLE, 0) ZEND_ARG_INFO(0, number) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_cos, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_cos, IS_DOUBLE, 0) ZEND_ARG_INFO(0, number) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_tan, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_tan, IS_DOUBLE, 0) ZEND_ARG_INFO(0, number) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_asin, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_asin, IS_DOUBLE, 0) ZEND_ARG_INFO(0, number) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_acos, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_acos, IS_DOUBLE, 0) ZEND_ARG_INFO(0, number) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_atan, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_atan, IS_DOUBLE, 0) ZEND_ARG_INFO(0, number) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_atan2, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_atan2, IS_DOUBLE, 0) ZEND_ARG_INFO(0, y) ZEND_ARG_INFO(0, x) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_sinh, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_sinh, IS_DOUBLE, 0) ZEND_ARG_INFO(0, number) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_cosh, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_cosh, IS_DOUBLE, 0) ZEND_ARG_INFO(0, number) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_tanh, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_tanh, IS_DOUBLE, 0) ZEND_ARG_INFO(0, number) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_asinh, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_asinh, IS_DOUBLE, 0) ZEND_ARG_INFO(0, number) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_acosh, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_acosh, IS_DOUBLE, 0) ZEND_ARG_INFO(0, number) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_atanh, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_atanh, IS_DOUBLE, 0) ZEND_ARG_INFO(0, number) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_pi, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_pi, IS_DOUBLE, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_finite, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_finite, _IS_BOOL, 0) ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_infinite, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_infinite, _IS_BOOL, 0) ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_nan, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_nan, _IS_BOOL, 0) ZEND_ARG_INFO(0, val) ZEND_END_ARG_INFO() @@ -1771,23 +1150,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_intdiv, 0) ZEND_ARG_INFO(0, divisor) ZEND_END_ARG_INFO() /* }}} */ -/* {{{ md5.c */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_md5, 0, 0, 1) - ZEND_ARG_INFO(0, str) - ZEND_ARG_INFO(0, raw_output) -ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_md5_file, 0, 0, 1) - ZEND_ARG_INFO(0, filename) - ZEND_ARG_INFO(0, raw_output) -ZEND_END_ARG_INFO() -/* }}} */ -/* {{{ metaphone.c */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_metaphone, 0, 0, 1) - ZEND_ARG_INFO(0, text) - ZEND_ARG_INFO(0, phones) -ZEND_END_ARG_INFO() -/* }}} */ /* {{{ microtime.c */ #ifdef HAVE_GETTIMEOFDAY ZEND_BEGIN_ARG_INFO_EX(arginfo_microtime, 0, 0, 0) @@ -1817,22 +1180,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_unpack, 0, 0, 2) ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO() /* }}} */ -/* {{{ pageinfo.c */ -ZEND_BEGIN_ARG_INFO(arginfo_getmyuid, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_getmygid, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_getmypid, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_getmyinode, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_getlastmod, 0) -ZEND_END_ARG_INFO() -/* }}} */ /* {{{ password.c */ ZEND_BEGIN_ARG_INFO_EX(arginfo_password_hash, 0, 0, 2) ZEND_ARG_INFO(0, password) @@ -1913,17 +1260,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_random_int, 0, 0, 2) ZEND_ARG_INFO(0, max) ZEND_END_ARG_INFO() /* }}} */ -/* {{{ sha1.c */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_sha1, 0, 0, 1) - ZEND_ARG_INFO(0, str) - ZEND_ARG_INFO(0, raw_output) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_sha1_file, 0, 0, 1) - ZEND_ARG_INFO(0, filename) - ZEND_ARG_INFO(0, raw_output) -ZEND_END_ARG_INFO() -/* }}} */ /* {{{ soundex.c */ ZEND_BEGIN_ARG_INFO(arginfo_soundex, 0) ZEND_ARG_INFO(0, str) @@ -2162,22 +1498,22 @@ ZEND_BEGIN_ARG_INFO(arginfo_nl_langinfo, 0) ZEND_END_ARG_INFO() #endif -ZEND_BEGIN_ARG_INFO(arginfo_strcoll, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_strcoll, IS_LONG, 0) ZEND_ARG_INFO(0, str1) ZEND_ARG_INFO(0, str2) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_trim, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_trim, 0, 1, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_ARG_INFO(0, character_mask) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_rtrim, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_rtrim, 0, 1, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_ARG_INFO(0, character_mask) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_ltrim, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ltrim, 0, 1, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_ARG_INFO(0, character_mask) ZEND_END_ARG_INFO() @@ -2205,15 +1541,15 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_strtok, 0, 0, 1) ZEND_ARG_INFO(0, token) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_strtoupper, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_strtoupper, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_strtolower, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_strtolower, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_basename, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_basename, 0, 1, IS_STRING, 0) ZEND_ARG_INFO(0, path) ZEND_ARG_INFO(0, suffix) ZEND_END_ARG_INFO() @@ -2288,27 +1624,27 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_replace, 0, 0, 3) ZEND_ARG_INFO(0, length) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_quotemeta, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_quotemeta, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_ord, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_ord, IS_LONG, 0) ZEND_ARG_INFO(0, character) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_chr, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_chr, IS_STRING, 0) ZEND_ARG_INFO(0, codepoint) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_ucfirst, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_ucfirst, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_lcfirst, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_lcfirst, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_ucwords, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ucwords, 0, 1, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_ARG_INFO(0, delimiters) ZEND_END_ARG_INFO() @@ -2323,26 +1659,26 @@ ZEND_BEGIN_ARG_INFO(arginfo_strrev, 0) ZEND_ARG_INFO(0, str) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_similar_text, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_similar_text, 0, 2, IS_LONG, 0) ZEND_ARG_INFO(0, str1) ZEND_ARG_INFO(0, str2) ZEND_ARG_INFO(1, percent) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_addcslashes, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_addcslashes, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_ARG_INFO(0, charlist) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_addslashes, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_addslashes, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_stripcslashes, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_stripcslashes, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_stripslashes, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_stripslashes, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_END_ARG_INFO() @@ -2360,22 +1696,22 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_str_ireplace, 0, 0, 3) ZEND_ARG_INFO(1, replace_count) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_hebrev, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hebrev, 0, 1, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_ARG_INFO(0, max_chars_per_line) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_hebrevc, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hebrevc, 0, 1, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_ARG_INFO(0, max_chars_per_line) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_nl2br, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_nl2br, 0, 1, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_ARG_INFO(0, is_xhtml) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_strip_tags, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strip_tags, 0, 1, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_ARG_INFO(0, allowable_tags) ZEND_END_ARG_INFO() @@ -2385,7 +1721,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setlocale, 0, 0, 2) ZEND_ARG_VARIADIC_INFO(0, locales) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_str, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_parse_str, 0, 2, IS_VOID, 0) ZEND_ARG_INFO(0, encoded_string) ZEND_ARG_INFO(1, result) ZEND_END_ARG_INFO() @@ -2407,7 +1743,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_count_chars, 0, 0, 1) ZEND_ARG_INFO(0, mode) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_strnatcmp, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_strnatcmp, IS_LONG, 0) ZEND_ARG_INFO(0, s1) ZEND_ARG_INFO(0, s2) ZEND_END_ARG_INFO() @@ -2415,7 +1751,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_localeconv, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_strnatcasecmp, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_strnatcasecmp, IS_LONG, 0) ZEND_ARG_INFO(0, s1) ZEND_ARG_INFO(0, s2) ZEND_END_ARG_INFO() @@ -2440,11 +1776,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_sscanf, 0, 0, 2) ZEND_ARG_VARIADIC_INFO(1, vars) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_str_rot13, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_str_rot13, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_str_shuffle, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_str_shuffle, IS_STRING, 0) ZEND_ARG_INFO(0, str) ZEND_END_ARG_INFO() @@ -2479,31 +1815,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_compare, 0, 0, 3) ZEND_ARG_INFO(0, case_sensitivity) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_utf8_encode, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_utf8_encode, 0, 1, IS_STRING, 0) ZEND_ARG_INFO(0, data) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_utf8_decode, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_utf8_decode, 0, 1, IS_STRING, 0) ZEND_ARG_INFO(0, data) ZEND_END_ARG_INFO() /* }}} */ -/* {{{ syslog.c */ -#ifdef HAVE_SYSLOG_H -ZEND_BEGIN_ARG_INFO(arginfo_openlog, 0) - ZEND_ARG_INFO(0, ident) - ZEND_ARG_INFO(0, option) - ZEND_ARG_INFO(0, facility) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_closelog, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_syslog, 0) - ZEND_ARG_INFO(0, priority) - ZEND_ARG_INFO(0, message) -ZEND_END_ARG_INFO() -#endif -/* }}} */ /* {{{ type.c */ ZEND_BEGIN_ARG_INFO(arginfo_gettype, 0) ZEND_ARG_INFO(0, var) @@ -2531,57 +1850,57 @@ ZEND_BEGIN_ARG_INFO(arginfo_boolval, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_null, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_null, _IS_BOOL, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_resource, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_resource, _IS_BOOL, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_bool, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_bool, _IS_BOOL, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_int, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_int, _IS_BOOL, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_float, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_float, _IS_BOOL, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_string, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_string, _IS_BOOL, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_array, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_array, _IS_BOOL, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_object, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_object, _IS_BOOL, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_numeric, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_numeric, _IS_BOOL, 0) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_scalar, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_scalar, _IS_BOOL, 0) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_is_callable, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_is_callable, 0, 1, _IS_BOOL, 0) ZEND_ARG_INFO(0, var) ZEND_ARG_INFO(0, syntax_only) ZEND_ARG_INFO(1, callable_name) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_is_iterable, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_is_iterable, 0, 1, _IS_BOOL, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(arginfo_is_countable, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_is_countable, _IS_BOOL, 0) ZEND_ARG_INFO(0, var) ZEND_END_ARG_INFO() /* }}} */ @@ -2727,6 +2046,8 @@ ZEND_END_ARG_INFO() /* }}} */ /* }}} */ +#include "basic_functions_arginfo.h" + static const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(constant, arginfo_constant) PHP_FE(bin2hex, arginfo_bin2hex) @@ -3130,7 +2451,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(feof, arginfo_feof) PHP_FE(fgetc, arginfo_fgetc) PHP_FE(fgets, arginfo_fgets) - PHP_DEP_FE(fgetss, arginfo_fgetss) PHP_FE(fread, arginfo_fread) PHP_NAMED_FE(fopen, php_if_fopen, arginfo_fopen) PHP_FE(fpassthru, arginfo_fpassthru) @@ -3917,7 +3237,7 @@ PHP_FUNCTION(constant) /* }}} */ #ifdef HAVE_INET_NTOP -/* {{{ proto string inet_ntop(string in_addr) +/* {{{ proto string|false inet_ntop(string in_addr) Converts a packed inet address to a human readable IP address string */ PHP_NAMED_FUNCTION(zif_inet_ntop) { @@ -3949,7 +3269,7 @@ PHP_NAMED_FUNCTION(zif_inet_ntop) #endif /* HAVE_INET_NTOP */ #ifdef HAVE_INET_PTON -/* {{{ proto string inet_pton(string ip_address) +/* {{{ proto string|false inet_pton(string ip_address) Converts a human readable IP address to a packed binary string */ PHP_NAMED_FUNCTION(php_inet_pton) { @@ -3984,7 +3304,7 @@ PHP_NAMED_FUNCTION(php_inet_pton) /* }}} */ #endif /* HAVE_INET_PTON */ -/* {{{ proto int ip2long(string ip_address) +/* {{{ proto int|false ip2long(string ip_address) Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address */ PHP_FUNCTION(ip2long) { @@ -4022,7 +3342,7 @@ PHP_FUNCTION(ip2long) } /* }}} */ -/* {{{ proto string long2ip(int proper_address) +/* {{{ proto string|false long2ip(int proper_address) Converts an (IPv4) Internet network address into a string in Internet standard dotted format */ PHP_FUNCTION(long2ip) { @@ -4057,7 +3377,7 @@ PHP_FUNCTION(long2ip) * System Functions * ********************/ -/* {{{ proto string getenv(string varname[, bool local_only] +/* {{{ proto string|array|false getenv([ string varname[, bool local_only]]) Get the value of an environment variable or every available environment variable if no varname is present */ PHP_FUNCTION(getenv) @@ -4352,7 +3672,7 @@ static int parse_opts(char * opts, opt_struct ** result) } /* }}} */ -/* {{{ proto array getopt(string options [, array longopts [, int &optind]]) +/* {{{ proto array|false getopt(string options [, array longopts [, int &optind]]) Get options from the command line argument list */ PHP_FUNCTION(getopt) { @@ -4628,7 +3948,7 @@ PHP_FUNCTION(time_nanosleep) } /* }}} */ -/* {{{ proto mixed time_sleep_until(float timestamp) +/* {{{ proto bool time_sleep_until(float timestamp) Make the script sleep until the specified time */ PHP_FUNCTION(time_sleep_until) { @@ -4727,7 +4047,7 @@ static void add_config_entries(HashTable *hash, zval *return_value) /* {{{ */ } /* }}} */ -/* {{{ proto mixed get_cfg_var(string option_name) +/* {{{ proto string|array|false get_cfg_var(string option_name) Get the value of a PHP configuration option */ PHP_FUNCTION(get_cfg_var) { @@ -4755,7 +4075,7 @@ PHP_FUNCTION(get_cfg_var) } /* }}} */ -/* {{{ proto int get_magic_quotes_runtime(void) +/* {{{ proto false get_magic_quotes_runtime(void) Get the current active configuration setting of magic_quotes_runtime */ PHP_FUNCTION(get_magic_quotes_runtime) { @@ -4766,7 +4086,7 @@ PHP_FUNCTION(get_magic_quotes_runtime) } /* }}} */ -/* {{{ proto int get_magic_quotes_gpc(void) +/* {{{ proto false get_magic_quotes_gpc(void) Get the current active configuration setting of magic_quotes_gpc */ PHP_FUNCTION(get_magic_quotes_gpc) { @@ -5180,7 +4500,7 @@ PHPAPI void php_free_shutdown_functions(void) /* {{{ */ } /* }}} */ -/* {{{ proto void register_shutdown_function(callback function) U +/* {{{ proto false|null register_shutdown_function(callback function) U Register a user-level function to be called on request termination */ PHP_FUNCTION(register_shutdown_function) { @@ -5393,7 +4713,7 @@ PHP_FUNCTION(highlight_string) } /* }}} */ -/* {{{ proto string ini_get(string varname) +/* {{{ proto string|false ini_get(string varname) Get a configuration option */ PHP_FUNCTION(ini_get) { @@ -5423,7 +4743,7 @@ PHP_FUNCTION(ini_get) } /* }}} */ -/* {{{ proto array ini_get_all([string extension[, bool details = true]]) +/* {{{ proto array|false ini_get_all([string extension[, bool details = true]]) Get all configuration options */ PHP_FUNCTION(ini_get_all) { @@ -5505,7 +4825,7 @@ static int php_ini_check_path(char *option_name, size_t option_len, char *new_op } /* }}} */ -/* {{{ proto string ini_set(string varname, string newvalue) +/* {{{ proto string|false ini_set(string varname, string newvalue) Set a configuration option, returns false on error and the old value of the configuration option on success */ PHP_FUNCTION(ini_set) { @@ -5575,7 +4895,7 @@ PHP_FUNCTION(ini_restore) } /* }}} */ -/* {{{ proto string set_include_path(string new_include_path) +/* {{{ proto string|false set_include_path(string new_include_path) Sets the include_path configuration option */ PHP_FUNCTION(set_include_path) { @@ -5605,7 +4925,7 @@ PHP_FUNCTION(set_include_path) } /* }}} */ -/* {{{ proto string get_include_path() +/* {{{ proto string|false get_include_path() Get the current include_path configuration option */ PHP_FUNCTION(get_include_path) { @@ -5703,7 +5023,7 @@ PHP_FUNCTION(ignore_user_abort) /* }}} */ #if HAVE_GETSERVBYNAME -/* {{{ proto int getservbyname(string service, string protocol) +/* {{{ proto int|false getservbyname(string service, string protocol) Returns port associated with service. Protocol must be "tcp" or "udp" */ PHP_FUNCTION(getservbyname) { @@ -5746,7 +5066,7 @@ PHP_FUNCTION(getservbyname) #endif #if HAVE_GETSERVBYPORT -/* {{{ proto string getservbyport(int port, string protocol) +/* {{{ proto string|false getservbyport(int port, string protocol) Returns service name associated with port. Protocol must be "tcp" or "udp" */ PHP_FUNCTION(getservbyport) { @@ -5772,7 +5092,7 @@ PHP_FUNCTION(getservbyport) #endif #if HAVE_GETPROTOBYNAME -/* {{{ proto int getprotobyname(string name) +/* {{{ proto int|false getprotobyname(string name) Returns protocol number associated with name as per /etc/protocols */ PHP_FUNCTION(getprotobyname) { @@ -5796,7 +5116,7 @@ PHP_FUNCTION(getprotobyname) #endif #if HAVE_GETPROTOBYNUMBER -/* {{{ proto string getprotobynumber(int proto) +/* {{{ proto string|false getprotobynumber(int proto) Returns protocol name associated with protocol number proto */ PHP_FUNCTION(getprotobynumber) { @@ -6055,7 +5375,7 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, zval *arg3, } /* }}} */ -/* {{{ proto array parse_ini_file(string filename [, bool process_sections [, int scanner_mode]]) +/* {{{ proto array|false parse_ini_file(string filename [, bool process_sections [, int scanner_mode]]) Parse configuration file */ PHP_FUNCTION(parse_ini_file) { @@ -6097,7 +5417,7 @@ PHP_FUNCTION(parse_ini_file) } /* }}} */ -/* {{{ proto array parse_ini_string(string ini_string [, bool process_sections [, int scanner_mode]]) +/* {{{ proto array|false parse_ini_string(string ini_string [, bool process_sections [, int scanner_mode]]) Parse configuration string */ PHP_FUNCTION(parse_ini_string) { @@ -6154,7 +5474,7 @@ PHP_FUNCTION(config_get_hash) /* {{{ */ #endif #ifdef HAVE_GETLOADAVG -/* {{{ proto array sys_getloadavg() +/* {{{ proto array|false sys_getloadavg() */ PHP_FUNCTION(sys_getloadavg) { diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h index 2fff4e736e..9c949e166c 100644 --- a/ext/standard/basic_functions.h +++ b/ext/standard/basic_functions.h @@ -156,7 +156,7 @@ PHP_RSHUTDOWN_FUNCTION(browscap); /* Left for BC (not binary safe!) */ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers); PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, char *opt, char *headers); -PHPAPI int php_prefix_varname(zval *result, const zval *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore); +PHPAPI int php_prefix_varname(zval *result, zend_string *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore); #define MT_N (624) diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php new file mode 100755 index 0000000000..0922d39115 --- /dev/null +++ b/ext/standard/basic_functions.stub.php @@ -0,0 +1,399 @@ +<?php + +/* main/main.c */ + +function set_time_limit(int $seconds): bool {} + +/* main/SAPI.c */ + +// TODO: Make this a proper callable argument? +function header_register_callback($callback): bool {} + +/* main/output.c */ + +function ob_start( + $user_function = null, int $chunk_size = 0, int $flags = PHP_OUTPUT_HANDLER_STDFLAGS): bool {} + +function ob_flush(): bool {} + +function ob_clean(): bool {} + +function ob_end_flush(): bool {} + +function ob_end_clean(): bool {} + +/** @return string|false */ +function ob_get_flush() {} + +/** @return string|false */ +function ob_get_clean() {} + +/** @return string|false */ +function ob_get_contents() {} + +function ob_get_level(): int {} + +/** @return int|false */ +function ob_get_length() {} + +function ob_list_handlers(): array {} + +function ob_get_status(bool $full_status = false): array {} + +// TODO: Shouldn't this be a bool argument? +function ob_implicit_flush(int $flag = 1): void {} + +function output_reset_rewrite_vars(): bool {} + +function output_add_rewrite_var(string $name, string $value): bool {} + +/* main/streams/userspace.c */ + +function stream_wrapper_register(string $protocol, string $classname, int $flags = 0): bool {} + +function stream_wrapper_unregister(string $protocol): bool {} + +function stream_wrapper_restore(string $protocol): bool {} + +/* array.c */ + +/** @return int|false */ +function array_push(array &$stack, ...$args) {} + +function krsort(array &$arg, int $sort_flags = SORT_REGULAR): bool {} + +function ksort(array &$arg, int $sort_flags = SORT_REGULAR): bool {} + +/** @param array|Countable $array */ +function count($var, int $mode = COUNT_NORAML): int {} + +function natsort(array &$arg): bool {} + +function natcasesort(array &$arg): bool {} + +function asort(array &$arg, int $sort_flags = SORT_REGULAR): bool {} + +function arsort(array &$arg, int $sort_flags = SORT_REGULAR): bool {} + +function sort(array &$arg, int $sort_flags = SORT_REGULAR): bool {} + +function rsort(array &$arg, int $sort_flags = SORT_REGULAR): bool {} + +function usort(array &$arg, callable $cmp_function): bool {} + +function uasort(array &$arg, callable $cmp_function): bool {} + +function uksort(array &$arg, callable $cmp_function): bool {} + +/** + * @param array|object $arg + * @return mixed + */ +function end(array &$arg) {} + +/** + * @param array|object $arg + * @return mixed + */ +function prev(&$arg) {} + +/** + * @param array|object $arg + * @return mixed + */ +function next(&$arg) {} + +/** + * @param array|object $arg + * @return mixed + */ +function reset(&$arg) {} + +/** + * @param array|object $arg + * @return mixed + */ +function current($arg) {} + +/** + * @param array|object $arg + * @return int|string|null + */ +function key($arg) {} + +/** @return mixed */ +function min($arg, ...$args) {} + +/** @return mixed */ +function max($arg, ...$args) {} + +/** @param array|object $input */ +function array_walk(&$input, callable $funcname, $userdata = null): bool {} + +/** @param array|object $input */ +function array_walk_recursive(&$input, callable $funcname, $userdata = null): bool {} + +function in_array($needle, array $haystack, bool $strict = false): bool {} + +/** @return int|string|false */ +function array_search($needle, array $haystack, bool $strict = false) {} + +/** @prefer-ref $arg */ +function extract(array &$arg, int $extract_type = EXTR_OVERWRITE, string $prefix = ""): int {} + +function compact($var_name, ...$var_names): array {} + +/** @return array|false */ +function array_fill(int $start_key, int $num, $val) {} + +function array_fill_keys(array $keys, $val): array {} + +/** + * @param int|float|string $low + * @param int|float|string $high + * @param int|float $step + */ +function range($low, $high, $step = 1): array {} + +function shuffle(array &$arg): bool {} + +/** @return mixed */ +function array_pop(array &$stack) {} + +/** @return mixed */ +function array_shift(array &$stack) {} + +function array_unshift(array &$stack, ...$vars): int {} + +function array_splice(array &$arg, int $offset, int $length = UNKNOWN, $replacement = []): array {} + +function array_slice(array $arg, int $offset, ?int $length = null, bool $preserve_keys = false): array {} + +function array_merge(array ...$arrays): array {} + +function array_merge_recursive(array ...$arrays): array {} + +function array_replace(array $arr1, array ...$arrays): array {} + +function array_replace_recursive(array $arr1, array ...$arrays): array {} + +function array_keys(array $arg, $search_value = UNKNOWN, bool $strict = false): array {} + +/** @return int|string|null */ +function array_key_first(array $arg) {} + +/** @return int|string|null */ +function array_key_last(array $arg) {} + +function array_values(array $arg): array {} + +function array_count_values(array $arg): array {} + +/** + * @param int|string|null $column_key + * @param int|string|null $index_key + */ +function array_column(array $arg, $column_key, $index_key = null): array {} + +function array_reverse(array $input, bool $preserve_keys = false): array {} + +function array_pad(array $arg, int $pad_size, $pad_value): array {} + +function array_flip(array $arg): array {} + +function array_change_key_case(array $input, int $case = CASE_LOWER): array {} + +function array_unique(array $arg, int $flags = SORT_STRING): array {} + +function array_intersect_key(array $arr1, array $arr2, array ...$arrays): array {} + +function array_intersect_ukey(array $arr1, array $arr2, ...$rest): array {} + +function array_intersect(array $arr1, array $arr2, array ...$arrays): array {} + +function array_uintersect(array $arr1, array $arr2, ...$rest): array {} + +function array_intersect_assoc(array $arr1, array $arr2, array ...$arrays): array {} + +function array_uintersect_assoc(array $arr1, array $arr2, ...$rest): array {} + +function array_intersect_uassoc(array $arr1, array $arr2, ...$rest): array {} + +function array_uintersect_uassoc(array $arr1, array $arr2, ...$rest): array {} + +function array_diff_key(array $arr1, array $arr2, array ...$arrays): array {} + +function array_diff_ukey(array $arr1, array $arr2, ...$rest): array {} + +function array_diff(array $arr1, array $arr2, array ...$arrays): array {} + +function array_udiff(array $arr1, array $arr2, ...$rest): array {} + +function array_diff_assoc(array $arr1, array $arr2, array ...$arrays): array {} + +function array_diff_uassoc(array $arr1, array $arr2, ...$rest): array {} + +function array_udiff_assoc(array $arr1, array $arr2, ...$rest): array {} + +function array_udiff_uassoc(array $arr1, array $arr2, ...$rest): array {} + +/** + * @prefer-ref $arr1 + * @prefer-ref $sort_order + * @prefer-ref $sort_flags + * @prefer-ref $arr2 + */ +function array_multisort(&$arr1, $sort_order = SORT_ASC, $sort_flags = SORT_REGULAR, &...$arr2): bool {} + +/** @return int|string|array */ +function array_rand(array $arg, int $num_req = 1) {} + +/** @return int|float */ +function array_sum(array $arg) {} + +/** @return int|float */ +function array_product(array $arg) {} + +function array_reduce(array $arg, callable $callback, $initial = null) {} + +function array_filter(array $arg, callable $callback, int $use_keys = 0): array {} + +function array_map(?callable $callback, array $arr1, array ...$arrays): array {} + +/** + * @param int|string $key + * @param array|object $search + */ +function array_key_exists($key, $search): bool {} + +function array_chunk(array $arg, int $size, bool $preserve_keys = false): array {} + +function array_combine(array $keys, array $values): array {} + +/* base64.c */ + +function base64_encode(string $str): string {} + +/** @return string|false */ +function base64_decode(string $str, bool $strict = false) {} + +/* crc32.c */ + +function crc32(string $str): int {} + +/* crypt.c */ + +function crypt(string $str, string $salt = UNKNOWN): string {} + +/* ftok.c */ + +#if HAVE_FTOK +function ftok(string $pathname, string $proj): int {} +#endif + +/* hrtime.c */ + +/** @return array|int|float|false */ +function hrtime(bool $get_as_number = false) {} + +/* lcg.c */ + +function lcg_value(): float {} + +/* md5.c */ + +function md5(string $str, bool $raw_output = false): string {} + +/** @return string|false */ +function md5_file(string $filename, bool $raw_output = false) {} + +/* pageinfo.c */ + +/** @return int|false */ +function getmyuid() {} + +/** @return int|false */ +function getmygid() {} + +/** @return int|false */ +function getmypid() {} + +/** @return int|false */ +function getmyinode() {} + +function getlastmod(): int {} + +/* sha1.c */ + +function sha1(string $str, bool $raw_output = false): string {} + +/** @return string|false */ +function sha1_file(string $filename, bool $raw_output = false) {} + +/* syslog.c */ + +#ifdef HAVE_SYSLOG_H +function openlog (string $ident, int $option, int $facility): bool {} + +function closelog (): bool {} + +function syslog (int $priority, string $message): bool {} +#endif + +#ifdef HAVE_INET_NTOP +/** @return string|false */ +function inet_ntop (string $in_addr) {} +#endif + +#ifdef HAVE_INET_PTON +/** @return string|false */ +function inet_pton (string $ip_address) {} +#endif + +/* metaphone.c */ + +/** @return string|false */ +function metaphone(string $text, int $phones = 0) {} + +/* {{{ head.c */ +function header(string $string, bool $replace = true, int $http_response_code = 0): void { } + +function header_remove(string $name = UNKNOWN): void { } + +/** @param int|array $expires_or_options */ +function setrawcookie(string $name, string $value = '', $expires_or_options = 0, string $path = '', string $domain = '', bool $secure = false, bool $httponly = false): bool {} + + +/** @param int|array $expires_or_options */ +function setcookie(string $name, string $value = '', $expires_or_options = 0, string $path = '', string $domain = '', bool $secure = false, bool $httponly = false): bool {} + +/** @return int|bool */ +function http_response_code(int $response_code = 0) {} + +function headers_sent(&$file = null, &$line = null): bool {} + +function headers_list(): array { } + +/* {{{ html.c */ + +function htmlspecialchars(string $string, int $quote_style = ENT_COMPAT, ?string $encoding = null, bool $double_encode = true): string {} + +/** @return string|false */ +function htmlspecialchars_decode(string $string, int $quote_style = ENT_COMPAT) {} + +/** @return string|false */ +function html_entity_decode(string $string, int $quote_style = ENT_COMPAT, string $encoding = UNKNOWN) {} + +function htmlentities(string $string, int $quote_style = ENT_COMPAT, ?string $encoding = null, bool $double_encode = true): string {} + +function get_html_translation_table(int $table = HTML_SPECIALCHARS, int $quote_style = ENT_COMPAT, string $encoding = "UTF-8"): array {} + +/* }}} */ + +/* assert.c */ + +/** @param mixed $assertion */ +function assert($assertion, $description = null): bool {} + +/** @return int|string|bool|null */ +function assert_options(int $what, $value = UNKNOWN) {} diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h new file mode 100755 index 0000000000..5a45b55b03 --- /dev/null +++ b/ext/standard/basic_functions_arginfo.h @@ -0,0 +1,518 @@ +/* This is a generated file, edit the .stub.php file instead. */ + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_header_register_callback, 0, 1, _IS_BOOL, 0) + ZEND_ARG_INFO(0, callback) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_start, 0, 0, _IS_BOOL, 0) + ZEND_ARG_INFO(0, user_function) + ZEND_ARG_TYPE_INFO(0, chunk_size, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_flush, 0, 0, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +#define arginfo_ob_clean arginfo_ob_flush + +#define arginfo_ob_end_flush arginfo_ob_flush + +#define arginfo_ob_end_clean arginfo_ob_flush + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_get_flush, 0, 0, 0) +ZEND_END_ARG_INFO() + +#define arginfo_ob_get_clean arginfo_ob_get_flush + +#define arginfo_ob_get_contents arginfo_ob_get_flush + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_get_level, 0, 0, IS_LONG, 0) +ZEND_END_ARG_INFO() + +#define arginfo_ob_get_length arginfo_ob_get_flush + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_list_handlers, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_get_status, 0, 0, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, full_status, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_implicit_flush, 0, 0, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, flag, IS_LONG, 0) +ZEND_END_ARG_INFO() + +#define arginfo_output_reset_rewrite_vars arginfo_ob_flush + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_output_add_rewrite_var, 0, 2, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_wrapper_register, 0, 2, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, protocol, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, classname, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_wrapper_unregister, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, protocol, IS_STRING, 0) +ZEND_END_ARG_INFO() + +#define arginfo_stream_wrapper_restore arginfo_stream_wrapper_unregister + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_push, 0, 0, 1) + ZEND_ARG_TYPE_INFO(1, stack, IS_ARRAY, 0) + ZEND_ARG_VARIADIC_INFO(0, args) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_krsort, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(1, arg, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, sort_flags, IS_LONG, 0) +ZEND_END_ARG_INFO() + +#define arginfo_ksort arginfo_krsort + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_count, 0, 1, IS_LONG, 0) + ZEND_ARG_INFO(0, var) + ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_natsort, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(1, arg, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_natcasesort arginfo_natsort + +#define arginfo_asort arginfo_krsort + +#define arginfo_arsort arginfo_krsort + +#define arginfo_sort arginfo_krsort + +#define arginfo_rsort arginfo_krsort + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_usort, 0, 2, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(1, arg, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, cmp_function, IS_CALLABLE, 0) +ZEND_END_ARG_INFO() + +#define arginfo_uasort arginfo_usort + +#define arginfo_uksort arginfo_usort + +ZEND_BEGIN_ARG_INFO_EX(arginfo_end, 0, 0, 1) + ZEND_ARG_TYPE_INFO(1, arg, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_prev, 0, 0, 1) + ZEND_ARG_INFO(1, arg) +ZEND_END_ARG_INFO() + +#define arginfo_next arginfo_prev + +#define arginfo_reset arginfo_prev + +ZEND_BEGIN_ARG_INFO_EX(arginfo_current, 0, 0, 1) + ZEND_ARG_INFO(0, arg) +ZEND_END_ARG_INFO() + +#define arginfo_key arginfo_current + +ZEND_BEGIN_ARG_INFO_EX(arginfo_min, 0, 0, 1) + ZEND_ARG_INFO(0, arg) + ZEND_ARG_VARIADIC_INFO(0, args) +ZEND_END_ARG_INFO() + +#define arginfo_max arginfo_min + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_walk, 0, 2, _IS_BOOL, 0) + ZEND_ARG_INFO(1, input) + ZEND_ARG_TYPE_INFO(0, funcname, IS_CALLABLE, 0) + ZEND_ARG_INFO(0, userdata) +ZEND_END_ARG_INFO() + +#define arginfo_array_walk_recursive arginfo_array_walk + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_in_array, 0, 2, _IS_BOOL, 0) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_TYPE_INFO(0, haystack, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, strict, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_search, 0, 0, 2) + ZEND_ARG_INFO(0, needle) + ZEND_ARG_TYPE_INFO(0, haystack, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, strict, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_extract, 0, 1, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(ZEND_SEND_PREFER_REF, arg, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, extract_type, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_compact, 0, 1, IS_ARRAY, 0) + ZEND_ARG_INFO(0, var_name) + ZEND_ARG_VARIADIC_INFO(0, var_names) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_fill, 0, 0, 3) + ZEND_ARG_TYPE_INFO(0, start_key, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, num, IS_LONG, 0) + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_fill_keys, 0, 2, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, keys, IS_ARRAY, 0) + ZEND_ARG_INFO(0, val) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_range, 0, 2, IS_ARRAY, 0) + ZEND_ARG_INFO(0, low) + ZEND_ARG_INFO(0, high) + ZEND_ARG_INFO(0, step) +ZEND_END_ARG_INFO() + +#define arginfo_shuffle arginfo_natsort + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_pop, 0, 0, 1) + ZEND_ARG_TYPE_INFO(1, stack, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_array_shift arginfo_array_pop + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_unshift, 0, 1, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(1, stack, IS_ARRAY, 0) + ZEND_ARG_VARIADIC_INFO(0, vars) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_splice, 0, 2, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(1, arg, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) + ZEND_ARG_INFO(0, replacement) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_slice, 0, 2, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1) + ZEND_ARG_TYPE_INFO(0, preserve_keys, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_merge, 0, 0, IS_ARRAY, 0) + ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_array_merge_recursive arginfo_array_merge + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_replace, 0, 1, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, arr1, IS_ARRAY, 0) + ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_array_replace_recursive arginfo_array_replace + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_keys, 0, 1, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0) + ZEND_ARG_INFO(0, search_value) + ZEND_ARG_TYPE_INFO(0, strict, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_key_first, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_array_key_last arginfo_array_key_first + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_values, 0, 1, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_array_count_values arginfo_array_values + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_column, 0, 2, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0) + ZEND_ARG_INFO(0, column_key) + ZEND_ARG_INFO(0, index_key) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_reverse, 0, 1, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, input, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, preserve_keys, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_pad, 0, 3, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, pad_size, IS_LONG, 0) + ZEND_ARG_INFO(0, pad_value) +ZEND_END_ARG_INFO() + +#define arginfo_array_flip arginfo_array_values + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_change_key_case, 0, 1, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, input, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, case, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_unique, 0, 1, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_intersect_key, 0, 2, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, arr1, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, arr2, IS_ARRAY, 0) + ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_intersect_ukey, 0, 2, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, arr1, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, arr2, IS_ARRAY, 0) + ZEND_ARG_VARIADIC_INFO(0, rest) +ZEND_END_ARG_INFO() + +#define arginfo_array_intersect arginfo_array_intersect_key + +#define arginfo_array_uintersect arginfo_array_intersect_ukey + +#define arginfo_array_intersect_assoc arginfo_array_intersect_key + +#define arginfo_array_uintersect_assoc arginfo_array_intersect_ukey + +#define arginfo_array_intersect_uassoc arginfo_array_intersect_ukey + +#define arginfo_array_uintersect_uassoc arginfo_array_intersect_ukey + +#define arginfo_array_diff_key arginfo_array_intersect_key + +#define arginfo_array_diff_ukey arginfo_array_intersect_ukey + +#define arginfo_array_diff arginfo_array_intersect_key + +#define arginfo_array_udiff arginfo_array_intersect_ukey + +#define arginfo_array_diff_assoc arginfo_array_intersect_key + +#define arginfo_array_diff_uassoc arginfo_array_intersect_ukey + +#define arginfo_array_udiff_assoc arginfo_array_intersect_ukey + +#define arginfo_array_udiff_uassoc arginfo_array_intersect_ukey + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_multisort, 0, 1, _IS_BOOL, 0) + ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr1) + ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_order) + ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_flags) + ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, arr2) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_rand, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, num_req, IS_LONG, 0) +ZEND_END_ARG_INFO() + +#define arginfo_array_sum arginfo_array_key_first + +#define arginfo_array_product arginfo_array_key_first + +ZEND_BEGIN_ARG_INFO_EX(arginfo_array_reduce, 0, 0, 2) + ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0) + ZEND_ARG_INFO(0, initial) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_filter, 0, 2, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0) + ZEND_ARG_TYPE_INFO(0, use_keys, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_map, 0, 2, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 1) + ZEND_ARG_TYPE_INFO(0, arr1, IS_ARRAY, 0) + ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_key_exists, 0, 2, _IS_BOOL, 0) + ZEND_ARG_INFO(0, key) + ZEND_ARG_INFO(0, search) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_chunk, 0, 2, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, preserve_keys, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_combine, 0, 2, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, keys, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, values, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_base64_encode, 0, 1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_base64_decode, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, strict, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_crc32, 0, 1, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_crypt, 0, 1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0) +ZEND_END_ARG_INFO() + +#if HAVE_FTOK +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftok, 0, 2, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, pathname, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, proj, IS_STRING, 0) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO_EX(arginfo_hrtime, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, get_as_number, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_lcg_value, 0, 0, IS_DOUBLE, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_md5, 0, 1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_md5_file, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +#define arginfo_getmyuid arginfo_ob_get_flush + +#define arginfo_getmygid arginfo_ob_get_flush + +#define arginfo_getmypid arginfo_ob_get_flush + +#define arginfo_getmyinode arginfo_ob_get_flush + +#define arginfo_getlastmod arginfo_ob_get_level + +#define arginfo_sha1 arginfo_md5 + +#define arginfo_sha1_file arginfo_md5_file + +#if defined(HAVE_SYSLOG_H) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openlog, 0, 3, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, ident, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, facility, IS_LONG, 0) +ZEND_END_ARG_INFO() +#endif + +#if defined(HAVE_SYSLOG_H) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_closelog, 0, 0, _IS_BOOL, 0) +ZEND_END_ARG_INFO() +#endif + +#if defined(HAVE_SYSLOG_H) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_syslog, 0, 2, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, priority, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0) +ZEND_END_ARG_INFO() +#endif + +#if defined(HAVE_INET_NTOP) +ZEND_BEGIN_ARG_INFO_EX(arginfo_inet_ntop, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, in_addr, IS_STRING, 0) +ZEND_END_ARG_INFO() +#endif + +#if defined(HAVE_INET_PTON) +ZEND_BEGIN_ARG_INFO_EX(arginfo_inet_pton, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, ip_address, IS_STRING, 0) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO_EX(arginfo_metaphone, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, text, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, phones, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_header, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, replace, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, http_response_code, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_header_remove, 0, 0, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_setrawcookie, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0) + ZEND_ARG_INFO(0, expires_or_options) + ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, secure, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, httponly, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +#define arginfo_setcookie arginfo_setrawcookie + +ZEND_BEGIN_ARG_INFO_EX(arginfo_http_response_code, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, response_code, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_headers_sent, 0, 0, _IS_BOOL, 0) + ZEND_ARG_INFO(1, file) + ZEND_ARG_INFO(1, line) +ZEND_END_ARG_INFO() + +#define arginfo_headers_list arginfo_ob_list_handlers + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_htmlspecialchars, 0, 1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, quote_style, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 1) + ZEND_ARG_TYPE_INFO(0, double_encode, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars_decode, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, quote_style, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_html_entity_decode, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, quote_style, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0) +ZEND_END_ARG_INFO() + +#define arginfo_htmlentities arginfo_htmlspecialchars + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_html_translation_table, 0, 0, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, table, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, quote_style, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_assert, 0, 1, _IS_BOOL, 0) + ZEND_ARG_INFO(0, assertion) + ZEND_ARG_INFO(0, description) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_assert_options, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, what, IS_LONG, 0) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index 9f85ec2b70..5b49e5d661 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -5,6 +5,10 @@ AC_CACHE_CHECK([whether flush should be called explicitly after a buffered io], AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <stdio.h> #include <stdlib.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#include <string.h> int main(int argc, char **argv) { @@ -67,6 +71,9 @@ AC_CACHE_CHECK(for standard DES crypt, ac_cv_crypt_des,[ #include <crypt.h> #endif +#include <stdlib.h> +#include <string.h> + int main() { #if HAVE_CRYPT char *encrypted = crypt("rasmuslerdorf","rl"); @@ -92,6 +99,9 @@ AC_CACHE_CHECK(for extended DES crypt, ac_cv_crypt_ext_des,[ #include <crypt.h> #endif +#include <stdlib.h> +#include <string.h> + int main() { #if HAVE_CRYPT char *encrypted = crypt("rasmuslerdorf","_J9..rasm"); @@ -117,6 +127,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <crypt.h> #endif +#include <stdlib.h> +#include <string.h> + int main() { #if HAVE_CRYPT char salt[15], answer[40]; @@ -152,6 +165,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <crypt.h> #endif +#include <stdlib.h> +#include <string.h> + int main() { #if HAVE_CRYPT char salt[30], answer[70]; @@ -184,6 +200,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <crypt.h> #endif +#include <stdlib.h> +#include <string.h> + int main() { #if HAVE_CRYPT char salt[21], answer[21+86]; @@ -215,6 +234,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <crypt.h> #endif +#include <stdlib.h> +#include <string.h> + int main() { #if HAVE_CRYPT char salt[21], answer[21+43]; diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index b1f0f26557..0ddce74f3d 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -69,7 +69,7 @@ PHPAPI char *php_std_date(time_t t) char *strptime(const char *s, const char *format, struct tm *tm); #endif -/* {{{ proto string strptime(string timestamp, string format) +/* {{{ proto array|false strptime(string timestamp, string format) Parse a time/date generated with strftime() */ PHP_FUNCTION(strptime) { diff --git a/ext/standard/dir.c b/ext/standard/dir.c index e81855fc29..31ef72c2b1 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -68,21 +68,21 @@ static zend_class_entry *dir_class_entry_ptr; myself = getThis(); \ if (myself) { \ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(myself), "handle", sizeof("handle")-1)) == NULL) { \ - php_error_docref(NULL, E_WARNING, "Unable to find my handle property"); \ - RETURN_FALSE; \ + zend_throw_error(NULL, "Unable to find my handle property"); \ + return; \ } \ if ((dirp = (php_stream *)zend_fetch_resource_ex(tmp, "Directory", php_file_le_stream())) == NULL) { \ - RETURN_FALSE; \ + return; \ } \ } else { \ if (!DIRG(default_dir) || \ (dirp = (php_stream *)zend_fetch_resource(DIRG(default_dir), "Directory", php_file_le_stream())) == NULL) { \ - RETURN_FALSE; \ + return; \ } \ } \ } else { \ if ((dirp = (php_stream *)zend_fetch_resource(Z_RES_P(id), "Directory", php_file_le_stream())) == NULL) { \ - RETURN_FALSE; \ + return; \ } \ } @@ -239,7 +239,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject) } /* }}} */ -/* {{{ proto mixed opendir(string path[, resource context]) +/* {{{ proto resource|false opendir(string path[, resource context]) Open a directory and return a dir_handle */ PHP_FUNCTION(opendir) { @@ -247,7 +247,7 @@ PHP_FUNCTION(opendir) } /* }}} */ -/* {{{ proto object dir(string directory[, resource context]) +/* {{{ proto object|false dir(string directory[, resource context]) Directory class with properties, handle and class and methods read, rewind and close */ PHP_FUNCTION(getdir) { @@ -255,7 +255,7 @@ PHP_FUNCTION(getdir) } /* }}} */ -/* {{{ proto void closedir([resource dir_handle]) +/* {{{ proto bool closedir([resource dir_handle]) Close directory connection identified by the dir_handle */ PHP_FUNCTION(closedir) { @@ -266,8 +266,8 @@ PHP_FUNCTION(closedir) FETCH_DIRP(); if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) { - php_error_docref(NULL, E_WARNING, "%d is not a valid Directory resource", dirp->res->handle); - RETURN_FALSE; + zend_type_error("%d is not a valid Directory resource", dirp->res->handle); + return; } res = dirp->res; @@ -382,15 +382,15 @@ PHP_FUNCTION(rewinddir) FETCH_DIRP(); if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) { - php_error_docref(NULL, E_WARNING, "%d is not a valid Directory resource", dirp->res->handle); - RETURN_FALSE; + zend_type_error("%d is not a valid Directory resource", dirp->res->handle); + return; } php_stream_rewinddir(dirp); } /* }}} */ -/* {{{ proto string readdir([resource dir_handle]) +/* {{{ proto string|false readdir([resource dir_handle]) Read directory entry from dir_handle */ PHP_NAMED_FUNCTION(php_if_readdir) { @@ -401,8 +401,8 @@ PHP_NAMED_FUNCTION(php_if_readdir) FETCH_DIRP(); if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) { - php_error_docref(NULL, E_WARNING, "%d is not a valid Directory resource", dirp->res->handle); - RETURN_FALSE; + zend_type_error("%d is not a valid Directory resource", dirp->res->handle); + return; } if (php_stream_readdir(dirp, &entry)) { @@ -413,7 +413,7 @@ PHP_NAMED_FUNCTION(php_if_readdir) /* }}} */ #ifdef HAVE_GLOB -/* {{{ proto array glob(string pattern [, int flags]) +/* {{{ proto array|false glob(string pattern [, int flags]) Find pathnames matching a pattern */ PHP_FUNCTION(glob) { @@ -546,7 +546,7 @@ no_results: /* }}} */ #endif -/* {{{ proto array scandir(string dir [, int sorting_order [, resource context]]) +/* {{{ proto array|false scandir(string dir [, int sorting_order [, resource context]]) List files & directories inside the specified path */ PHP_FUNCTION(scandir) { @@ -566,8 +566,8 @@ PHP_FUNCTION(scandir) ZEND_PARSE_PARAMETERS_END(); if (dirn_len < 1) { - php_error_docref(NULL, E_WARNING, "Directory name cannot be empty"); - RETURN_FALSE; + zend_throw_error(NULL, "Directory name cannot be empty"); + return; } if (zcontext) { diff --git a/ext/standard/dns.c b/ext/standard/dns.c index d461a39c34..24524e6b98 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -120,7 +120,7 @@ static zend_string *php_gethostbyaddr(char *ip); static zend_string *php_gethostbyname(char *name); #ifdef HAVE_GETHOSTNAME -/* {{{ proto string gethostname() +/* {{{ proto string|false gethostname() Get the host name of the current machine */ PHP_FUNCTION(gethostname) { @@ -144,7 +144,7 @@ PHP_FUNCTION(gethostname) we can have a dns.c, dns_unix.c and dns_win32.c instead of a messy dns.c full of #ifdef */ -/* {{{ proto string gethostbyaddr(string ip_address) +/* {{{ proto string|false gethostbyaddr(string ip_address) Get the Internet host name corresponding to a given IP address */ PHP_FUNCTION(gethostbyaddr) { @@ -227,7 +227,7 @@ PHP_FUNCTION(gethostbyname) } /* }}} */ -/* {{{ proto array gethostbynamel(string hostname) +/* {{{ proto array|false gethostbynamel(string hostname) Return a list of IP addresses that a given hostname resolves to. */ PHP_FUNCTION(gethostbynamel) { diff --git a/ext/standard/exec.c b/ext/standard/exec.c index da8b5712cf..322a841c29 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -217,7 +217,7 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ Z_PARAM_ZVAL(ret_array) } Z_PARAM_ZVAL(ret_code) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); if (!cmd_len) { php_error_docref(NULL, E_WARNING, "Cannot execute a blank command"); @@ -249,7 +249,7 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ } /* }}} */ -/* {{{ proto string exec(string command [, array &output [, int &return_value]]) +/* {{{ proto string|false exec(string command [, array &output [, int &return_value]]) Execute an external program */ PHP_FUNCTION(exec) { @@ -257,7 +257,7 @@ PHP_FUNCTION(exec) } /* }}} */ -/* {{{ proto int system(string command [, int &return_value]) +/* {{{ proto int|false system(string command [, int &return_value]) Execute an external program and display output */ PHP_FUNCTION(system) { @@ -265,7 +265,7 @@ PHP_FUNCTION(system) } /* }}} */ -/* {{{ proto void passthru(string command [, int &return_value]) +/* {{{ proto bool passthru(string command [, int &return_value]) Execute an external program and display raw output */ PHP_FUNCTION(passthru) { @@ -485,7 +485,7 @@ PHP_FUNCTION(escapeshellcmd) if (command_len) { if (command_len != strlen(command)) { - php_error_docref(NULL, E_ERROR, "Input string contains NULL bytes"); + zend_type_error("Input string contains NULL bytes"); return; } RETVAL_STR(php_escape_shell_cmd(command)); @@ -506,17 +506,16 @@ PHP_FUNCTION(escapeshellarg) Z_PARAM_STRING(argument, argument_len) ZEND_PARSE_PARAMETERS_END(); - if (argument) { - if (argument_len != strlen(argument)) { - php_error_docref(NULL, E_ERROR, "Input string contains NULL bytes"); - return; - } - RETVAL_STR(php_escape_shell_arg(argument)); + if (argument_len != strlen(argument)) { + zend_type_error("Input string contains NULL bytes"); + return; } + + RETVAL_STR(php_escape_shell_arg(argument)); } /* }}} */ -/* {{{ proto string shell_exec(string cmd) +/* {{{ proto string|false shell_exec(string cmd) Execute command via shell and return complete output as string */ PHP_FUNCTION(shell_exec) { diff --git a/ext/standard/file.c b/ext/standard/file.c index 12effbdb29..9958c0d354 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -375,7 +375,7 @@ PHP_FUNCTION(flock) #define PHP_META_UNSAFE ".\\+*?[^]$() " -/* {{{ proto array get_meta_tags(string filename [, bool use_include_path]) +/* {{{ proto array|false get_meta_tags(string filename [, bool use_include_path]) Extracts all meta tag content attributes from a file and returns an array */ PHP_FUNCTION(get_meta_tags) { @@ -520,7 +520,7 @@ PHP_FUNCTION(get_meta_tags) } /* }}} */ -/* {{{ proto string file_get_contents(string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]]) +/* {{{ proto string|false file_get_contents(string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]]) Read the entire file into a string */ PHP_FUNCTION(file_get_contents) { @@ -578,7 +578,7 @@ PHP_FUNCTION(file_get_contents) } /* }}} */ -/* {{{ proto int file_put_contents(string file, mixed data [, int flags [, resource context]]) +/* {{{ proto int|false file_put_contents(string file, mixed data [, int flags [, resource context]]) Write/Create a file with contents data and return the number of bytes written */ PHP_FUNCTION(file_put_contents) { @@ -694,7 +694,7 @@ PHP_FUNCTION(file_put_contents) if (Z_OBJ_HT_P(data) != NULL) { zval out; - if (zend_std_cast_object_tostring(data, &out, IS_STRING) == SUCCESS) { + if (zend_std_cast_object_tostring(Z_OBJ_P(data), &out, IS_STRING) == SUCCESS) { numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRLEN(out)); if (numbytes != Z_STRLEN(out)) { php_error_docref(NULL, E_WARNING, "Only %zd of %zd bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out)); @@ -720,7 +720,7 @@ PHP_FUNCTION(file_put_contents) #define PHP_FILE_BUF_SIZE 80 -/* {{{ proto array file(string filename [, int flags[, resource context]]) +/* {{{ proto array|false file(string filename [, int flags[, resource context]]) Read entire file into an array */ PHP_FUNCTION(file) { @@ -816,7 +816,7 @@ parse_eol: } /* }}} */ -/* {{{ proto string tempnam(string dir, string prefix) +/* {{{ proto string|false tempnam(string dir, string prefix) Create a unique filename in a directory */ PHP_FUNCTION(tempnam) { @@ -927,7 +927,7 @@ PHPAPI PHP_FUNCTION(fclose) } /* }}} */ -/* {{{ proto resource popen(string command, string mode) +/* {{{ proto resource|false popen(string command, string mode) Execute a command and open either a read or a write pipe to it */ PHP_FUNCTION(popen) { @@ -1093,55 +1093,6 @@ PHPAPI PHP_FUNCTION(fgetc) } /* }}} */ -/* {{{ proto string fgetss(resource fp [, int length [, string allowable_tags]]) - Get a line from file pointer and strip HTML tags */ -PHPAPI PHP_FUNCTION(fgetss) -{ - zval *fd; - zend_long bytes = 0; - size_t len = 0; - size_t actual_len, retval_len; - char *buf = NULL, *retval; - php_stream *stream; - char *allowed_tags=NULL; - size_t allowed_tags_len=0; - - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_RESOURCE(fd) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(bytes) - Z_PARAM_STRING(allowed_tags, allowed_tags_len) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); - - PHP_STREAM_TO_ZVAL(stream, fd); - - if (ZEND_NUM_ARGS() >= 2) { - if (bytes <= 0) { - php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0"); - RETURN_FALSE; - } - - len = (size_t) bytes; - buf = safe_emalloc(sizeof(char), (len + 1), 0); - /*needed because recv doesn't set null char at end*/ - memset(buf, 0, len + 1); - } - - if ((retval = php_stream_get_line(stream, buf, len, &actual_len)) == NULL) { - if (buf != NULL) { - efree(buf); - } - RETURN_FALSE; - } - - retval_len = php_strip_tags(retval, actual_len, &stream->fgetss_state, allowed_tags, allowed_tags_len); - - // TODO: avoid reallocation ??? - RETVAL_STRINGL(retval, retval_len); - efree(retval); -} -/* }}} */ - /* {{{ proto mixed fscanf(resource stream, string format [, string ...]) Implements a mostly ANSI compatible fscanf() */ PHP_FUNCTION(fscanf) @@ -1515,7 +1466,7 @@ PHP_FUNCTION(unlink) Z_PARAM_PATH(filename, filename_len) Z_PARAM_OPTIONAL Z_PARAM_RESOURCE_EX(zcontext, 1, 0) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); context = php_stream_context_from_zval(zcontext, 0); @@ -1986,7 +1937,7 @@ PHPAPI ssize_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, cha } /* }}} */ -/* {{{ proto array fgetcsv(resource fp [,int length [, string delimiter [, string enclosure [, string escape]]]]) +/* {{{ proto array|false fgetcsv(resource fp [,int length [, string delimiter [, string enclosure [, string escape]]]]) Get line from file pointer and parse for CSV fields */ PHP_FUNCTION(fgetcsv) { @@ -1994,8 +1945,6 @@ PHP_FUNCTION(fgetcsv) char enclosure = '"'; /* allow this to be set as parameter */ int escape = (unsigned char) '\\'; - /* first section exactly as php_fgetss */ - zend_long len = 0; size_t buf_len; char *buf; @@ -2349,7 +2298,7 @@ out: /* }}} */ #if HAVE_REALPATH || defined(ZTS) -/* {{{ proto string realpath(string path) +/* {{{ proto string|false realpath(string path) Return the resolved path */ PHP_FUNCTION(realpath) { diff --git a/ext/standard/file.h b/ext/standard/file.h index a414f722fd..d981d5393d 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -35,7 +35,6 @@ PHPAPI PHP_FUNCTION(fread); PHPAPI PHP_FUNCTION(fgetc); PHPAPI PHP_FUNCTION(fgets); PHP_FUNCTION(fscanf); -PHPAPI PHP_FUNCTION(fgetss); PHP_FUNCTION(fgetcsv); PHP_FUNCTION(fputcsv); PHPAPI PHP_FUNCTION(fwrite); diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index bf2bc752b0..91420bbe6e 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -178,7 +178,7 @@ static int php_disk_total_space(char *path, double *space) /* {{{ */ /* }}} */ /* }}} */ -/* {{{ proto float disk_total_space(string path) +/* {{{ proto float|false disk_total_space(string path) Get total disk space for filesystem that path is on */ PHP_FUNCTION(disk_total_space) { @@ -273,7 +273,7 @@ static int php_disk_free_space(char *path, double *space) /* {{{ */ /* }}} */ /* }}} */ -/* {{{ proto float disk_free_space(string path) +/* {{{ proto float|false disk_free_space(string path) Get free disk space for filesystem that path is on */ PHP_FUNCTION(disk_free_space) { diff --git a/ext/standard/filters.c b/ext/standard/filters.c index 83fcf2dcbf..5df7c623fd 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -166,136 +166,6 @@ static const php_stream_filter_factory strfilter_tolower_factory = { }; /* }}} */ -/* {{{ strip_tags filter implementation */ -typedef struct _php_strip_tags_filter { - const char *allowed_tags; - int allowed_tags_len; - uint8_t state; - uint8_t persistent; -} php_strip_tags_filter; - -static int php_strip_tags_filter_ctor(php_strip_tags_filter *inst, zend_string *allowed_tags, int persistent) -{ - if (allowed_tags != NULL) { - if (NULL == (inst->allowed_tags = pemalloc(ZSTR_LEN(allowed_tags) + 1, persistent))) { - return FAILURE; - } - memcpy((char *)inst->allowed_tags, ZSTR_VAL(allowed_tags), ZSTR_LEN(allowed_tags) + 1); - inst->allowed_tags_len = (int)ZSTR_LEN(allowed_tags); - } else { - inst->allowed_tags = NULL; - } - inst->state = 0; - inst->persistent = persistent; - - return SUCCESS; -} - -static void php_strip_tags_filter_dtor(php_strip_tags_filter *inst) -{ - if (inst->allowed_tags != NULL) { - pefree((void *)inst->allowed_tags, inst->persistent); - } -} - -static php_stream_filter_status_t strfilter_strip_tags_filter( - php_stream *stream, - php_stream_filter *thisfilter, - php_stream_bucket_brigade *buckets_in, - php_stream_bucket_brigade *buckets_out, - size_t *bytes_consumed, - int flags - ) -{ - php_stream_bucket *bucket; - size_t consumed = 0; - php_strip_tags_filter *inst = (php_strip_tags_filter *) Z_PTR(thisfilter->abstract); - - while (buckets_in->head) { - bucket = php_stream_bucket_make_writeable(buckets_in->head); - consumed = bucket->buflen; - - bucket->buflen = php_strip_tags(bucket->buf, bucket->buflen, &(inst->state), inst->allowed_tags, inst->allowed_tags_len); - - php_stream_bucket_append(buckets_out, bucket); - } - - if (bytes_consumed) { - *bytes_consumed = consumed; - } - - return PSFS_PASS_ON; -} - -static void strfilter_strip_tags_dtor(php_stream_filter *thisfilter) -{ - assert(Z_PTR(thisfilter->abstract) != NULL); - - php_strip_tags_filter_dtor((php_strip_tags_filter *)Z_PTR(thisfilter->abstract)); - - pefree(Z_PTR(thisfilter->abstract), ((php_strip_tags_filter *)Z_PTR(thisfilter->abstract))->persistent); -} - -static const php_stream_filter_ops strfilter_strip_tags_ops = { - strfilter_strip_tags_filter, - strfilter_strip_tags_dtor, - "string.strip_tags" -}; - -static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zval *filterparams, uint8_t persistent) -{ - php_strip_tags_filter *inst; - php_stream_filter *filter = NULL; - zend_string *allowed_tags = NULL; - - php_error_docref(NULL, E_DEPRECATED, "The string.strip_tags filter is deprecated"); - - if (filterparams != NULL) { - if (Z_TYPE_P(filterparams) == IS_ARRAY) { - smart_str tags_ss = {0}; - zval *tmp; - - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(filterparams), tmp) { - convert_to_string_ex(tmp); - smart_str_appendc(&tags_ss, '<'); - smart_str_append(&tags_ss, Z_STR_P(tmp)); - smart_str_appendc(&tags_ss, '>'); - } ZEND_HASH_FOREACH_END(); - smart_str_0(&tags_ss); - allowed_tags = tags_ss.s; - } else { - allowed_tags = zval_get_string(filterparams); - } - - /* Exception during string conversion. */ - if (EG(exception)) { - if (allowed_tags) { - zend_string_release(allowed_tags); - } - return NULL; - } - } - - inst = pemalloc(sizeof(php_strip_tags_filter), persistent); - if (php_strip_tags_filter_ctor(inst, allowed_tags, persistent) == SUCCESS) { - filter = php_stream_filter_alloc(&strfilter_strip_tags_ops, inst, persistent); - } else { - pefree(inst, persistent); - } - - if (allowed_tags) { - zend_string_release(allowed_tags); - } - - return filter; -} - -static const php_stream_filter_factory strfilter_strip_tags_factory = { - strfilter_strip_tags_create -}; - -/* }}} */ - /* {{{ base64 / quoted_printable stream filter implementation */ typedef enum _php_conv_err_t { @@ -2044,7 +1914,6 @@ static const struct { { &strfilter_rot13_ops, &strfilter_rot13_factory }, { &strfilter_toupper_ops, &strfilter_toupper_factory }, { &strfilter_tolower_ops, &strfilter_tolower_factory }, - { &strfilter_strip_tags_ops, &strfilter_strip_tags_factory }, { &strfilter_convert_ops, &strfilter_convert_factory }, { &consumed_filter_ops, &consumed_filter_factory }, { &chunked_filter_ops, &chunked_filter_factory }, diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 4ee68adefa..fc35eda5ae 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -662,7 +662,7 @@ php_formatted_print_get_array(zval *array, int *argc) } /* }}} */ -/* {{{ proto string sprintf(string format [, mixed arg1 [, mixed ...]]) +/* {{{ proto string|false sprintf(string format [, mixed arg1 [, mixed ...]]) Return a formatted string */ PHP_FUNCTION(user_sprintf) { @@ -673,7 +673,7 @@ PHP_FUNCTION(user_sprintf) ZEND_PARSE_PARAMETERS_START(1, -1) Z_PARAM_ZVAL(format) Z_PARAM_VARIADIC('*', args, argc) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); result = php_formatted_print(format, args, argc); if (result == NULL) { @@ -683,7 +683,7 @@ PHP_FUNCTION(user_sprintf) } /* }}} */ -/* {{{ proto string vsprintf(string format, array args) +/* {{{ proto string|false vsprintf(string format, array args) Return a formatted string */ PHP_FUNCTION(vsprintf) { @@ -694,7 +694,7 @@ PHP_FUNCTION(vsprintf) ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(format) Z_PARAM_ZVAL(array) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); args = php_formatted_print_get_array(array, &argc); @@ -707,7 +707,7 @@ PHP_FUNCTION(vsprintf) } /* }}} */ -/* {{{ proto int printf(string format [, mixed arg1 [, mixed ...]]) +/* {{{ proto int|false printf(string format [, mixed arg1 [, mixed ...]]) Output a formatted string */ PHP_FUNCTION(user_printf) { @@ -719,7 +719,7 @@ PHP_FUNCTION(user_printf) ZEND_PARSE_PARAMETERS_START(1, -1) Z_PARAM_ZVAL(format) Z_PARAM_VARIADIC('*', args, argc) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); result = php_formatted_print(format, args, argc); if (result == NULL) { @@ -731,7 +731,7 @@ PHP_FUNCTION(user_printf) } /* }}} */ -/* {{{ proto int vprintf(string format, array args) +/* {{{ proto int|false vprintf(string format, array args) Output a formatted string */ PHP_FUNCTION(vprintf) { @@ -743,7 +743,7 @@ PHP_FUNCTION(vprintf) ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(format) Z_PARAM_ZVAL(array) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); args = php_formatted_print_get_array(array, &argc); @@ -758,7 +758,7 @@ PHP_FUNCTION(vprintf) } /* }}} */ -/* {{{ proto int fprintf(resource stream, string format [, mixed arg1 [, mixed ...]]) +/* {{{ proto int|false fprintf(resource stream, string format [, mixed arg1 [, mixed ...]]) Output a formatted string into a stream */ PHP_FUNCTION(fprintf) { @@ -775,7 +775,7 @@ PHP_FUNCTION(fprintf) Z_PARAM_RESOURCE(arg1) Z_PARAM_ZVAL(format) Z_PARAM_VARIADIC('*', args, argc) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); php_stream_from_zval(stream, arg1); @@ -791,7 +791,7 @@ PHP_FUNCTION(fprintf) } /* }}} */ -/* {{{ proto int vfprintf(resource stream, string format, array args) +/* {{{ proto int|false vfprintf(resource stream, string format, array args) Output a formatted string into a stream */ PHP_FUNCTION(vfprintf) { @@ -808,7 +808,7 @@ PHP_FUNCTION(vfprintf) Z_PARAM_RESOURCE(arg1) Z_PARAM_ZVAL(format) Z_PARAM_ZVAL(array) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); php_stream_from_zval(stream, arg1); diff --git a/ext/standard/hrtime.c b/ext/standard/hrtime.c index 2a6707f7bd..c6e48d075e 100644 --- a/ext/standard/hrtime.c +++ b/ext/standard/hrtime.c @@ -183,7 +183,7 @@ PHP_FUNCTION(hrtime) add_next_index_long(return_value, (zend_long)(t % (php_hrtime_t)NANO_IN_SEC)); } #else - RETURN_FALSE + RETURN_FALSE; #endif } /* }}} */ diff --git a/ext/standard/http.c b/ext/standard/http.c index dbd71add81..201fc027f8 100644 --- a/ext/standard/http.c +++ b/ext/standard/http.c @@ -230,7 +230,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, } /* }}} */ -/* {{{ proto string http_build_query(mixed formdata [, string prefix [, string arg_separator [, int enc_type]]]) +/* {{{ proto string|false http_build_query(mixed formdata [, string prefix [, string arg_separator [, int enc_type]]]) Generates a form-encoded query string from an associative array or object. */ PHP_FUNCTION(http_build_query) { @@ -246,7 +246,7 @@ PHP_FUNCTION(http_build_query) Z_PARAM_STRING(prefix, prefix_len) Z_PARAM_STRING(arg_sep, arg_sep_len) Z_PARAM_LONG(enc_type) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); if (php_url_encode_hash_ex(HASH_OF(formdata), &formstr, prefix, prefix_len, NULL, 0, NULL, 0, (Z_TYPE_P(formdata) == IS_OBJECT ? formdata : NULL), arg_sep, (int)enc_type) == FAILURE) { if (formstr.s) { diff --git a/ext/standard/image.c b/ext/standard/image.c index aaaf81ae9e..11b4e727e6 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -1223,7 +1223,7 @@ PHP_FUNCTION(image_type_to_mime_type) } /* }}} */ -/* {{{ proto string image_type_to_extension(int imagetype [, bool include_dot]) +/* {{{ proto string|false image_type_to_extension(int imagetype [, bool include_dot]) Get file extension for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype */ PHP_FUNCTION(image_type_to_extension) { @@ -1510,7 +1510,7 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) { } if (!stream) { - RETURN_FALSE; + RETURN_FALSE; } php_getimagesize_from_stream(stream, info, INTERNAL_FUNCTION_PARAM_PASSTHRU); @@ -1518,7 +1518,7 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) { } /* }}} */ -/* {{{ proto array getimagesize(string imagefile [, array info]) +/* {{{ proto array|false getimagesize(string imagefile [, array info]) Get the size of an image as 4-element array */ PHP_FUNCTION(getimagesize) { @@ -1526,7 +1526,7 @@ PHP_FUNCTION(getimagesize) } /* }}} */ -/* {{{ proto array getimagesizefromstring(string data [, array info]) +/* {{{ proto array|false getimagesizefromstring(string data [, array info]) Get the size of an image as 4-element array */ PHP_FUNCTION(getimagesizefromstring) { diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index f38fae5f53..0df21e37d7 100644 --- a/ext/standard/incomplete_class.c +++ b/ext/standard/incomplete_class.c @@ -32,7 +32,7 @@ static zend_object_handlers php_incomplete_object_handlers; /* {{{ incomplete_class_message */ -static void incomplete_class_message(zval *object, int error_type) +static void incomplete_class_message(zend_object *object, int error_type) { zend_string *class_name; @@ -47,7 +47,7 @@ static void incomplete_class_message(zval *object, int error_type) } /* }}} */ -static zval *incomplete_class_get_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */ +static zval *incomplete_class_get_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */ { incomplete_class_message(object, E_NOTICE); @@ -60,27 +60,27 @@ static zval *incomplete_class_get_property(zval *object, zval *member, int type, } /* }}} */ -static zval *incomplete_class_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */ +static zval *incomplete_class_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) /* {{{ */ { incomplete_class_message(object, E_NOTICE); return value; } /* }}} */ -static zval *incomplete_class_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */ +static zval *incomplete_class_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) /* {{{ */ { incomplete_class_message(object, E_NOTICE); return &EG(error_zval); } /* }}} */ -static void incomplete_class_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */ +static void incomplete_class_unset_property(zend_object *object, zend_string *member, void **cache_slot) /* {{{ */ { incomplete_class_message(object, E_NOTICE); } /* }}} */ -static int incomplete_class_has_property(zval *object, zval *member, int check_empty, void **cache_slot) /* {{{ */ +static int incomplete_class_has_property(zend_object *object, zend_string *member, int check_empty, void **cache_slot) /* {{{ */ { incomplete_class_message(object, E_NOTICE); return 0; @@ -89,10 +89,7 @@ static int incomplete_class_has_property(zval *object, zval *member, int check_e static zend_function *incomplete_class_get_method(zend_object **object, zend_string *method, const zval *key) /* {{{ */ { - zval zobject; - - ZVAL_OBJ(&zobject, *object); - incomplete_class_message(&zobject, E_ERROR); + incomplete_class_message(*object, E_ERROR); return NULL; } /* }}} */ @@ -132,15 +129,14 @@ PHPAPI zend_class_entry *php_create_incomplete_class(void) /* {{{ php_lookup_class_name */ -PHPAPI zend_string *php_lookup_class_name(zval *object) +PHPAPI zend_string *php_lookup_class_name(zend_object *object) { - zval *val; - HashTable *object_properties; - - object_properties = Z_OBJPROP_P(object); + if (object->properties) { + zval *val = zend_hash_str_find(object->properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1); - if ((val = zend_hash_str_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1)) != NULL && Z_TYPE_P(val) == IS_STRING) { - return zend_string_copy(Z_STR_P(val)); + if (val != NULL && Z_TYPE_P(val) == IS_STRING) { + return zend_string_copy(Z_STR_P(val)); + } } return NULL; diff --git a/ext/standard/info.c b/ext/standard/info.c index 1e58b31a0f..ff7ead6460 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -770,7 +770,7 @@ PHPAPI ZEND_COLD void php_print_info(int flag) } if (flag & PHP_INFO_GENERAL) { - char *zend_version = get_zend_version(); + const char *zend_version = get_zend_version(); char temp_api[10]; php_uname = php_get_uname('a'); @@ -1245,7 +1245,7 @@ void register_phpinfo_constants(INIT_FUNC_ARGS) } /* }}} */ -/* {{{ proto void phpinfo([int what]) +/* {{{ proto bool phpinfo([int what]) Output a page of useful information about PHP and the current request */ PHP_FUNCTION(phpinfo) { @@ -1266,7 +1266,7 @@ PHP_FUNCTION(phpinfo) /* }}} */ -/* {{{ proto string phpversion([string extension]) +/* {{{ proto string|false phpversion([string extension]) Return the current PHP version */ PHP_FUNCTION(phpversion) { @@ -1291,7 +1291,7 @@ PHP_FUNCTION(phpversion) } /* }}} */ -/* {{{ proto void phpcredits([int flag]) +/* {{{ proto bool phpcredits([int flag]) Prints the list of people who've contributed to the PHP project */ PHP_FUNCTION(phpcredits) { @@ -1307,7 +1307,7 @@ PHP_FUNCTION(phpcredits) } /* }}} */ -/* {{{ proto string php_sapi_name(void) +/* {{{ proto string|false php_sapi_name(void) Return the current SAPI module name */ PHP_FUNCTION(php_sapi_name) { @@ -1341,7 +1341,7 @@ PHP_FUNCTION(php_uname) /* }}} */ -/* {{{ proto string php_ini_scanned_files(void) +/* {{{ proto string|false php_ini_scanned_files(void) Return comma-separated string of .ini files parsed from the additional ini dir */ PHP_FUNCTION(php_ini_scanned_files) { @@ -1357,7 +1357,7 @@ PHP_FUNCTION(php_ini_scanned_files) } /* }}} */ -/* {{{ proto string php_ini_loaded_file(void) +/* {{{ proto string|false php_ini_loaded_file(void) Return the actual loaded ini filename */ PHP_FUNCTION(php_ini_loaded_file) { diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index f3c17dadd9..f907da694e 100644 --- a/ext/standard/iptc.c +++ b/ext/standard/iptc.c @@ -180,7 +180,7 @@ static int php_iptc_next_marker(FILE *fp, int spool, unsigned char **spoolbuf) static char psheader[] = "\xFF\xED\0\0Photoshop 3.0\08BIM\x04\x04\0\0\0\0"; -/* {{{ proto array iptcembed(string iptcdata, string jpeg_file_name [, int spool]) +/* {{{ proto string|false iptcembed(string iptcdata, string jpeg_file_name [, int spool]) Embed binary IPTC data into a JPEG image. */ PHP_FUNCTION(iptcembed) { @@ -311,7 +311,7 @@ PHP_FUNCTION(iptcembed) } /* }}} */ -/* {{{ proto array iptcparse(string iptcdata) +/* {{{ proto array|false iptcparse(string iptcdata) Parse binary IPTC-data into associative array */ PHP_FUNCTION(iptcparse) { diff --git a/ext/standard/link.c b/ext/standard/link.c index 1117049344..c723c37654 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -62,7 +62,7 @@ #define VOLUME_NAME_DOS 0x0 #endif -/* {{{ proto string readlink(string filename) +/* {{{ proto string|false readlink(string filename) Return the target of a symbolic link */ PHP_FUNCTION(readlink) { @@ -96,7 +96,7 @@ PHP_FUNCTION(readlink) } /* }}} */ -/* {{{ proto int linkinfo(string filename) +/* {{{ proto int|false linkinfo(string filename) Returns the st_dev field of the UNIX C stat structure describing the link */ PHP_FUNCTION(linkinfo) { @@ -130,7 +130,7 @@ PHP_FUNCTION(linkinfo) } /* }}} */ -/* {{{ proto int symlink(string target, string link) +/* {{{ proto bool symlink(string target, string link) Create a symbolic link */ PHP_FUNCTION(symlink) { @@ -189,7 +189,7 @@ PHP_FUNCTION(symlink) } /* }}} */ -/* {{{ proto int link(string target, string link) +/* {{{ proto bool link(string target, string link) Create a hard link */ PHP_FUNCTION(link) { diff --git a/ext/standard/mail.c b/ext/standard/mail.c index c1a21c4059..ef6bd1da44 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -275,7 +275,7 @@ PHPAPI zend_string *php_mail_build_headers(zval *headers) } -/* {{{ proto int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]]) +/* {{{ proto bool mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]]) Send an email message */ PHP_FUNCTION(mail) { diff --git a/ext/standard/math.c b/ext/standard/math.c index ba7e3944aa..e224ac6c7e 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -283,18 +283,16 @@ static double php_expm1(double x) } /* }}}*/ -/* {{{ proto int abs(int number) +/* {{{ proto int|float abs(int number) Return the absolute value of the number */ PHP_FUNCTION(abs) { zval *value; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(value) + Z_PARAM_NUMBER(value) ZEND_PARSE_PARAMETERS_END(); - convert_scalar_to_number_ex(value); - if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(fabs(Z_DVAL_P(value))); } else if (Z_TYPE_P(value) == IS_LONG) { @@ -303,8 +301,9 @@ PHP_FUNCTION(abs) } else { RETURN_LONG(Z_LVAL_P(value) < 0 ? -Z_LVAL_P(value) : Z_LVAL_P(value)); } + } else { + ZEND_ASSERT(0 && "Unexpected type"); } - RETURN_FALSE; } /* }}} */ @@ -315,17 +314,16 @@ PHP_FUNCTION(ceil) zval *value; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(value) + Z_PARAM_NUMBER(value) ZEND_PARSE_PARAMETERS_END(); - convert_scalar_to_number_ex(value); - if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(ceil(Z_DVAL_P(value))); } else if (Z_TYPE_P(value) == IS_LONG) { RETURN_DOUBLE(zval_get_double(value)); + } else { + ZEND_ASSERT(0 && "Unexpected type"); } - RETURN_FALSE; } /* }}} */ @@ -336,21 +334,20 @@ PHP_FUNCTION(floor) zval *value; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(value) + Z_PARAM_NUMBER(value) ZEND_PARSE_PARAMETERS_END(); - convert_scalar_to_number_ex(value); - if (Z_TYPE_P(value) == IS_DOUBLE) { RETURN_DOUBLE(floor(Z_DVAL_P(value))); } else if (Z_TYPE_P(value) == IS_LONG) { RETURN_DOUBLE(zval_get_double(value)); + } else { + ZEND_ASSERT(0 && "Unexpected type"); } - RETURN_FALSE; } /* }}} */ -/* {{{ proto float round(float number [, int precision [, int mode]]) +/* {{{ proto float|false round(float number [, int precision [, int mode]]) Returns the number rounded to specified precision */ PHP_FUNCTION(round) { @@ -683,7 +680,7 @@ PHP_FUNCTION(log1p) } /* }}} */ -/* {{{ proto float log(float number, [float base]) +/* {{{ proto float|false log(float number, [float base]) Returns the natural logarithm of the number, or the base log if base is specified */ PHP_FUNCTION(log) { @@ -846,7 +843,7 @@ PHPAPI zend_long _php_math_basetolong(zval *arg, int base) /* * Convert a string representation of a base(2-36) number to a zval. */ -PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) +PHPAPI void _php_math_basetozval(zend_string *str, int base, zval *ret) { zend_long num = 0; double fnum = 0; @@ -856,11 +853,8 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) int cutlim; int invalidchars = 0; - if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) { - return FAILURE; - } - s = Z_STRVAL_P(arg); - e = s + Z_STRLEN_P(arg); + s = ZSTR_VAL(str); + e = s + ZSTR_LEN(str); /* Skip leading whitespace */ while (s < e && isspace(*s)) s++; @@ -920,7 +914,6 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret) } else { ZVAL_LONG(ret, num); } - return SUCCESS; } /* }}} */ @@ -994,54 +987,45 @@ PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base) } /* }}} */ -/* {{{ proto int bindec(string binary_number) +/* {{{ proto int|float bindec(string binary_number) Returns the decimal equivalent of the binary number */ PHP_FUNCTION(bindec) { - zval *arg; + zend_string *arg; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(arg) + Z_PARAM_STR(arg) ZEND_PARSE_PARAMETERS_END(); - convert_to_string_ex(arg); - if (_php_math_basetozval(arg, 2, return_value) == FAILURE) { - RETURN_FALSE; - } + _php_math_basetozval(arg, 2, return_value); } /* }}} */ -/* {{{ proto int hexdec(string hexadecimal_number) +/* {{{ proto int|flat hexdec(string hexadecimal_number) Returns the decimal equivalent of the hexadecimal number */ PHP_FUNCTION(hexdec) { - zval *arg; + zend_string *arg; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(arg) + Z_PARAM_STR(arg) ZEND_PARSE_PARAMETERS_END(); - convert_to_string_ex(arg); - if (_php_math_basetozval(arg, 16, return_value) == FAILURE) { - RETURN_FALSE; - } + _php_math_basetozval(arg, 16, return_value); } /* }}} */ -/* {{{ proto int octdec(string octal_number) +/* {{{ proto int|float octdec(string octal_number) Returns the decimal equivalent of an octal string */ PHP_FUNCTION(octdec) { - zval *arg; + zend_string *arg; ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ZVAL(arg) + Z_PARAM_STR(arg) ZEND_PARSE_PARAMETERS_END(); - convert_to_string_ex(arg); - if (_php_math_basetozval(arg, 8, return_value) == FAILURE) { - RETURN_FALSE; - } + _php_math_basetozval(arg, 8, return_value); } /* }}} */ @@ -1096,7 +1080,7 @@ PHP_FUNCTION(dechex) } /* }}} */ -/* {{{ proto string base_convert(string number, int frombase, int tobase) +/* {{{ proto string|false base_convert(string number, int frombase, int tobase) Converts a number in a string from any base <= 36 to any base <= 36 */ PHP_FUNCTION(base_convert) { @@ -1123,9 +1107,7 @@ PHP_FUNCTION(base_convert) RETURN_FALSE; } - if(_php_math_basetozval(number, (int)frombase, &temp) == FAILURE) { - RETURN_FALSE; - } + _php_math_basetozval(Z_STR_P(number), (int)frombase, &temp); result = _php_math_zvaltobase(&temp, (int)tobase); RETVAL_STR(result); } diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c index 16fd149571..ee2feac7c0 100644 --- a/ext/standard/metaphone.c +++ b/ext/standard/metaphone.c @@ -25,7 +25,7 @@ static int metaphone(unsigned char *word, size_t word_len, zend_long max_phonemes, zend_string **phoned_word, int traditional); -/* {{{ proto string metaphone(string text[, int phones]) +/* {{{ proto string|false metaphone(string text[, int phones]) Break english phrases down into their phonemes */ PHP_FUNCTION(metaphone) { diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c index 9bd45e188d..73a34e5fdf 100644 --- a/ext/standard/microtime.c +++ b/ext/standard/microtime.c @@ -100,7 +100,7 @@ PHP_FUNCTION(gettimeofday) /* }}} */ #ifdef HAVE_GETRUSAGE -/* {{{ proto array getrusage([int who]) +/* {{{ proto array|false getrusage([int who]) Returns an array of usage statistics */ PHP_FUNCTION(getrusage) { diff --git a/ext/standard/pack.c b/ext/standard/pack.c index 3c0dc009f1..898251dae8 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -715,7 +715,7 @@ static zend_long php_unpack(char *data, size_t size, int issigned, int *map) * Implemented formats are Z, A, a, h, H, c, C, s, S, i, I, l, L, n, N, q, Q, J, P, f, d, x, X, @. * Added g, G for little endian float and big endian float, added e, E for little endian double and big endian double. */ -/* {{{ proto array unpack(string format, string input) +/* {{{ proto array|false unpack(string format, string input) Unpack binary string into named array elements according to format argument */ PHP_FUNCTION(unpack) { diff --git a/ext/standard/password.c b/ext/standard/password.c index a12590c0e0..0db764e533 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -52,19 +52,6 @@ void php_password_algo_unregister(const char *ident) { zend_hash_str_del(&php_password_algos, ident, strlen(ident)); } -static int php_password_salt_is_alphabet(const char *str, const size_t len) /* {{{ */ -{ - size_t i = 0; - - for (i = 0; i < len; i++) { - if (!((str[i] >= 'A' && str[i] <= 'Z') || (str[i] >= 'a' && str[i] <= 'z') || (str[i] >= '0' && str[i] <= '9') || str[i] == '.' || str[i] == '/')) { - return FAILURE; - } - } - return SUCCESS; -} -/* }}} */ - static int php_password_salt_to64(const char *str, const size_t str_len, const size_t out_len, char *ret) /* {{{ */ { size_t pos = 0; @@ -123,68 +110,11 @@ static zend_string* php_password_make_salt(size_t length) /* {{{ */ /* }}} */ static zend_string* php_password_get_salt(zval *unused_, size_t required_salt_len, HashTable *options) { - zend_string *buffer; - zval *option_buffer; - - if (!options || !(option_buffer = zend_hash_str_find(options, "salt", sizeof("salt") - 1))) { - return php_password_make_salt(required_salt_len); - } - - php_error_docref(NULL, E_DEPRECATED, "Use of the 'salt' option to password_hash is deprecated"); - - switch (Z_TYPE_P(option_buffer)) { - case IS_STRING: - buffer = zend_string_copy(Z_STR_P(option_buffer)); - break; - case IS_LONG: - case IS_DOUBLE: - case IS_OBJECT: - buffer = zval_try_get_string(option_buffer); - if (UNEXPECTED(!buffer)) { - return NULL; - } - break; - case IS_FALSE: - case IS_TRUE: - case IS_NULL: - case IS_RESOURCE: - case IS_ARRAY: - default: - php_error_docref(NULL, E_WARNING, "Non-string salt parameter supplied"); - return NULL; - } - - /* XXX all the crypt related APIs work with int for string length. - That should be revised for size_t and then we maybe don't require - the > INT_MAX check. */ - if (ZEND_SIZE_T_INT_OVFL(ZSTR_LEN(buffer))) { - php_error_docref(NULL, E_WARNING, "Supplied salt is too long"); - zend_string_release_ex(buffer, 0); - return NULL; - } - - if (ZSTR_LEN(buffer) < required_salt_len) { - php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd expecting %zd", ZSTR_LEN(buffer), required_salt_len); - zend_string_release_ex(buffer, 0); - return NULL; + if (options && zend_hash_str_exists(options, "salt", sizeof("salt") - 1)) { + php_error_docref(NULL, E_WARNING, "The 'salt' option is no longer supported. The provided salt has been been ignored"); } - if (php_password_salt_is_alphabet(ZSTR_VAL(buffer), ZSTR_LEN(buffer)) == FAILURE) { - zend_string *salt = zend_string_alloc(required_salt_len, 0); - if (php_password_salt_to64(ZSTR_VAL(buffer), ZSTR_LEN(buffer), required_salt_len, ZSTR_VAL(salt)) == FAILURE) { - php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd", ZSTR_LEN(buffer)); - zend_string_release_ex(salt, 0); - zend_string_release_ex(buffer, 0); - return NULL; - } - zend_string_release_ex(buffer, 0); - return salt; - } else { - zend_string *salt = zend_string_alloc(required_salt_len, 0); - memcpy(ZSTR_VAL(salt), ZSTR_VAL(buffer), required_salt_len); - zend_string_release_ex(buffer, 0); - return salt; - } + return php_password_make_salt(required_salt_len); } /* bcrypt implementation */ @@ -632,7 +562,7 @@ const php_password_algo* php_password_algo_identify_ex(const zend_string* hash, return (!algo || (algo->valid && !algo->valid(hash))) ? default_algo : algo; } -/* {{{ proto array password_get_info(string $hash) +/* {{{ proto array|null password_get_info(string $hash) Retrieves information about a given hash */ PHP_FUNCTION(password_get_info) { @@ -715,14 +645,14 @@ PHP_FUNCTION(password_verify) ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(password) Z_PARAM_STR(hash) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); algo = php_password_algo_identify(hash); RETURN_BOOL(algo && (!algo->verify || algo->verify(password, hash))); } /* }}} */ -/* {{{ proto string password_hash(string password, mixed algo[, array options = array()]) +/* {{{ proto string|null password_hash(string password, mixed algo[, array options = array()]) Hash a password */ PHP_FUNCTION(password_hash) { diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h index d768f25bdb..eeb4461965 100644 --- a/ext/standard/php_incomplete_class.h +++ b/ext/standard/php_incomplete_class.h @@ -27,7 +27,7 @@ #define PHP_SET_CLASS_ATTRIBUTES(struc) \ /* OBJECTS_FIXME: Fix for new object model */ \ if (Z_OBJCE_P(struc) == BG(incomplete_class)) { \ - class_name = php_lookup_class_name(struc); \ + class_name = php_lookup_class_name(Z_OBJ_P(struc)); \ if (!class_name) { \ class_name = zend_string_init(INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1, 0); \ } \ @@ -51,7 +51,7 @@ extern "C" { #endif PHPAPI zend_class_entry *php_create_incomplete_class(void); -PHPAPI zend_string *php_lookup_class_name(zval *object); +PHPAPI zend_string *php_lookup_class_name(zend_object *object); PHPAPI void php_store_class_name(zval *object, const char *name, size_t len); #ifdef __cplusplus diff --git a/ext/standard/php_math.h b/ext/standard/php_math.h index 791a01c02d..fd25cfb7f2 100644 --- a/ext/standard/php_math.h +++ b/ext/standard/php_math.h @@ -25,7 +25,7 @@ PHPAPI zend_string *_php_math_number_format(double, int, char, char); PHPAPI zend_string *_php_math_number_format_ex(double, int, char *, size_t, char *, size_t); PHPAPI zend_string * _php_math_longtobase(zval *arg, int base); PHPAPI zend_long _php_math_basetolong(zval *arg, int base); -PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret); +PHPAPI void _php_math_basetozval(zend_string *str, int base, zval *ret); PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base); PHP_FUNCTION(sin); diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index d99d008771..fde48033c5 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -244,7 +244,7 @@ PHP_FUNCTION(proc_terminate) Z_PARAM_RESOURCE(zproc) Z_PARAM_OPTIONAL Z_PARAM_LONG(sig_no) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); if ((proc = (struct php_process_handle *)zend_fetch_resource(Z_RES_P(zproc), "process", le_proc_open)) == NULL) { RETURN_FALSE; @@ -266,7 +266,7 @@ PHP_FUNCTION(proc_terminate) } /* }}} */ -/* {{{ proto int proc_close(resource process) +/* {{{ proto int|false proc_close(resource process) close a process opened by proc_open */ PHP_FUNCTION(proc_close) { @@ -275,7 +275,7 @@ PHP_FUNCTION(proc_close) ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_RESOURCE(zproc) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); if ((proc = (struct php_process_handle *)zend_fetch_resource(Z_RES_P(zproc), "process", le_proc_open)) == NULL) { RETURN_FALSE; @@ -288,7 +288,7 @@ PHP_FUNCTION(proc_close) } /* }}} */ -/* {{{ proto array proc_get_status(resource process) +/* {{{ proto array|false proc_get_status(resource process) get information about a process opened by proc_open */ PHP_FUNCTION(proc_get_status) { @@ -305,7 +305,7 @@ PHP_FUNCTION(proc_get_status) ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_RESOURCE(zproc) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); if ((proc = (struct php_process_handle *)zend_fetch_resource(Z_RES_P(zproc), "process", le_proc_open)) == NULL) { RETURN_FALSE; @@ -470,7 +470,7 @@ static char *create_win_command_from_args(HashTable *args) { } #endif -/* {{{ proto resource proc_open(string|array command, array descriptorspec, array &pipes [, string cwd [, array env [, array other_options]]]) +/* {{{ proto resource|false proc_open(string|array command, array descriptorspec, array &pipes [, string cwd [, array env [, array other_options]]]) Run a process with more control over it's file descriptors */ PHP_FUNCTION(proc_open) { diff --git a/ext/standard/random.c b/ext/standard/random.c index 2ab0e8ed80..c2079f64e9 100644 --- a/ext/standard/random.c +++ b/ext/standard/random.c @@ -202,7 +202,7 @@ PHP_FUNCTION(random_bytes) zend_long size; zend_string *bytes; - ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 1) + ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(size) ZEND_PARSE_PARAMETERS_END(); @@ -276,7 +276,7 @@ PHP_FUNCTION(random_int) zend_long max; zend_long result; - ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 2, 2) + ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(min) Z_PARAM_LONG(max) ZEND_PARSE_PARAMETERS_END(); diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 24d8357d7f..cd4c07e549 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -49,7 +49,7 @@ static php_stream_context *decode_context_param(zval *contextresource); /* Streams based network functions */ #if HAVE_SOCKETPAIR -/* {{{ proto array stream_socket_pair(int domain, int type, int protocol) +/* {{{ proto array|false stream_socket_pair(int domain, int type, int protocol) Creates a pair of connected, indistinguishable socket streams */ PHP_FUNCTION(stream_socket_pair) { @@ -61,7 +61,7 @@ PHP_FUNCTION(stream_socket_pair) Z_PARAM_LONG(domain) Z_PARAM_LONG(type) Z_PARAM_LONG(protocol) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); if (0 != socketpair((int)domain, (int)type, (int)protocol, pair)) { char errbuf[256]; @@ -86,7 +86,7 @@ PHP_FUNCTION(stream_socket_pair) /* }}} */ #endif -/* {{{ proto resource stream_socket_client(string remoteaddress [, int &errcode [, string &errstring [, double timeout [, int flags [, resource context]]]]]) +/* {{{ proto resource|false stream_socket_client(string remoteaddress [, int &errcode [, string &errstring [, double timeout [, int flags [, resource context]]]]]) Open a client connection to a remote address */ PHP_FUNCTION(stream_socket_client) { @@ -112,7 +112,7 @@ PHP_FUNCTION(stream_socket_client) Z_PARAM_DOUBLE(timeout) Z_PARAM_LONG(flags) Z_PARAM_RESOURCE(zcontext) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); @@ -175,7 +175,7 @@ PHP_FUNCTION(stream_socket_client) } /* }}} */ -/* {{{ proto resource stream_socket_server(string localaddress [, int &errcode [, string &errstring [, int flags [, resource context]]]]) +/* {{{ proto resource|false stream_socket_server(string localaddress [, int &errcode [, string &errstring [, int flags [, resource context]]]]) Create a server socket bound to localaddress */ PHP_FUNCTION(stream_socket_server) { @@ -197,7 +197,7 @@ PHP_FUNCTION(stream_socket_server) Z_PARAM_ZVAL(zerrstr) Z_PARAM_LONG(flags) Z_PARAM_RESOURCE(zcontext) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); @@ -240,7 +240,7 @@ PHP_FUNCTION(stream_socket_server) } /* }}} */ -/* {{{ proto resource stream_socket_accept(resource serverstream, [ double timeout [, string &peername ]]) +/* {{{ proto resource|false stream_socket_accept(resource serverstream, [ double timeout [, string &peername ]]) Accept a client connection from a server socket */ PHP_FUNCTION(stream_socket_accept) { @@ -258,7 +258,7 @@ PHP_FUNCTION(stream_socket_accept) Z_PARAM_OPTIONAL Z_PARAM_DOUBLE(timeout) Z_PARAM_ZVAL(zpeername) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); php_stream_from_zval(stream, zstream); @@ -293,7 +293,7 @@ PHP_FUNCTION(stream_socket_accept) } /* }}} */ -/* {{{ proto string stream_socket_get_name(resource stream, bool want_peer) +/* {{{ proto string|false stream_socket_get_name(resource stream, bool want_peer) Returns either the locally bound or remote name for a socket stream */ PHP_FUNCTION(stream_socket_get_name) { @@ -305,7 +305,7 @@ PHP_FUNCTION(stream_socket_get_name) ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_RESOURCE(zstream) Z_PARAM_BOOL(want_peer) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); php_stream_from_zval(stream, zstream); @@ -325,7 +325,7 @@ PHP_FUNCTION(stream_socket_get_name) } /* }}} */ -/* {{{ proto int stream_socket_sendto(resource stream, string data [, int flags [, string target_addr]]) +/* {{{ proto int|false stream_socket_sendto(resource stream, string data [, int flags [, string target_addr]]) Send data to a socket stream. If target_addr is specified it must be in dotted quad (or [ipv6]) format */ PHP_FUNCTION(stream_socket_sendto) { @@ -343,7 +343,7 @@ PHP_FUNCTION(stream_socket_sendto) Z_PARAM_OPTIONAL Z_PARAM_LONG(flags) Z_PARAM_STRING(target_addr, target_addr_len) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); php_stream_from_zval(stream, zstream); if (target_addr_len) { @@ -358,7 +358,7 @@ PHP_FUNCTION(stream_socket_sendto) } /* }}} */ -/* {{{ proto string stream_socket_recvfrom(resource stream, int amount [, int flags [, string &remote_addr]]) +/* {{{ proto string|false stream_socket_recvfrom(resource stream, int amount [, int flags [, string &remote_addr]]) Receives data from a socket stream */ PHP_FUNCTION(stream_socket_recvfrom) { @@ -376,7 +376,7 @@ PHP_FUNCTION(stream_socket_recvfrom) Z_PARAM_OPTIONAL Z_PARAM_LONG(flags) Z_PARAM_ZVAL(zremote) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); php_stream_from_zval(stream, zstream); @@ -409,7 +409,7 @@ PHP_FUNCTION(stream_socket_recvfrom) } /* }}} */ -/* {{{ proto string stream_get_contents(resource source [, int maxlen [, int offset]]) +/* {{{ proto string|false stream_get_contents(resource source [, int maxlen [, int offset]]) Reads all remaining bytes (or up to maxlen bytes) from a stream and returns them as a string. */ PHP_FUNCTION(stream_get_contents) { @@ -424,7 +424,7 @@ PHP_FUNCTION(stream_get_contents) Z_PARAM_OPTIONAL Z_PARAM_LONG(maxlen) Z_PARAM_LONG(desiredpos) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); php_stream_from_zval(stream, zsrc); @@ -460,7 +460,7 @@ PHP_FUNCTION(stream_get_contents) } /* }}} */ -/* {{{ proto int stream_copy_to_stream(resource source, resource dest [, int maxlen [, int pos]]) +/* {{{ proto int|false stream_copy_to_stream(resource source, resource dest [, int maxlen [, int pos]]) Reads up to maxlen bytes from source stream and writes them to dest stream. */ PHP_FUNCTION(stream_copy_to_stream) { @@ -476,7 +476,7 @@ PHP_FUNCTION(stream_copy_to_stream) Z_PARAM_OPTIONAL Z_PARAM_LONG(maxlen) Z_PARAM_LONG(pos) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); php_stream_from_zval(src, zsrc); php_stream_from_zval(dest, zdest); @@ -495,7 +495,7 @@ PHP_FUNCTION(stream_copy_to_stream) } /* }}} */ -/* {{{ proto array stream_get_meta_data(resource fp) +/* {{{ proto array|false stream_get_meta_data(resource fp) Retrieves header/meta data from streams/file pointers */ PHP_FUNCTION(stream_get_meta_data) { @@ -552,7 +552,7 @@ PHP_FUNCTION(stream_get_meta_data) } /* }}} */ -/* {{{ proto array stream_get_transports() +/* {{{ proto array|false stream_get_transports() Retrieves list of registered socket transports */ PHP_FUNCTION(stream_get_transports) { @@ -574,7 +574,7 @@ PHP_FUNCTION(stream_get_transports) } /* }}} */ -/* {{{ proto array stream_get_wrappers() +/* {{{ proto array|false stream_get_wrappers() Retrieves list of registered stream wrappers */ PHP_FUNCTION(stream_get_wrappers) { @@ -738,7 +738,7 @@ static int stream_array_emulate_read_fd_set(zval *stream_array) } /* }}} */ -/* {{{ proto int stream_select(array &read_streams, array &write_streams, array &except_streams, int tv_sec[, int tv_usec]) +/* {{{ proto int|false stream_select(array &read_streams, array &write_streams, array &except_streams, int tv_sec[, int tv_usec]) Runs the select() system call on the sets of streams with a timeout specified by tv_sec and tv_usec */ PHP_FUNCTION(stream_select) { @@ -959,7 +959,7 @@ static php_stream_context *decode_context_param(zval *contextresource) } /* }}} */ -/* {{{ proto array stream_context_get_options(resource context|resource stream) +/* {{{ proto array|false stream_context_get_options(resource context|resource stream) Retrieve options for a stream/wrapper/context */ PHP_FUNCTION(stream_context_get_options) { @@ -993,7 +993,7 @@ PHP_FUNCTION(stream_context_set_option) ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_RESOURCE(zcontext) Z_PARAM_ARRAY(options) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); /* figure out where the context is coming from exactly */ if (!(context = decode_context_param(zcontext))) { @@ -1012,7 +1012,7 @@ PHP_FUNCTION(stream_context_set_option) Z_PARAM_STRING(wrappername, wrapperlen) Z_PARAM_STRING(optionname, optionlen) Z_PARAM_ZVAL(zvalue) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); /* figure out where the context is coming from exactly */ if (!(context = decode_context_param(zcontext))) { @@ -1035,7 +1035,7 @@ PHP_FUNCTION(stream_context_set_params) ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_RESOURCE(zcontext) Z_PARAM_ARRAY(params) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); context = decode_context_param(zcontext); if (!context) { @@ -1047,7 +1047,7 @@ PHP_FUNCTION(stream_context_set_params) } /* }}} */ -/* {{{ proto array stream_context_get_params(resource context|resource stream) +/* {{{ proto array|false stream_context_get_params(resource context|resource stream) Get parameters of a file context */ PHP_FUNCTION(stream_context_get_params) { @@ -1056,7 +1056,7 @@ PHP_FUNCTION(stream_context_get_params) ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_RESOURCE(zcontext) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); context = decode_context_param(zcontext); if (!context) { @@ -1536,7 +1536,7 @@ PHP_FUNCTION(stream_socket_enable_crypto) } /* }}} */ -/* {{{ proto string stream_resolve_include_path(string filename) +/* {{{ proto string|false stream_resolve_include_path(string filename) Determine what file will be opened by calls to fopen() with a relative path */ PHP_FUNCTION(stream_resolve_include_path) { @@ -1677,8 +1677,7 @@ PHP_FUNCTION(sapi_windows_vt100_support) php_stream_cast(stream, PHP_STREAM_AS_FD, (void*)&fileno, 0); } else { - zend_internal_type_error( - ZEND_ARG_USES_STRICT_TYPES(), + zend_type_error( "%s() was not able to analyze the specified stream", get_active_function_name() ); diff --git a/ext/standard/string.c b/ext/standard/string.c index f4a77fe04d..49b228dcac 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -236,15 +236,11 @@ PHP_FUNCTION(bin2hex) result = php_bin2hex((unsigned char *)ZSTR_VAL(data), ZSTR_LEN(data)); - if (!result) { - RETURN_FALSE; - } - RETURN_STR(result); } /* }}} */ -/* {{{ proto string hex2bin(string data) +/* {{{ proto string|false hex2bin(string data) Converts the hex representation of data to binary */ PHP_FUNCTION(hex2bin) { @@ -328,7 +324,7 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) / } /* }}} */ -/* {{{ proto int strspn(string str, string mask [, int start [, int len]]) +/* {{{ proto int|false strspn(string str, string mask [, int start [, int len]]) Finds length of initial segment consisting entirely of characters found in mask. If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) */ PHP_FUNCTION(strspn) { @@ -336,7 +332,7 @@ PHP_FUNCTION(strspn) } /* }}} */ -/* {{{ proto int strcspn(string str, string mask [, int start [, int len]]) +/* {{{ proto int|false strcspn(string str, string mask [, int start [, int len]]) Finds length of initial segment consisting entirely of characters not found in mask. If start or/and length is provide works like strcspn(substr($s,$start,$len),$bad_chars) */ PHP_FUNCTION(strcspn) { @@ -514,7 +510,7 @@ PHP_MINIT_FUNCTION(nl_langinfo) } /* }}} */ -/* {{{ proto string nl_langinfo(int item) +/* {{{ proto string|false nl_langinfo(int item) Query language and locale information */ PHP_FUNCTION(nl_langinfo) { @@ -937,13 +933,13 @@ PHP_FUNCTION(wordwrap) } if (breakchar_len == 0) { - php_error_docref(NULL, E_WARNING, "Break string cannot be empty"); - RETURN_FALSE; + zend_throw_error(NULL, "Break string cannot be empty"); + return; } if (linelength == 0 && docut) { - php_error_docref(NULL, E_WARNING, "Can't force cut when width is zero"); - RETURN_FALSE; + zend_throw_error(NULL, "Can't force cut when width is zero"); + return; } /* Special case for a single-character break as it needs no @@ -1149,14 +1145,14 @@ PHP_FUNCTION(explode) ZEND_PARSE_PARAMETERS_END(); if (ZSTR_LEN(delim) == 0) { - php_error_docref(NULL, E_WARNING, "Empty delimiter"); - RETURN_FALSE; + zend_throw_error(NULL, "Empty delimiter"); + return; } array_init(return_value); if (ZSTR_LEN(str) == 0) { - if (limit >= 0) { + if (limit >= 0) { ZVAL_EMPTY_STRING(&tmp); zend_hash_index_add_new(Z_ARRVAL_P(return_value), 0, &tmp); } @@ -1281,7 +1277,7 @@ PHP_FUNCTION(implode) if (arg2 == NULL) { if (Z_TYPE_P(arg1) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "Argument must be an array"); + zend_type_error("Argument must be an array"); return; } @@ -1298,7 +1294,7 @@ PHP_FUNCTION(implode) glue = zval_get_tmp_string(arg1, &tmp_glue); pieces = arg2; } else { - php_error_docref(NULL, E_WARNING, "Invalid arguments passed"); + zend_type_error("Invalid arguments passed"); return; } } @@ -1310,7 +1306,7 @@ PHP_FUNCTION(implode) #define STRTOK_TABLE(p) BG(strtok_table)[(unsigned char) *p] -/* {{{ proto string strtok([string str,] string token) +/* {{{ proto string|false strtok([string str,] string token) Tokenize a string */ PHP_FUNCTION(strtok) { @@ -1648,7 +1644,7 @@ PHP_FUNCTION(dirname) ZSTR_LEN(ret) = zend_dirname(ZSTR_VAL(ret), str_len); #endif } else if (levels < 1) { - php_error_docref(NULL, E_WARNING, "Invalid argument, levels must be >= 1"); + zend_throw_error(NULL, "Invalid argument, levels must be >= 1"); zend_string_efree(ret); return; } else { @@ -1666,7 +1662,7 @@ PHP_FUNCTION(dirname) } /* }}} */ -/* {{{ proto array pathinfo(string path[, int options]) +/* {{{ proto array|string pathinfo(string path[, int options]) Returns information about a certain string */ PHP_FUNCTION(pathinfo) { @@ -1798,76 +1794,28 @@ PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end) } /* }}} */ -/* {{{ php_needle_char - */ -static int php_needle_char(zval *needle, char *target) -{ - switch (Z_TYPE_P(needle)) { - case IS_LONG: - *target = (char)Z_LVAL_P(needle); - return SUCCESS; - case IS_NULL: - case IS_FALSE: - *target = '\0'; - return SUCCESS; - case IS_TRUE: - *target = '\1'; - return SUCCESS; - case IS_DOUBLE: - case IS_OBJECT: - *target = (char) zval_get_long(needle); - return SUCCESS; - default: - php_error_docref(NULL, E_WARNING, "needle is not a string or an integer"); - return FAILURE; - } -} -/* }}} */ - -/* {{{ proto string stristr(string haystack, string needle[, bool part]) +/* {{{ proto string|false stristr(string haystack, string needle[, bool part]) Finds first occurrence of a string within another, case insensitive */ PHP_FUNCTION(stristr) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; size_t found_offset; char *haystack_dup; - char needle_char[2]; + char *orig_needle; zend_bool part = 0; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_BOOL(part) ZEND_PARSE_PARAMETERS_END(); haystack_dup = estrndup(ZSTR_VAL(haystack), ZSTR_LEN(haystack)); - - if (Z_TYPE_P(needle) == IS_STRING) { - char *orig_needle; - if (!Z_STRLEN_P(needle)) { - php_error_docref(NULL, E_WARNING, "Empty needle"); - efree(haystack_dup); - RETURN_FALSE; - } - orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); - found = php_stristr(haystack_dup, orig_needle, ZSTR_LEN(haystack), Z_STRLEN_P(needle)); - efree(orig_needle); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - efree(haystack_dup); - RETURN_FALSE; - } - needle_char[1] = 0; - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = php_stristr(haystack_dup, needle_char, ZSTR_LEN(haystack), 1); - } + orig_needle = estrndup(ZSTR_VAL(needle), ZSTR_LEN(needle)); + found = php_stristr(haystack_dup, orig_needle, ZSTR_LEN(haystack), ZSTR_LEN(needle)); + efree(orig_needle); if (found) { found_offset = found - haystack_dup; @@ -1884,43 +1832,23 @@ PHP_FUNCTION(stristr) } /* }}} */ -/* {{{ proto string strstr(string haystack, string needle[, bool part]) +/* {{{ proto string|false strstr(string haystack, string needle[, bool part]) Finds first occurrence of a string within another */ PHP_FUNCTION(strstr) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; - char needle_char[2]; zend_long found_offset; zend_bool part = 0; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_BOOL(part) ZEND_PARSE_PARAMETERS_END(); - if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRLEN_P(needle)) { - php_error_docref(NULL, E_WARNING, "Empty needle"); - RETURN_FALSE; - } - - found = php_memnstr(ZSTR_VAL(haystack), Z_STRVAL_P(needle), Z_STRLEN_P(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - RETURN_FALSE; - } - needle_char[1] = 0; - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = php_memnstr(ZSTR_VAL(haystack), needle_char, 1, ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); - } + found = php_memnstr(ZSTR_VAL(haystack), ZSTR_VAL(needle), ZSTR_LEN(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); if (found) { found_offset = found - ZSTR_VAL(haystack); @@ -1938,19 +1866,17 @@ PHP_FUNCTION(strstr) An alias for strstr */ /* }}} */ -/* {{{ proto int strpos(string haystack, string needle [, int offset]) +/* {{{ proto int|false strpos(string haystack, string needle [, int offset]) Finds position of first occurrence of a string within another */ PHP_FUNCTION(strpos) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; - char needle_char[2]; - zend_long offset = 0; + zend_long offset = 0; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END(); @@ -1963,31 +1889,9 @@ PHP_FUNCTION(strpos) RETURN_FALSE; } - if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRLEN_P(needle)) { - php_error_docref(NULL, E_WARNING, "Empty needle"); - RETURN_FALSE; - } - - found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset, - Z_STRVAL_P(needle), - Z_STRLEN_P(needle), - ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - RETURN_FALSE; - } - needle_char[1] = 0; - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset, - needle_char, - 1, - ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); - } + found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset, + ZSTR_VAL(needle), ZSTR_LEN(needle), + ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); if (found) { RETURN_LONG(found - ZSTR_VAL(haystack)); @@ -1997,20 +1901,18 @@ PHP_FUNCTION(strpos) } /* }}} */ -/* {{{ proto int stripos(string haystack, string needle [, int offset]) +/* {{{ proto int|false stripos(string haystack, string needle [, int offset]) Finds position of first occurrence of a string within another, case insensitive */ PHP_FUNCTION(stripos) { const char *found = NULL; - zend_string *haystack; + zend_string *haystack, *needle; zend_long offset = 0; - char needle_char[2]; - zval *needle; zend_string *needle_dup = NULL, *haystack_dup; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END(); @@ -2023,37 +1925,14 @@ PHP_FUNCTION(stripos) RETURN_FALSE; } - if (ZSTR_LEN(haystack) == 0) { + if (ZSTR_LEN(needle) > ZSTR_LEN(haystack)) { RETURN_FALSE; } - if (Z_TYPE_P(needle) == IS_STRING) { - if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > ZSTR_LEN(haystack)) { - RETURN_FALSE; - } - - haystack_dup = php_string_tolower(haystack); - needle_dup = php_string_tolower(Z_STR_P(needle)); - found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset, - ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack)); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - haystack_dup = php_string_tolower(haystack); - needle_char[0] = tolower(needle_char[0]); - needle_char[1] = '\0'; - found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset, - needle_char, - sizeof(needle_char) - 1, - ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack)); - } - + haystack_dup = php_string_tolower(haystack); + needle_dup = php_string_tolower(needle); + found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset, + ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack)); if (found) { RETVAL_LONG(found - ZSTR_VAL(haystack_dup)); @@ -2062,72 +1941,48 @@ PHP_FUNCTION(stripos) } zend_string_release_ex(haystack_dup, 0); - if (needle_dup) { - zend_string_release_ex(needle_dup, 0); - } + zend_string_release_ex(needle_dup, 0); } /* }}} */ -/* {{{ proto int strrpos(string haystack, string needle [, int offset]) +/* {{{ proto int|false strrpos(string haystack, string needle [, int offset]) Finds position of last occurrence of a string within another string */ PHP_FUNCTION(strrpos) { - zval *zneedle; + zend_string *needle; zend_string *haystack; - size_t needle_len; zend_long offset = 0; - char ord_needle[2]; - const char *p, *e, *found, *needle; + const char *p, *e, *found; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(zneedle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); - if (Z_TYPE_P(zneedle) == IS_STRING) { - needle = Z_STRVAL_P(zneedle); - needle_len = Z_STRLEN_P(zneedle); - } else { - if (php_needle_char(zneedle, ord_needle) != SUCCESS) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - ord_needle[1] = '\0'; - needle = ord_needle; - needle_len = 1; - } - - if ((ZSTR_LEN(haystack) == 0) || (needle_len == 0)) { - RETURN_FALSE; - } - if (offset >= 0) { if ((size_t)offset > ZSTR_LEN(haystack)) { - php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); + php_error_docref(NULL, E_WARNING, "Offset not contained in string"); RETURN_FALSE; } p = ZSTR_VAL(haystack) + (size_t)offset; e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack); } else { if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) { - php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); + php_error_docref(NULL, E_WARNING, "Offset not contained in string"); RETURN_FALSE; } + p = ZSTR_VAL(haystack); - if ((size_t)-offset < needle_len) { + if ((size_t)-offset < ZSTR_LEN(needle)) { e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack); } else { - e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) + offset + needle_len; + e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) + offset + ZSTR_LEN(needle); } } - if ((found = zend_memnrstr(p, needle, needle_len, e))) { + if ((found = zend_memnrstr(p, ZSTR_VAL(needle), ZSTR_LEN(needle), e))) { RETURN_LONG(found - ZSTR_VAL(haystack)); } @@ -2135,54 +1990,30 @@ PHP_FUNCTION(strrpos) } /* }}} */ -/* {{{ proto int strripos(string haystack, string needle [, int offset]) +/* {{{ proto int|false strripos(string haystack, string needle [, int offset]) Finds position of last occurrence of a string within another string */ PHP_FUNCTION(strripos) { - zval *zneedle; zend_string *needle; zend_string *haystack; zend_long offset = 0; const char *p, *e, *found; - zend_string *needle_dup, *haystack_dup, *ord_needle = NULL; - ALLOCA_FLAG(use_heap); + zend_string *needle_dup, *haystack_dup; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(zneedle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); - ZSTR_ALLOCA_ALLOC(ord_needle, 1, use_heap); - if (Z_TYPE_P(zneedle) == IS_STRING) { - needle = Z_STR_P(zneedle); - } else { - if (php_needle_char(zneedle, ZSTR_VAL(ord_needle)) != SUCCESS) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - ZSTR_VAL(ord_needle)[1] = '\0'; - needle = ord_needle; - } - - if ((ZSTR_LEN(haystack) == 0) || (ZSTR_LEN(needle) == 0)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); - RETURN_FALSE; - } - if (ZSTR_LEN(needle) == 1) { /* Single character search can shortcut memcmps Can also avoid tolower emallocs */ + char lowered; if (offset >= 0) { if ((size_t)offset > ZSTR_LEN(haystack)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); - php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); + php_error_docref(NULL, E_WARNING, "Offset not contained in string"); RETURN_FALSE; } p = ZSTR_VAL(haystack) + (size_t)offset; @@ -2190,22 +2021,19 @@ PHP_FUNCTION(strripos) } else { p = ZSTR_VAL(haystack); if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); - php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); + php_error_docref(NULL, E_WARNING, "Offset not contained in string"); RETURN_FALSE; } e = ZSTR_VAL(haystack) + (ZSTR_LEN(haystack) + (size_t)offset); } /* Borrow that ord_needle buffer to avoid repeatedly tolower()ing needle */ - *ZSTR_VAL(ord_needle) = tolower(*ZSTR_VAL(needle)); + lowered = tolower(*ZSTR_VAL(needle)); while (e >= p) { - if (tolower(*e) == *ZSTR_VAL(ord_needle)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); + if (tolower(*e) == lowered) { RETURN_LONG(e - p + (offset > 0 ? offset : 0)); } e--; } - ZSTR_ALLOCA_FREE(ord_needle, use_heap); RETURN_FALSE; } @@ -2213,8 +2041,7 @@ PHP_FUNCTION(strripos) if (offset >= 0) { if ((size_t)offset > ZSTR_LEN(haystack)) { zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); - php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); + php_error_docref(NULL, E_WARNING, "Offset not contained in string"); RETURN_FALSE; } p = ZSTR_VAL(haystack_dup) + offset; @@ -2222,10 +2049,10 @@ PHP_FUNCTION(strripos) } else { if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) { zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); - php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); + php_error_docref(NULL, E_WARNING, "Offset not contained in string"); RETURN_FALSE; } + p = ZSTR_VAL(haystack_dup); if ((size_t)-offset < ZSTR_LEN(needle)) { e = ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack); @@ -2239,45 +2066,28 @@ PHP_FUNCTION(strripos) RETVAL_LONG(found - ZSTR_VAL(haystack_dup)); zend_string_release_ex(needle_dup, 0); zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); } else { zend_string_release_ex(needle_dup, 0); zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); RETURN_FALSE; } } /* }}} */ -/* {{{ proto string strrchr(string haystack, string needle) +/* {{{ proto string|false strrchr(string haystack, string needle) Finds the last occurrence of a character in a string within another */ PHP_FUNCTION(strrchr) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; zend_long found_offset; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) ZEND_PARSE_PARAMETERS_END(); - if (Z_TYPE_P(needle) == IS_STRING) { - found = zend_memrchr(ZSTR_VAL(haystack), *Z_STRVAL_P(needle), ZSTR_LEN(haystack)); - } else { - char needle_chr; - if (php_needle_char(needle, &needle_chr) != SUCCESS) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = zend_memrchr(ZSTR_VAL(haystack), needle_chr, ZSTR_LEN(haystack)); - } - + found = zend_memrchr(ZSTR_VAL(haystack), *ZSTR_VAL(needle), ZSTR_LEN(haystack)); if (found) { found_offset = found - ZSTR_VAL(haystack); RETURN_STRINGL(found, ZSTR_LEN(haystack) - found_offset); @@ -2293,28 +2103,19 @@ static zend_string *php_chunk_split(const char *src, size_t srclen, const char * { char *q; const char *p; - size_t chunks; /* complete chunks! */ + size_t chunks; size_t restlen; - size_t out_len; zend_string *dest; chunks = srclen / chunklen; restlen = srclen - chunks * chunklen; /* srclen % chunklen */ - - if (chunks > INT_MAX - 1) { - return NULL; - } - out_len = chunks + 1; - if (endlen !=0 && out_len > INT_MAX/endlen) { - return NULL; - } - out_len *= endlen; - if (out_len > INT_MAX - srclen - 1) { - return NULL; + if (restlen) { + /* We want chunks to be rounded up rather than rounded down. + * Increment can't overflow because chunks <= SIZE_MAX/2 at this point. */ + chunks++; } - out_len += srclen + 1; - dest = zend_string_alloc(out_len * sizeof(char), 0); + dest = zend_string_safe_alloc(chunks, endlen, srclen, 0); for (p = src, q = ZSTR_VAL(dest); p < (src + srclen - chunklen + 1); ) { memcpy(q, p, chunklen); @@ -2332,7 +2133,7 @@ static zend_string *php_chunk_split(const char *src, size_t srclen, const char * } *q = '\0'; - ZSTR_LEN(dest) = q - ZSTR_VAL(dest); + ZEND_ASSERT(q - ZSTR_VAL(dest) == ZSTR_LEN(dest)); return dest; } @@ -2356,8 +2157,8 @@ PHP_FUNCTION(chunk_split) ZEND_PARSE_PARAMETERS_END(); if (chunklen <= 0) { - php_error_docref(NULL, E_WARNING, "Chunk length should be greater than zero"); - RETURN_FALSE; + zend_throw_error(NULL, "Chunk length should be greater than zero"); + return; } if ((size_t)chunklen > ZSTR_LEN(str)) { @@ -2375,15 +2176,11 @@ PHP_FUNCTION(chunk_split) result = php_chunk_split(ZSTR_VAL(str), ZSTR_LEN(str), end, endlen, (size_t)chunklen); - if (result) { - RETURN_STR(result); - } else { - RETURN_FALSE; - } + RETURN_STR(result); } /* }}} */ -/* {{{ proto string substr(string str, int start [, int length]) +/* {{{ proto string|false substr(string str, int start [, int length]) Returns part of a string */ PHP_FUNCTION(substr) { @@ -2459,7 +2256,7 @@ truncate_len: } /* }}} */ -/* {{{ proto mixed substr_replace(mixed str, mixed repl, mixed start [, mixed length]) +/* {{{ proto string|array|false substr_replace(mixed str, mixed repl, mixed start [, mixed length]) Replaces part of a string with another string */ PHP_FUNCTION(substr_replace) { @@ -2739,8 +2536,8 @@ PHP_FUNCTION(quotemeta) old_end = ZSTR_VAL(old) + ZSTR_LEN(old); - if (ZSTR_VAL(old) == old_end) { - RETURN_FALSE; + if (ZSTR_LEN(old) == 0) { + RETURN_EMPTY_STRING(); } str = zend_string_safe_alloc(2, ZSTR_LEN(old), 0, 0); @@ -2796,7 +2593,7 @@ PHP_FUNCTION(chr) ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(c) - ZEND_PARSE_PARAMETERS_END_EX(c = 0); + ZEND_PARSE_PARAMETERS_END(); c &= 0xff; ZVAL_INTERNED_STR(return_value, ZSTR_CHAR(c)); @@ -3472,8 +3269,8 @@ PHP_FUNCTION(strtr) ZEND_PARSE_PARAMETERS_END(); if (ac == 2 && Z_TYPE_P(from) != IS_ARRAY) { - php_error_docref(NULL, E_WARNING, "The second argument is not an array"); - RETURN_FALSE; + zend_type_error("The second argument is not an array"); + return; } /* shortcut for empty string */ @@ -4615,7 +4412,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines) ZEND_PARSE_PARAMETERS_END(); if (str_len == 0) { - RETURN_FALSE; + RETURN_EMPTY_STRING(); } tmp = str; @@ -4915,7 +4712,7 @@ PHP_FUNCTION(strip_tags) } /* }}} */ -/* {{{ proto string setlocale(mixed category, string locale [, string ...]) +/* {{{ proto string|false setlocale(mixed category, string locale [, string ...]) Set locale information */ PHP_FUNCTION(setlocale) { @@ -5028,7 +4825,7 @@ PHP_FUNCTION(setlocale) } /* }}} */ -/* {{{ proto void parse_str(string encoded_string [, array &result]) +/* {{{ proto void parse_str(string encoded_string, array &result) Parses GET/POST/COOKIE data and sets global variables */ PHP_FUNCTION(parse_str) { @@ -5037,39 +4834,18 @@ PHP_FUNCTION(parse_str) char *res = NULL; size_t arglen; - ZEND_PARSE_PARAMETERS_START(1, 2) + ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STRING(arg, arglen) - Z_PARAM_OPTIONAL Z_PARAM_ZVAL(arrayArg) ZEND_PARSE_PARAMETERS_END(); - res = estrndup(arg, arglen); - - if (arrayArg == NULL) { - zval tmp; - zend_array *symbol_table; - if (zend_forbid_dynamic_call("parse_str() with a single argument") == FAILURE) { - efree(res); - return; - } - - php_error_docref(NULL, E_DEPRECATED, "Calling parse_str() without the result argument is deprecated"); - - symbol_table = zend_rebuild_symbol_table(); - ZVAL_ARR(&tmp, symbol_table); - sapi_module.treat_data(PARSE_STRING, res, &tmp); - if (UNEXPECTED(zend_hash_del(symbol_table, ZSTR_KNOWN(ZEND_STR_THIS)) == SUCCESS)) { - zend_throw_error(NULL, "Cannot re-assign $this"); - } - } else { - arrayArg = zend_try_array_init(arrayArg); - if (!arrayArg) { - efree(res); - return; - } - - sapi_module.treat_data(PARSE_STRING, res, arrayArg); + arrayArg = zend_try_array_init(arrayArg); + if (!arrayArg) { + return; } + + res = estrndup(arg, arglen); + sapi_module.treat_data(PARSE_STRING, res, arrayArg); } /* }}} */ @@ -5546,7 +5322,7 @@ PHP_FUNCTION(str_repeat) ZEND_PARSE_PARAMETERS_END(); if (mult < 0) { - php_error_docref(NULL, E_WARNING, "Second argument has to be greater than or equal to 0"); + zend_throw_error(NULL, "Second argument has to be greater than or equal to 0"); return; } @@ -5584,7 +5360,7 @@ PHP_FUNCTION(str_repeat) } /* }}} */ -/* {{{ proto mixed count_chars(string input [, int mode]) +/* {{{ proto array|string|false count_chars(string input [, int mode]) Returns info about what characters are used in input */ PHP_FUNCTION(count_chars) { @@ -5772,7 +5548,7 @@ PHP_FUNCTION(strnatcasecmp) } /* }}} */ -/* {{{ proto int substr_count(string haystack, string needle [, int offset [, int length]]) +/* {{{ proto int|false substr_count(string haystack, string needle [, int offset [, int length]]) Returns the number of times a substring occurs in the string */ PHP_FUNCTION(substr_count) { @@ -5793,8 +5569,8 @@ PHP_FUNCTION(substr_count) ZEND_PARSE_PARAMETERS_END(); if (needle_len == 0) { - php_error_docref(NULL, E_WARNING, "Empty substring"); - RETURN_FALSE; + zend_throw_error(NULL, "Empty substring"); + return; } p = haystack; @@ -5870,21 +5646,16 @@ PHP_FUNCTION(str_pad) } if (pad_str_len == 0) { - php_error_docref(NULL, E_WARNING, "Padding string cannot be empty"); + zend_throw_error(NULL, "Padding string cannot be empty"); return; } if (pad_type_val < STR_PAD_LEFT || pad_type_val > STR_PAD_BOTH) { - php_error_docref(NULL, E_WARNING, "Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH"); + zend_throw_error(NULL, "Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH"); return; } num_pad_chars = pad_length - ZSTR_LEN(input); - if (num_pad_chars >= INT_MAX) { - php_error_docref(NULL, E_WARNING, "Padding length is too long"); - return; - } - result = zend_string_safe_alloc(1, ZSTR_LEN(input), num_pad_chars, 0); ZSTR_LEN(result) = 0; @@ -6082,7 +5853,7 @@ static void php_string_shuffle(char *str, zend_long len) /* {{{ */ } /* }}} */ -/* {{{ proto void str_shuffle(string str) +/* {{{ proto string str_shuffle(string str) Shuffles string. One permutation of all possible is created */ PHP_FUNCTION(str_shuffle) { @@ -6099,13 +5870,13 @@ PHP_FUNCTION(str_shuffle) } /* }}} */ -/* {{{ proto mixed str_word_count(string str, [int format [, string charlist]]) + +/* {{{ proto array|int str_word_count(string str, [int format [, string charlist]]) Counts the number of words inside a string. If format of 1 is specified, then the function will return an array containing all the words found inside the string. If format of 2 is specified, then the function will return an associated array where the position of the word is the key and the word itself is the value. - For the purpose of this function, 'word' is defined as a locale dependent string containing alphabetic characters, which also may contain, but not start with "'" and "-" characters. @@ -6140,8 +5911,8 @@ PHP_FUNCTION(str_word_count) /* nothing to be done */ break; default: - php_error_docref(NULL, E_WARNING, "Invalid format value " ZEND_LONG_FMT, type); - RETURN_FALSE; + zend_throw_error(NULL, "Invalid format value " ZEND_LONG_FMT, type); + return; } if (char_list) { @@ -6190,7 +5961,7 @@ PHP_FUNCTION(str_word_count) /* }}} */ #if HAVE_STRFMON -/* {{{ proto string money_format(string format , float value) +/* {{{ proto string|false money_format(string format , float value) Convert monetary value(s) to string */ PHP_FUNCTION(money_format) { @@ -6257,8 +6028,8 @@ PHP_FUNCTION(str_split) ZEND_PARSE_PARAMETERS_END(); if (split_length <= 0) { - php_error_docref(NULL, E_WARNING, "The length of each segment must be greater than zero"); - RETURN_FALSE; + zend_throw_error(NULL, "The length of each segment must be greater than zero"); + return; } @@ -6284,7 +6055,7 @@ PHP_FUNCTION(str_split) } /* }}} */ -/* {{{ proto array strpbrk(string haystack, string char_list) +/* {{{ proto string|false strpbrk(string haystack, string char_list) Search a string for any of a set of characters */ PHP_FUNCTION(strpbrk) { @@ -6313,7 +6084,7 @@ PHP_FUNCTION(strpbrk) } /* }}} */ -/* {{{ proto int substr_compare(string main_str, string str, int offset [, int length [, bool case_sensitivity]]) +/* {{{ proto int|false substr_compare(string main_str, string str, int offset [, int length [, bool case_sensitivity]]) Binary safe optionally case insensitive comparison of 2 strings from an offset, up to length characters */ PHP_FUNCTION(substr_compare) { @@ -6336,8 +6107,8 @@ PHP_FUNCTION(substr_compare) if (len == 0) { RETURN_LONG(0L); } else { - php_error_docref(NULL, E_WARNING, "The length must be greater than or equal to zero"); - RETURN_FALSE; + zend_throw_error(NULL, "The length must be greater than or equal to zero"); + return; } } diff --git a/ext/standard/tests/array/005.phpt b/ext/standard/tests/array/005.phpt index c82f5f7fd0..c51e98a67b 100644 --- a/ext/standard/tests/array/005.phpt +++ b/ext/standard/tests/array/005.phpt @@ -33,18 +33,6 @@ $mixed_array = array( /* Testing Error Conditions */ echo "\n*** Testing Error Conditions ***\n"; -/* Zero argument */ -var_dump( array_shift() ); - -/* Scalar argument */ -var_dump( array_shift($number) ); - -/* String argument */ -var_dump( array_shift($str) ); - -/* Invalid Number of arguments */ -var_dump( array_shift($mixed_array[1],$mixed_array[2]) ); - /* Empty Array as argument */ var_dump( array_shift($empty_array) ); @@ -83,18 +71,6 @@ echo"Done"; ?> --EXPECTF-- *** Testing Error Conditions *** - -Warning: array_shift() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: array_shift() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_shift() expects exactly 1 parameter, 2 given in %s on line %d -NULL NULL *** Testing with various array inputs *** diff --git a/ext/standard/tests/array/009.phpt b/ext/standard/tests/array/009.phpt index 017456917e..c62be0d27c 100644 --- a/ext/standard/tests/array/009.phpt +++ b/ext/standard/tests/array/009.phpt @@ -69,51 +69,6 @@ foreach ($varient_arrays as $sub_array ) { echo "\n"; } -/*test these functions on array which is already unset */ -echo "\n-- Testing variation: when array is unset --\n"; -$unset_array = array (1); -unset($unset_array); - -var_dump( current($unset_array) ); -var_dump( key($unset_array) ); -var_dump( next($unset_array) ); -var_dump( reset($unset_array) ); - - -echo "\n*** Testing error conditions ***\n"; -//Zero argument, expected 1 argument -var_dump( key() ); -var_dump( current() ); -var_dump( reset() ); -var_dump( next() ); - -// args more than expected, expected 1 argument -$temp_array = array(1); -var_dump( key($temp_array, $temp_array) ); -var_dump( current($temp_array, $temp_array) ); -var_dump( reset($temp_array, $temp_array) ); -var_dump( next($temp_array, $temp_array) ); - -// invalid args type, valid argument: array -$int_var = 1; -$float_var = 1.5; -$string = "string"; -var_dump( key($int_var) ); -var_dump( key($float_var) ); -var_dump( key($string) ); - -var_dump( current($int_var) ); -var_dump( current($float_var) ); -var_dump( current($string) ); - -var_dump( next($int_var) ); -var_dump( next($float_var) ); -var_dump( next($string) ); - -var_dump( reset($int_var) ); -var_dump( reset($float_var) ); -var_dump( reset($string) ); - echo "Done\n"; ?> --EXPECTF-- @@ -456,84 +411,4 @@ array(5) { string(4) "zero" } - --- Testing variation: when array is unset -- - -Notice: Undefined variable: unset_array in %s on line %d - -Warning: current() expects parameter 1 to be array, null given in %s on line %d -NULL - -Notice: Undefined variable: unset_array in %s on line %d - -Warning: key() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, null given in %s on line %d -NULL - -*** Testing error conditions *** - -Warning: key() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: current() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: reset() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: next() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: key() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: current() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: reset() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: next() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: key() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: key() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: key() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: current() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: current() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: current() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, string given in %s on line %d -NULL Done diff --git a/ext/standard/tests/array/array_change_key_case_variation.phpt b/ext/standard/tests/array/array_change_key_case_variation.phpt index 3f8d502ffe..f2b185523f 100644 --- a/ext/standard/tests/array/array_change_key_case_variation.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation.phpt @@ -6,13 +6,16 @@ Test array_change_key_case() function - 2 $item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four"); /* use 'case' argument other than CASE_LOWER & CASE_UPPER */ -var_dump(array_change_key_case($item, "CASE_UPPER")); +try { + var_dump(array_change_key_case($item, "CASE_UPPER")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(array_change_key_case($item, 5)); /* when keys are different in terms of only case */ /* should return one value key pair with key being in lowercase */ var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) ) ); -var_dump( array_change_key_case( array("ONE" => 1, "one" => 6, "One" => 5), "CASE_UPPER" ) ); /* should return one value key pair with key being in uppercase */ var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3), CASE_UPPER ) ); @@ -21,8 +24,7 @@ var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5 ) echo "end\n"; ?> --EXPECTF-- -Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d -NULL +array_change_key_case() expects parameter 2 to be int, string given array(4) { ["ONE"]=> int(1) @@ -37,9 +39,6 @@ array(1) { ["one"]=> int(4) } - -Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d -NULL array(1) { ["ONE"]=> int(3) diff --git a/ext/standard/tests/array/array_chunk.phpt b/ext/standard/tests/array/array_chunk.phpt deleted file mode 100644 index 2ee77e129c..0000000000 --- a/ext/standard/tests/array/array_chunk.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -array_chunk() ---FILE-- -<?php -$array = array (); -var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { - echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); - echo "\n"; -} -?> ---EXPECT-- -array(0) { -} -[0] -NULL -NULL -NULL diff --git a/ext/standard/tests/array/array_chunk2.phpt b/ext/standard/tests/array/array_chunk2.phpt index 6d8b74545e..c02194aa5b 100644 --- a/ext/standard/tests/array/array_chunk2.phpt +++ b/ext/standard/tests/array/array_chunk2.phpt @@ -3,8 +3,19 @@ basic array_chunk test --FILE-- <?php $input_array = array('a', 'b', 'c', 'd', 'e'); -var_dump(array_chunk($input_array, 0)); -var_dump(array_chunk($input_array, 0, true)); + +try { + var_dump(array_chunk($input_array, 0)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(array_chunk($input_array, 0, true)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + var_dump(array_chunk($input_array, 1)); var_dump(array_chunk($input_array, 1, true)); var_dump(array_chunk($input_array, 2)); @@ -12,12 +23,9 @@ var_dump(array_chunk($input_array, 2, true)); var_dump(array_chunk($input_array, 10)); var_dump(array_chunk($input_array, 10, true)); ?> ---EXPECTF-- -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL +--EXPECT-- +Size parameter expected to be greater than 0 +Size parameter expected to be greater than 0 array(5) { [0]=> array(1) { diff --git a/ext/standard/tests/array/array_chunk_variation10.phpt b/ext/standard/tests/array/array_chunk_variation10.phpt index 7b4bee172b..be5fcdc7f3 100644 --- a/ext/standard/tests/array/array_chunk_variation10.phpt +++ b/ext/standard/tests/array/array_chunk_variation10.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 10 <?php $array = array (1 => 1, 2 => 2, 3 => 3); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -21,11 +21,6 @@ array(3) { [3]=> int(3) } -[0] -NULL -NULL -NULL - [1] array(3) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation11.phpt b/ext/standard/tests/array/array_chunk_variation11.phpt index dca366652d..09ec255744 100644 --- a/ext/standard/tests/array/array_chunk_variation11.phpt +++ b/ext/standard/tests/array/array_chunk_variation11.phpt @@ -5,11 +5,11 @@ array_chunk() - variation 11 $array = array (0 => 0, 3 => 2); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -20,11 +20,6 @@ array(2) { [3]=> int(2) } -[0] -NULL -NULL -NULL - [1] array(2) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation12.phpt b/ext/standard/tests/array/array_chunk_variation12.phpt index 3b87dbab95..f85f2a8c0d 100644 --- a/ext/standard/tests/array/array_chunk_variation12.phpt +++ b/ext/standard/tests/array/array_chunk_variation12.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 12 <?php $array = array (1 => 1, 5 => 2, 8 => 3); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -21,11 +21,6 @@ array(3) { [8]=> int(3) } -[0] -NULL -NULL -NULL - [1] array(3) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation13.phpt b/ext/standard/tests/array/array_chunk_variation13.phpt index f6369df1c8..5cd6f0ea34 100644 --- a/ext/standard/tests/array/array_chunk_variation13.phpt +++ b/ext/standard/tests/array/array_chunk_variation13.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 13 <?php $array = array (1, 2); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -19,11 +19,6 @@ array(2) { [1]=> int(2) } -[0] -NULL -NULL -NULL - [1] array(2) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation14.phpt b/ext/standard/tests/array/array_chunk_variation14.phpt index f8d1b11790..97fce1e722 100644 --- a/ext/standard/tests/array/array_chunk_variation14.phpt +++ b/ext/standard/tests/array/array_chunk_variation14.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 14 <?php $array = array (0, 1, 2); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -21,11 +21,6 @@ array(3) { [2]=> int(2) } -[0] -NULL -NULL -NULL - [1] array(3) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation15.phpt b/ext/standard/tests/array/array_chunk_variation15.phpt index abec754a3d..c48af63f6c 100644 --- a/ext/standard/tests/array/array_chunk_variation15.phpt +++ b/ext/standard/tests/array/array_chunk_variation15.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 15 <?php $array = array (1, 2, 3); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -21,11 +21,6 @@ array(3) { [2]=> int(3) } -[0] -NULL -NULL -NULL - [1] array(3) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation16.phpt b/ext/standard/tests/array/array_chunk_variation16.phpt index 18179c8b07..3426f9278b 100644 --- a/ext/standard/tests/array/array_chunk_variation16.phpt +++ b/ext/standard/tests/array/array_chunk_variation16.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 16 <?php $array = array (0, 1, 2, 3); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -23,11 +23,6 @@ array(4) { [3]=> int(3) } -[0] -NULL -NULL -NULL - [1] array(4) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation17.phpt b/ext/standard/tests/array/array_chunk_variation17.phpt index 27507ea8cd..1a8bb5d340 100644 --- a/ext/standard/tests/array/array_chunk_variation17.phpt +++ b/ext/standard/tests/array/array_chunk_variation17.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 17 <?php $array = array (1, 2, 3, 4); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -23,11 +23,6 @@ array(4) { [3]=> int(4) } -[0] -NULL -NULL -NULL - [1] array(4) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation18.phpt b/ext/standard/tests/array/array_chunk_variation18.phpt index 7f0946f497..593c702ce9 100644 --- a/ext/standard/tests/array/array_chunk_variation18.phpt +++ b/ext/standard/tests/array/array_chunk_variation18.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 18 <?php $array = array (0, 1, 2, 3, 4); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -25,11 +25,6 @@ array(5) { [4]=> int(4) } -[0] -NULL -NULL -NULL - [1] array(5) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation19.phpt b/ext/standard/tests/array/array_chunk_variation19.phpt index d51389c9f3..f160cba263 100644 --- a/ext/standard/tests/array/array_chunk_variation19.phpt +++ b/ext/standard/tests/array/array_chunk_variation19.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 19 <?php $array = array (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -35,11 +35,6 @@ array(10) { [9]=> int(10) } -[0] -NULL -NULL -NULL - [1] array(10) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation20.phpt b/ext/standard/tests/array/array_chunk_variation20.phpt index cd5314ff04..d47279915c 100644 --- a/ext/standard/tests/array/array_chunk_variation20.phpt +++ b/ext/standard/tests/array/array_chunk_variation20.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 20 <?php $array = array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -37,11 +37,6 @@ array(11) { [10]=> int(10) } -[0] -NULL -NULL -NULL - [1] array(11) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation21.phpt b/ext/standard/tests/array/array_chunk_variation21.phpt index 678bf16751..e8c7784325 100644 --- a/ext/standard/tests/array/array_chunk_variation21.phpt +++ b/ext/standard/tests/array/array_chunk_variation21.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 21 <?php $array = array ("a" => 1); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { ["a"]=> int(1) } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation22.phpt b/ext/standard/tests/array/array_chunk_variation22.phpt index 45c458ebf9..b0eeade3ab 100644 --- a/ext/standard/tests/array/array_chunk_variation22.phpt +++ b/ext/standard/tests/array/array_chunk_variation22.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 22 <?php $array = array ("b" => 1, "c" => 2); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -19,11 +19,6 @@ array(2) { ["c"]=> int(2) } -[0] -NULL -NULL -NULL - [1] array(2) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation23.phpt b/ext/standard/tests/array/array_chunk_variation23.phpt index 80b92985b1..87ced15132 100644 --- a/ext/standard/tests/array/array_chunk_variation23.phpt +++ b/ext/standard/tests/array/array_chunk_variation23.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 23 <?php $array = array ("p" => 1, "q" => 2, "r" => 3, "s" => 4, "u" => 5, "v" => 6); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -27,11 +27,6 @@ array(6) { ["v"]=> int(6) } -[0] -NULL -NULL -NULL - [1] array(6) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation24.phpt b/ext/standard/tests/array/array_chunk_variation24.phpt index e25f53f6b6..69dce7be17 100644 --- a/ext/standard/tests/array/array_chunk_variation24.phpt +++ b/ext/standard/tests/array/array_chunk_variation24.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 24 <?php $array = array ("a" => "A"); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { ["a"]=> string(1) "A" } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation25.phpt b/ext/standard/tests/array/array_chunk_variation25.phpt index eae89e952b..09303c30ba 100644 --- a/ext/standard/tests/array/array_chunk_variation25.phpt +++ b/ext/standard/tests/array/array_chunk_variation25.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 25 <?php $array = array ("p" => "A", "q" => "B", "r" => "C", "s" => "D", "u" => "E", "v" => "F"); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -27,11 +27,6 @@ array(6) { ["v"]=> string(1) "F" } -[0] -NULL -NULL -NULL - [1] array(6) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation26.phpt b/ext/standard/tests/array/array_chunk_variation26.phpt index 487f6b4f67..ca6975a64e 100644 --- a/ext/standard/tests/array/array_chunk_variation26.phpt +++ b/ext/standard/tests/array/array_chunk_variation26.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 26 <?php $array =array (0); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { [0]=> int(0) } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation27.phpt b/ext/standard/tests/array/array_chunk_variation27.phpt index a83a16b7fb..aa91036a52 100644 --- a/ext/standard/tests/array/array_chunk_variation27.phpt +++ b/ext/standard/tests/array/array_chunk_variation27.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 27 <?php $array = array (1); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { [0]=> int(1) } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation28.phpt b/ext/standard/tests/array/array_chunk_variation28.phpt index bdbaf45cbd..5389049ce4 100644 --- a/ext/standard/tests/array/array_chunk_variation28.phpt +++ b/ext/standard/tests/array/array_chunk_variation28.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 28 <?php $array = array (-1); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { [0]=> int(-1) } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation29.phpt b/ext/standard/tests/array/array_chunk_variation29.phpt index 12f50c1190..f18de5ea85 100644 --- a/ext/standard/tests/array/array_chunk_variation29.phpt +++ b/ext/standard/tests/array/array_chunk_variation29.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 29 <?php $array = array (0, 2); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -19,11 +19,6 @@ array(2) { [1]=> int(2) } -[0] -NULL -NULL -NULL - [1] array(2) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation30.phpt b/ext/standard/tests/array/array_chunk_variation30.phpt index 281537a876..0dbd9b6368 100644 --- a/ext/standard/tests/array/array_chunk_variation30.phpt +++ b/ext/standard/tests/array/array_chunk_variation30.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 30 <?php $array = array (1, 2, 3); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -21,11 +21,6 @@ array(3) { [2]=> int(3) } -[0] -NULL -NULL -NULL - [1] array(3) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation31.phpt b/ext/standard/tests/array/array_chunk_variation31.phpt index 1592679839..fd7f358ca0 100644 --- a/ext/standard/tests/array/array_chunk_variation31.phpt +++ b/ext/standard/tests/array/array_chunk_variation31.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 31 <?php $array = array (1 => 0); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { [1]=> int(0) } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation32.phpt b/ext/standard/tests/array/array_chunk_variation32.phpt index cf65993c0b..09471a59aa 100644 --- a/ext/standard/tests/array/array_chunk_variation32.phpt +++ b/ext/standard/tests/array/array_chunk_variation32.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 32 <?php $array = array (2 => 1); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { [2]=> int(1) } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation5.phpt b/ext/standard/tests/array/array_chunk_variation5.phpt index 50050892e7..21f1a3dce2 100644 --- a/ext/standard/tests/array/array_chunk_variation5.phpt +++ b/ext/standard/tests/array/array_chunk_variation5.phpt @@ -26,26 +26,33 @@ $sizes = array(-1, count($input_array) + 1, 0, 1.5); // loop through the array for size argument foreach ($sizes as $size){ - echo "\n-- Testing array_chunk() when size = $size --\n"; - var_dump( array_chunk($input_array, $size) ); - var_dump( array_chunk($input_array, $size, true) ); - var_dump( array_chunk($input_array, $size, false) ); + echo "\n-- Testing array_chunk() when size = $size --\n"; + try { + var_dump( array_chunk($input_array, $size) ); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } + try { + var_dump( array_chunk($input_array, $size, true) ); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } + try { + var_dump( array_chunk($input_array, $size, false) ); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } } -echo "Done"; ?> ---EXPECTF-- + +DONE +--EXPECT-- *** Testing array_chunk() : usage variations *** -- Testing array_chunk() when size = -1 -- - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL +Size parameter expected to be greater than 0 +Size parameter expected to be greater than 0 +Size parameter expected to be greater than 0 -- Testing array_chunk() when size = 4 -- array(1) { @@ -83,15 +90,9 @@ array(1) { } -- Testing array_chunk() when size = 0 -- - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL - -Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d -NULL +Size parameter expected to be greater than 0 +Size parameter expected to be greater than 0 +Size parameter expected to be greater than 0 -- Testing array_chunk() when size = 1.5 -- array(3) { @@ -145,4 +146,5 @@ array(3) { int(3) } } -Done + +DONE diff --git a/ext/standard/tests/array/array_chunk_variation8.phpt b/ext/standard/tests/array/array_chunk_variation8.phpt index 6a6e752ecb..64b9bb2036 100644 --- a/ext/standard/tests/array/array_chunk_variation8.phpt +++ b/ext/standard/tests/array/array_chunk_variation8.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 8 <?php $array = array (3 => -1); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -17,11 +17,6 @@ array(1) { [3]=> int(-1) } -[0] -NULL -NULL -NULL - [1] array(1) { [0]=> diff --git a/ext/standard/tests/array/array_chunk_variation9.phpt b/ext/standard/tests/array/array_chunk_variation9.phpt index ec57da4f88..a68240e6f6 100644 --- a/ext/standard/tests/array/array_chunk_variation9.phpt +++ b/ext/standard/tests/array/array_chunk_variation9.phpt @@ -4,11 +4,11 @@ array_chunk() - variation 9 <?php $array = array (1 => 0, 2 => 2); var_dump ($array); -for ($i = 0; $i < (sizeof($array) + 1); $i++) { +for ($i = 1; $i < (sizeof($array) + 1); $i++) { echo "[$i]\n"; - var_dump (@array_chunk ($array, $i)); - var_dump (@array_chunk ($array, $i, TRUE)); - var_dump (@array_chunk ($array, $i, FALSE)); + var_dump (array_chunk ($array, $i)); + var_dump (array_chunk ($array, $i, TRUE)); + var_dump (array_chunk ($array, $i, FALSE)); echo "\n"; } ?> @@ -19,11 +19,6 @@ array(2) { [2]=> int(2) } -[0] -NULL -NULL -NULL - [1] array(2) { [0]=> diff --git a/ext/standard/tests/array/array_column_error.phpt b/ext/standard/tests/array/array_column_error.phpt index 26a09aff24..6fb5169d45 100644 --- a/ext/standard/tests/array/array_column_error.phpt +++ b/ext/standard/tests/array/array_column_error.phpt @@ -10,73 +10,51 @@ Test array_column() function: error conditions */ echo "*** Testing array_column() : error conditions ***\n"; - -echo "\n-- Testing array_column() function with Zero arguments --\n"; -var_dump(array_column()); - -echo "\n-- Testing array_column() function with One argument --\n"; -var_dump(array_column(array())); - -echo "\n-- Testing array_column() function with string as first parameter --\n"; -var_dump(array_column('foo', 0)); - -echo "\n-- Testing array_column() function with int as first parameter --\n"; -var_dump(array_column(1, 'foo')); - echo "\n-- Testing array_column() column key parameter should be a string or an integer (testing bool) --\n"; -var_dump(array_column(array(), true)); +try { + var_dump(array_column(array(), true)); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} + echo "\n-- Testing array_column() column key parameter should be a string or integer (testing array) --\n"; -var_dump(array_column(array(), array())); +try { + var_dump(array_column(array(), array())); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} echo "\n-- Testing array_column() index key parameter should be a string or an integer (testing bool) --\n"; -var_dump(array_column(array(), 'foo', true)); +try { + var_dump(array_column(array(), 'foo', true)); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} echo "\n-- Testing array_column() index key parameter should be a string or integer (testing array) --\n"; -var_dump(array_column(array(), 'foo', array())); +try { + var_dump(array_column(array(), 'foo', array())); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} -echo "Done\n"; ?> ---EXPECTF-- -*** Testing array_column() : error conditions *** - --- Testing array_column() function with Zero arguments -- - -Warning: array_column() expects at least 2 parameters, 0 given in %s on line %d -NULL --- Testing array_column() function with One argument -- - -Warning: array_column() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing array_column() function with string as first parameter -- - -Warning: array_column() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Testing array_column() function with int as first parameter -- - -Warning: array_column() expects parameter 1 to be array, int given in %s on line %d -NULL +DONE +--EXPECT-- +*** Testing array_column() : error conditions *** -- Testing array_column() column key parameter should be a string or an integer (testing bool) -- - -Warning: array_column(): The column key should be either a string or an integer in %s on line %d -bool(false) +The column key should be either a string or an integer -- Testing array_column() column key parameter should be a string or integer (testing array) -- - -Warning: array_column(): The column key should be either a string or an integer in %s on line %d -bool(false) +The column key should be either a string or an integer -- Testing array_column() index key parameter should be a string or an integer (testing bool) -- - -Warning: array_column(): The index key should be either a string or an integer in %s on line %d -bool(false) +The index key should be either a string or an integer -- Testing array_column() index key parameter should be a string or integer (testing array) -- +The index key should be either a string or an integer -Warning: array_column(): The index key should be either a string or an integer in %s on line %d -bool(false) -Done +DONE diff --git a/ext/standard/tests/array/array_combine_error2.phpt b/ext/standard/tests/array/array_combine_error2.phpt index 2d820a0d21..463dc6dfe8 100644 --- a/ext/standard/tests/array/array_combine_error2.phpt +++ b/ext/standard/tests/array/array_combine_error2.phpt @@ -16,19 +16,32 @@ var_dump( array_combine(array(), array()) ); // Testing array_combine by passing empty array to $keys echo "\n-- Testing array_combine() function with empty array for \$keys argument --\n"; -var_dump( array_combine(array(), array(1, 2)) ); +try { + var_dump( array_combine(array(), array(1, 2)) ); +} catch (\Error $e) { + echo $e->getMessage(); +} // Testing array_combine by passing empty array to $values echo "\n-- Testing array_combine() function with empty array for \$values argument --\n"; -var_dump( array_combine(array(1, 2), array()) ); +try { + var_dump( array_combine(array(1, 2), array()) ); +} catch (\Error $e) { + echo $e->getMessage(); +} // Testing array_combine with arrays having unequal number of elements echo "\n-- Testing array_combine() function by passing array with unequal number of elements --\n"; -var_dump( array_combine(array(1, 2), array(1, 2, 3)) ); +try { + var_dump( array_combine(array(1, 2), array(1, 2, 3)) ); +} catch (\Error $e) { + echo $e->getMessage(); +} -echo "Done"; ?> ---EXPECTF-- + +DONE +--EXPECT-- *** Testing array_combine() : error conditions specific to array_combine() *** -- Testing array_combine() function with empty arrays -- @@ -36,17 +49,9 @@ array(0) { } -- Testing array_combine() function with empty array for $keys argument -- - -Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d -bool(false) - +Both parameters should have an equal number of elements -- Testing array_combine() function with empty array for $values argument -- - -Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d -bool(false) - +Both parameters should have an equal number of elements -- Testing array_combine() function by passing array with unequal number of elements -- - -Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d -bool(false) -Done +Both parameters should have an equal number of elements +DONE diff --git a/ext/standard/tests/array/array_diff_1.phpt b/ext/standard/tests/array/array_diff_1.phpt index a7ee015346..2e2b135128 100644 --- a/ext/standard/tests/array/array_diff_1.phpt +++ b/ext/standard/tests/array/array_diff_1.phpt @@ -6,10 +6,14 @@ Test array_diff when non-array is passed $a = array(); $b = 3; $c = array(5); -array_diff($a, $b, $c); +try { + array_diff($a, $b, $c); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //-=-=-=-=-=- echo "OK!"; ?> --EXPECTF-- -Warning: array_diff(): Expected parameter 2 to be an array, int given in %s +Expected parameter 2 to be an array, int given OK! diff --git a/ext/standard/tests/array/array_diff_assoc_error.phpt b/ext/standard/tests/array/array_diff_assoc_error.phpt index fc8c70c67c..6aa7864ee9 100644 --- a/ext/standard/tests/array/array_diff_assoc_error.phpt +++ b/ext/standard/tests/array/array_diff_assoc_error.phpt @@ -16,13 +16,20 @@ echo "*** Testing array_diff_assoc() : error conditions ***\n"; // Zero arguments echo "\n-- Testing array_diff_assoc() function with zero arguments --\n"; -var_dump( array_diff_assoc() ); +try { + var_dump( array_diff_assoc() ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_diff_assoc with one less than the expected number of arguments echo "\n-- Testing array_diff_assoc() function with less than expected no. of arguments --\n"; $arr1 = array(1, 2); -var_dump( array_diff_assoc($arr1) ); - +try { + var_dump( array_diff_assoc($arr1) ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -30,12 +37,8 @@ echo "Done"; *** Testing array_diff_assoc() : error conditions *** -- Testing array_diff_assoc() function with zero arguments -- - -Warning: array_diff_assoc(): at least 2 parameters are required, 0 given in %s on line %d -NULL +At least 2 parameters are required, 0 given -- Testing array_diff_assoc() function with less than expected no. of arguments -- - -Warning: array_diff_assoc(): at least 2 parameters are required, 1 given in %s on line %d -NULL +At least 2 parameters are required, 1 given Done diff --git a/ext/standard/tests/array/array_diff_assoc_variation1.phpt b/ext/standard/tests/array/array_diff_assoc_variation1.phpt index 2172e695d3..270660a8cf 100644 --- a/ext/standard/tests/array/array_diff_assoc_variation1.phpt +++ b/ext/standard/tests/array/array_diff_assoc_variation1.phpt @@ -91,143 +91,95 @@ $inputs = array( // loop through each element of $inputs to check the behavior of array_diff_assoc $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_diff_assoc($input, $array)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + try { + var_dump(array_diff_assoc($input, $array)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_diff_assoc() : usage variations *** -- Iteration 1 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given -- Iteration 2 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given -- Iteration 3 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given -- Iteration 4 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given -- Iteration 5 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given -- Iteration 6 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given -- Iteration 7 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given -- Iteration 8 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given -- Iteration 9 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given -- Iteration 10 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given -- Iteration 11 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given -- Iteration 12 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given -- Iteration 13 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given -- Iteration 14 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given -- Iteration 15 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given -- Iteration 16 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given -- Iteration 17 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given -- Iteration 18 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given -- Iteration 19 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given -- Iteration 20 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given -- Iteration 21 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given -- Iteration 22 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given -- Iteration 23 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given -- Iteration 24 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given -- Iteration 25 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given -- Iteration 26 -- - -Warning: array_diff_assoc(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +Expected parameter 1 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_diff_assoc_variation2.phpt b/ext/standard/tests/array/array_diff_assoc_variation2.phpt index a57f10fce0..9185b53439 100644 --- a/ext/standard/tests/array/array_diff_assoc_variation2.phpt +++ b/ext/standard/tests/array/array_diff_assoc_variation2.phpt @@ -91,143 +91,95 @@ $inputs = array( // loop through each element of $inputs to check the behavior of array_diff_assoc $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_diff_assoc($array, $input)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + try { + var_dump(array_diff_assoc($array, $input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_diff_assoc() : usage variations *** -- Iteration 1 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 2 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 3 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 4 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 5 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 6 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 7 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 8 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 9 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 10 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 11 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 12 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 13 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 14 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 15 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 16 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 17 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 18 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 19 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 20 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 21 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 22 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 23 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given -- Iteration 24 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 25 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 26 -- - -Warning: array_diff_assoc(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_diff_error.phpt b/ext/standard/tests/array/array_diff_error.phpt index 25be6e1c55..d269f010b8 100644 --- a/ext/standard/tests/array/array_diff_error.phpt +++ b/ext/standard/tests/array/array_diff_error.phpt @@ -15,13 +15,21 @@ Test array_diff() function : error conditions - too few arguments passed to func echo "*** Testing array_diff() : error conditions ***\n"; // Zero arguments echo "\n-- Testing array_diff() function with zero arguments --\n"; -var_dump( array_diff() ); +try { + var_dump( array_diff() ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_diff with one less than the expected number of arguments echo "\n-- Testing array_diff() function with less than expected no. of arguments --\n"; $arr1 = array(1, 2); -var_dump( array_diff($arr1) ); +try { + var_dump( array_diff($arr1) ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -29,12 +37,8 @@ echo "Done"; *** Testing array_diff() : error conditions *** -- Testing array_diff() function with zero arguments -- - -Warning: array_diff(): at least 2 parameters are required, 0 given in %s on line %d -NULL +At least 2 parameters are required, 0 given -- Testing array_diff() function with less than expected no. of arguments -- - -Warning: array_diff(): at least 2 parameters are required, 1 given in %s on line %d -NULL +At least 2 parameters are required, 1 given Done diff --git a/ext/standard/tests/array/array_diff_key_error.phpt b/ext/standard/tests/array/array_diff_key_error.phpt index 05d5cf3c27..ec5ef10ba8 100644 --- a/ext/standard/tests/array/array_diff_key_error.phpt +++ b/ext/standard/tests/array/array_diff_key_error.phpt @@ -14,23 +14,27 @@ $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); // Testing array_diff_key with one less than the expected number of arguments echo "\n-- Testing array_diff_key() function with less than expected no. of arguments --\n"; -var_dump( array_diff_key($array1) ); +try { + var_dump( array_diff_key($array1) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_diff_key with no arguments echo "\n-- Testing array_diff_key() function with no arguments --\n"; -var_dump( array_diff_key() ); +try { + var_dump( array_diff_key() ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== --EXPECTF-- *** Testing array_diff_key() : error conditions *** -- Testing array_diff_key() function with less than expected no. of arguments -- - -Warning: array_diff_key(): at least 2 parameters are required, 1 given in %s on line %d -NULL +At least 2 parameters are required, 1 given -- Testing array_diff_key() function with no arguments -- - -Warning: array_diff_key(): at least 2 parameters are required, 0 given in %s on line %d -NULL +At least 2 parameters are required, 0 given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_key_variation1.phpt b/ext/standard/tests/array/array_diff_key_variation1.phpt index 3e689a0e8f..f47042f009 100644 --- a/ext/standard/tests/array/array_diff_key_variation1.phpt +++ b/ext/standard/tests/array/array_diff_key_variation1.phpt @@ -89,222 +89,126 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_key($value, $array2) ); - var_dump( array_diff_key($value, $array2, $array3) ); + echo "\n--$key--\n"; + try { + var_dump( array_diff_key($value, $array2) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_diff_key($value, $array2, $array3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_key() : usage variation *** --int 0-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --resource-- - -Warning: array_diff_key(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +Expected parameter 1 to be an array, resource given +Expected parameter 1 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_key_variation2.phpt b/ext/standard/tests/array/array_diff_key_variation2.phpt index fb0bcd6796..24ddffb530 100644 --- a/ext/standard/tests/array/array_diff_key_variation2.phpt +++ b/ext/standard/tests/array/array_diff_key_variation2.phpt @@ -90,222 +90,126 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_key($array1, $value) ); - var_dump( array_diff_key($array1, $value, $array3) ); + echo "\n--$key--\n"; + try { + var_dump( array_diff_key($array1, $value) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_diff_key($array1, $value, $array3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_key() : usage variation *** --int 0-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --resource-- - -Warning: array_diff_key(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL - -Warning: array_diff_key(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given +Expected parameter 2 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_key_variation3.phpt b/ext/standard/tests/array/array_diff_key_variation3.phpt deleted file mode 100644 index 36741dba33..0000000000 --- a/ext/standard/tests/array/array_diff_key_variation3.phpt +++ /dev/null @@ -1,232 +0,0 @@ ---TEST-- -Test array_diff_key() function : usage variation - Passing unexpected values to third optional argument ---FILE-- -<?php -/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...]) - * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments. - * Source code: ext/standard/array.c - */ - -echo "*** Testing array_diff_key() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); -$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//resource variable -$fp = fopen(__FILE__, "r"); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource data - 'resource' => $fp, -); - -// loop through each element of the array for arr1 - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_key($array1, $array2, $value) ); -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing array_diff_key() : usage variation *** - ---int 0-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 1-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 12345-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int -12345-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---float 10.5-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -10.5-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float .5-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---uppercase NULL-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase null-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase true-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---lowercase false-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase TRUE-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase FALSE-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---empty string DQ-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---empty string SQ-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string DQ-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string SQ-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---mixed case string-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---heredoc-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---instance of classWithToString-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---undefined var-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---unset var-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---resource-- - -Warning: array_diff_key(): Expected parameter 3 to be an array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_error.phpt b/ext/standard/tests/array/array_diff_uassoc_error.phpt index d90c80f20b..13881f6993 100644 --- a/ext/standard/tests/array/array_diff_uassoc_error.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_error.phpt @@ -27,36 +27,34 @@ function key_compare_func($a, $b) //Test array_diff_uassoc with one more than the expected number of arguments echo "\n-- Testing array_diff_uassoc() function with more than expected no. of arguments --\n"; -var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) ); -var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) ); +try { + var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_diff_uassoc with one less than the expected number of arguments echo "\n-- Testing array_diff_uassoc() function with less than expected no. of arguments --\n"; -var_dump( array_diff_uassoc($array1, $array2) ); +try { + var_dump( array_diff_uassoc($array1, $array2) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} -// Testing array_diff_uassoc with no arguments -echo "\n-- Testing array_diff_uassoc() function with no arguments --\n"; -var_dump( array_diff_uassoc() ); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_uassoc() : error conditions *** -- Testing array_diff_uassoc() function with more than expected no. of arguments -- - -Warning: array_diff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %s on line %d -NULL - -Warning: array_diff_uassoc() expects parameter 6 to be a valid callback, array must have exactly two members in %s on line %d -NULL +array_diff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members +array_diff_uassoc() expects parameter 6 to be a valid callback, array must have exactly two members -- Testing array_diff_uassoc() function with less than expected no. of arguments -- - -Warning: array_diff_uassoc(): at least 3 parameters are required, 2 given in %s on line %d -NULL - --- Testing array_diff_uassoc() function with no arguments -- - -Warning: array_diff_uassoc(): at least 3 parameters are required, 0 given in %s on line %d -NULL +At least 3 parameters are required, 2 given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation1.phpt b/ext/standard/tests/array/array_diff_uassoc_variation1.phpt index aad42705db..03f3160a00 100644 --- a/ext/standard/tests/array/array_diff_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_variation1.phpt @@ -102,143 +102,95 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_uassoc($value, $array2, "key_compare_func") ); + echo "\n--$key--\n"; + try { + var_dump( array_diff_uassoc($value, $array2, "key_compare_func") ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_uassoc() : usage variation *** --int 0-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given --resource-- - -Warning: array_diff_uassoc(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +Expected parameter 1 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation2.phpt b/ext/standard/tests/array/array_diff_uassoc_variation2.phpt index ae664f9812..7ca05b1fd0 100644 --- a/ext/standard/tests/array/array_diff_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_variation2.phpt @@ -102,143 +102,95 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_uassoc($array1, $value, "key_compare_func") ); + echo "\n--$key--\n"; + try { + var_dump( array_diff_uassoc($array1, $value, "key_compare_func") ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_uassoc() : usage variation *** --int 0-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given --resource-- - -Warning: array_diff_uassoc(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_uassoc_variation4.phpt b/ext/standard/tests/array/array_diff_uassoc_variation4.phpt deleted file mode 100644 index 8ea51a4103..0000000000 --- a/ext/standard/tests/array/array_diff_uassoc_variation4.phpt +++ /dev/null @@ -1,246 +0,0 @@ ---TEST-- -Test array_diff_uassoc() function : usage variation -Passing unexpected values as third optional argument ---FILE-- -<?php -/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func) - * Description: Computes the difference of arrays with additional index check which is performed by a - * user supplied callback function - * Source code: ext/standard/array.c - */ - -echo "*** Testing array_diff_uassoc() : usage variation ***\n"; - -//Initialize variables -$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); -$array2 = array("a" => "green", "yellow", "red"); - - -function key_compare_func($a, $b) -{ - if ($a === $b) { - return 0; - } - return ($a > $b)? 1:-1; -} - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//resource variable -$fp = fopen(__FILE__, "r"); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource data - 'resource' => $fp, -); - -// loop through each element of the array for arr2 - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_uassoc($array1, $array2, $value, "key_compare_func") ); -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing array_diff_uassoc() : usage variation *** - ---int 0-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 1-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 12345-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int -12345-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---float 10.5-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -10.5-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float .5-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---uppercase NULL-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase null-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase true-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---lowercase false-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase TRUE-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase FALSE-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---empty string DQ-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---empty string SQ-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string DQ-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string SQ-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---mixed case string-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---heredoc-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---instance of classWithToString-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---undefined var-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---unset var-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---resource-- - -Warning: array_diff_uassoc(): Expected parameter 3 to be an array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation1.phpt b/ext/standard/tests/array/array_diff_ukey_variation1.phpt index bbf349c4fd..3b591018bd 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation1.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation1.phpt @@ -97,222 +97,126 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_ukey($value, $array2, 'key_compare_func') ); - var_dump( array_diff_ukey($value, $array2, $array3, 'key_compare_func') ); + echo "\n--$key--\n"; + try { + var_dump( array_diff_ukey($value, $array2, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_diff_ukey($value, $array2, $array3, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_ukey() : usage variation *** --int 0-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --resource-- - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +Expected parameter 1 to be an array, resource given +Expected parameter 1 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation10.phpt b/ext/standard/tests/array/array_diff_ukey_variation10.phpt index 09b4a70237..e80f02629e 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation10.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation10.phpt @@ -14,27 +14,23 @@ $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); $array2 = array("a" => "green", "yellow", "red"); //function name within double quotes -var_dump( array_diff_ukey($array1, $array1, "unknown_function") ); +try { + var_dump( array_diff_ukey($array1, $array1, "unknown_function") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //function name within single quotes -var_dump( array_diff_ukey($array1, $array1, 'unknown_function') ); - -//function name without quotes -var_dump( array_diff_ukey($array1, $array1, unknown_function) ); +try { + var_dump( array_diff_ukey($array1, $array1, 'unknown_function') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_ukey() : usage variation *** - -Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL - -Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL - -Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d - -Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL +array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name +array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name ===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation2.phpt b/ext/standard/tests/array/array_diff_ukey_variation2.phpt index 38141a430c..3638afcb53 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation2.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation2.phpt @@ -101,222 +101,126 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_ukey($array1, $value, 'key_compare_func') ); - var_dump( array_diff_ukey($array1, $value, $array3, 'key_compare_func') ); + echo "\n--$key--\n"; + try { + var_dump( array_diff_ukey($array1, $value, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_diff_ukey($array1, $value, $array3, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_ukey() : usage variation *** --int 0-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --resource-- - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL - -Warning: array_diff_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given +Expected parameter 2 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation3.phpt b/ext/standard/tests/array/array_diff_ukey_variation3.phpt deleted file mode 100644 index 572061d697..0000000000 --- a/ext/standard/tests/array/array_diff_ukey_variation3.phpt +++ /dev/null @@ -1,240 +0,0 @@ ---TEST-- -Test array_diff_ukey() function : usage variation - Passing unexpected values to third optional argument ---FILE-- -<?php -/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func) - * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments. - * Source code: ext/standard/array.c - */ - -echo "*** Testing array_diff_ukey() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$array1 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); -$array2 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); - -function key_compare_func($key1, $key2) -{ - if ($key1 == $key2) { - return 0; - } - return ($key1 > $key2)? 1:-1; -} - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// resource variable -$fp = fopen(__FILE__, "r"); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource data - 'resource' => $fp, -); - -// loop through each element of the array for key_comp_func - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_diff_ukey($array1, $array2, $value, 'key_compare_func') ); -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing array_diff_ukey() : usage variation *** - ---int 0-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 1-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 12345-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int -12345-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---float 10.5-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -10.5-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float .5-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---uppercase NULL-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase null-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase true-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---lowercase false-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase TRUE-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase FALSE-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---empty string DQ-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---empty string SQ-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string DQ-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string SQ-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---mixed case string-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---heredoc-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---instance of classWithToString-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---undefined var-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---unset var-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---resource-- - -Warning: array_diff_ukey(): Expected parameter 3 to be an array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_diff_variation1.phpt b/ext/standard/tests/array/array_diff_variation1.phpt index e162c523d6..5b92231642 100644 --- a/ext/standard/tests/array/array_diff_variation1.phpt +++ b/ext/standard/tests/array/array_diff_variation1.phpt @@ -91,118 +91,70 @@ $inputs = array( // loop through each element of $inputs to check the behavior of array_diff $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --"; - var_dump( array_diff($input, $array)); - $iterator++; + echo "\n-- Iteration $iterator --"; + try { + var_dump( array_diff($input, $array)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_diff() : usage variations *** --- Iteration 1 -- -Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- Iteration 1 --Expected parameter 1 to be an array, int given --- Iteration 2 -- -Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- Iteration 2 --Expected parameter 1 to be an array, int given --- Iteration 3 -- -Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- Iteration 3 --Expected parameter 1 to be an array, int given --- Iteration 4 -- -Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- Iteration 4 --Expected parameter 1 to be an array, int given --- Iteration 5 -- -Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- Iteration 5 --Expected parameter 1 to be an array, float given --- Iteration 6 -- -Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- Iteration 6 --Expected parameter 1 to be an array, float given --- Iteration 7 -- -Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- Iteration 7 --Expected parameter 1 to be an array, float given --- Iteration 8 -- -Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- Iteration 8 --Expected parameter 1 to be an array, float given --- Iteration 9 -- -Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- Iteration 9 --Expected parameter 1 to be an array, float given --- Iteration 10 -- -Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 10 --Expected parameter 1 to be an array, null given --- Iteration 11 -- -Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 11 --Expected parameter 1 to be an array, null given --- Iteration 12 -- -Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 12 --Expected parameter 1 to be an array, bool given --- Iteration 13 -- -Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 13 --Expected parameter 1 to be an array, bool given --- Iteration 14 -- -Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 14 --Expected parameter 1 to be an array, bool given --- Iteration 15 -- -Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 15 --Expected parameter 1 to be an array, bool given --- Iteration 16 -- -Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 16 --Expected parameter 1 to be an array, string given --- Iteration 17 -- -Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 17 --Expected parameter 1 to be an array, string given --- Iteration 18 -- -Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 18 --Expected parameter 1 to be an array, string given --- Iteration 19 -- -Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 19 --Expected parameter 1 to be an array, string given --- Iteration 20 -- -Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 20 --Expected parameter 1 to be an array, string given --- Iteration 21 -- -Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 21 --Expected parameter 1 to be an array, string given --- Iteration 22 -- -Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 22 --Expected parameter 1 to be an array, string given --- Iteration 23 -- -Warning: array_diff(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +-- Iteration 23 --Expected parameter 1 to be an array, object given --- Iteration 24 -- -Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 24 --Expected parameter 1 to be an array, null given --- Iteration 25 -- -Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 25 --Expected parameter 1 to be an array, null given --- Iteration 26 -- -Warning: array_diff(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +-- Iteration 26 --Expected parameter 1 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_diff_variation2.phpt b/ext/standard/tests/array/array_diff_variation2.phpt index 5f8183b88d..a9ddb22b82 100644 --- a/ext/standard/tests/array/array_diff_variation2.phpt +++ b/ext/standard/tests/array/array_diff_variation2.phpt @@ -91,117 +91,69 @@ $inputs = array( // loop through each element of $inputs to check the behavior of array_diff $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --"; - var_dump( array_diff($array, $input)); - $iterator++; + echo "\n-- Iteration $iterator --"; + try { + var_dump( array_diff($array, $input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_diff() : usage variations *** --- Iteration 1 -- -Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 1 --Expected parameter 2 to be an array, int given --- Iteration 2 -- -Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 2 --Expected parameter 2 to be an array, int given --- Iteration 3 -- -Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 3 --Expected parameter 2 to be an array, int given --- Iteration 4 -- -Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 4 --Expected parameter 2 to be an array, int given --- Iteration 5 -- -Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 5 --Expected parameter 2 to be an array, float given --- Iteration 6 -- -Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 6 --Expected parameter 2 to be an array, float given --- Iteration 7 -- -Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 7 --Expected parameter 2 to be an array, float given --- Iteration 8 -- -Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 8 --Expected parameter 2 to be an array, float given --- Iteration 9 -- -Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 9 --Expected parameter 2 to be an array, float given --- Iteration 10 -- -Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 10 --Expected parameter 2 to be an array, null given --- Iteration 11 -- -Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 11 --Expected parameter 2 to be an array, null given --- Iteration 12 -- -Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 12 --Expected parameter 2 to be an array, bool given --- Iteration 13 -- -Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 13 --Expected parameter 2 to be an array, bool given --- Iteration 14 -- -Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 14 --Expected parameter 2 to be an array, bool given --- Iteration 15 -- -Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 15 --Expected parameter 2 to be an array, bool given --- Iteration 16 -- -Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 16 --Expected parameter 2 to be an array, string given --- Iteration 17 -- -Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 17 --Expected parameter 2 to be an array, string given --- Iteration 18 -- -Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 18 --Expected parameter 2 to be an array, string given --- Iteration 19 -- -Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 19 --Expected parameter 2 to be an array, string given --- Iteration 20 -- -Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 20 --Expected parameter 2 to be an array, string given --- Iteration 21 -- -Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 21 --Expected parameter 2 to be an array, string given --- Iteration 22 -- -Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 22 --Expected parameter 2 to be an array, string given --- Iteration 23 -- -Warning: array_diff(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +-- Iteration 23 --Expected parameter 2 to be an array, object given --- Iteration 24 -- -Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 24 --Expected parameter 2 to be an array, null given --- Iteration 25 -- -Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 25 --Expected parameter 2 to be an array, null given --- Iteration 26 -- -Warning: array_diff(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +-- Iteration 26 --Expected parameter 2 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_fill_error.phpt b/ext/standard/tests/array/array_fill_error.phpt index 2fbdb850c3..386404a336 100644 --- a/ext/standard/tests/array/array_fill_error.phpt +++ b/ext/standard/tests/array/array_fill_error.phpt @@ -10,44 +10,16 @@ Test array_fill() function : error conditions echo "*** Testing array_fill() : error conditions ***\n"; -// Zero arguments -echo "-- Testing array_fill() function with Zero arguments --\n"; -var_dump( array_fill() ); - -// More than expected number of arguments -echo "-- Testing array_fill() function with more than expected no. of arguments --\n"; +// calling array_fill with negative values for 'num' parameter $start_key = 0; -$num = 2; -$val = 1; -$extra_arg = 10; -var_dump( array_fill($start_key,$num,$val, $extra_arg) ); - -// Less than the expected number of arguments -echo "-- Testing array_fill() function with less than expected no. of arguments --\n"; -$start_key = 0; -$num = 2; -var_dump( array_fill($start_key,$num) ); - -//calling array_fill with negative values for 'num' parameter $num = -1; +$val = 1; var_dump( array_fill($start_key,$num,$val) ); echo "Done"; ?> --EXPECTF-- *** Testing array_fill() : error conditions *** --- Testing array_fill() function with Zero arguments -- - -Warning: array_fill() expects exactly 3 parameters, 0 given in %s on line %d -NULL --- Testing array_fill() function with more than expected no. of arguments -- - -Warning: array_fill() expects exactly 3 parameters, 4 given in %s on line %d -NULL --- Testing array_fill() function with less than expected no. of arguments -- - -Warning: array_fill() expects exactly 3 parameters, 2 given in %s on line %d -NULL Warning: array_fill(): Number of elements can't be negative in %s on line %d bool(false) diff --git a/ext/standard/tests/array/array_fill_keys.phpt b/ext/standard/tests/array/array_fill_keys.phpt index 12adde72e7..fb222a414b 100644 --- a/ext/standard/tests/array/array_fill_keys.phpt +++ b/ext/standard/tests/array/array_fill_keys.phpt @@ -4,15 +4,12 @@ basic array_fill_keys test precision=14 --FILE-- <?php - var_dump(array_fill_keys('test', 1)); var_dump(array_fill_keys(array(), 1)); var_dump(array_fill_keys(array('foo', 'bar'), NULL)); var_dump(array_fill_keys(array('5', 'foo', 10, 1.23), 123)); var_dump(array_fill_keys(array('test', TRUE, 10, 100), '')); ?> ---EXPECTF-- -Warning: array_fill_keys() expects parameter 1 to be array, string given in %s on line %d -NULL +--EXPECT-- array(0) { } array(2) { diff --git a/ext/standard/tests/array/array_fill_keys_variation3.phpt b/ext/standard/tests/array/array_fill_keys_variation3.phpt index 84cc928cbc..b1abbcfe1b 100644 --- a/ext/standard/tests/array/array_fill_keys_variation3.phpt +++ b/ext/standard/tests/array/array_fill_keys_variation3.phpt @@ -12,33 +12,18 @@ Test array_fill_keys() function : variation of parameter echo "*** Testing array_fill_keys() : parameter variations ***\n"; -$simpleStr = "simple"; $fp = fopen(__FILE__, "r"); -$bool = false; -$float = 2.4; $array = array("one", "two"); -$nullVal = null; - -echo "\n-- Testing array_fill_keys() function with both wrong arguments --\n"; -var_dump( array_fill_keys($bool, $float) ); echo "\n-- Testing array_fill_keys() function with unusual second arguments --\n"; var_dump( array_fill_keys($array, $fp) ); -echo "\n-- Testing array_fill_keys() function with mixed array --\n"; -var_dump( array_fill_keys($nullVal, $simpleStr) ); - fclose($fp); echo "Done"; ?> --EXPECTF-- *** Testing array_fill_keys() : parameter variations *** --- Testing array_fill_keys() function with both wrong arguments -- - -Warning: array_fill_keys() expects parameter 1 to be array, bool given in %sarray_fill_keys_variation3.php on line %d -NULL - -- Testing array_fill_keys() function with unusual second arguments -- array(2) { ["one"]=> @@ -46,9 +31,4 @@ array(2) { ["two"]=> resource(%d) of type (stream) } - --- Testing array_fill_keys() function with mixed array -- - -Warning: array_fill_keys() expects parameter 1 to be array, null given in %sarray_fill_keys_variation3.php on line %d -NULL Done diff --git a/ext/standard/tests/array/array_filter.phpt b/ext/standard/tests/array/array_filter.phpt index ba27a59c96..1488aedd09 100644 --- a/ext/standard/tests/array/array_filter.phpt +++ b/ext/standard/tests/array/array_filter.phpt @@ -26,9 +26,6 @@ var_dump(array_filter($array2, "even")); var_dump(array_filter($array3, "even")); var_dump(array_filter(array())); -var_dump(array_filter(array(), array())); -var_dump(array_filter("", null)); -var_dump(array_filter($array1, 1)); echo '== DONE =='; ?> @@ -81,13 +78,4 @@ array(2) { } array(0) { } - -Warning: array_filter() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL - -Warning: array_filter() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL == DONE == diff --git a/ext/standard/tests/array/array_filter_variation10.phpt b/ext/standard/tests/array/array_filter_variation10.phpt index 4749fe8e45..a32fdadc05 100644 --- a/ext/standard/tests/array/array_filter_variation10.phpt +++ b/ext/standard/tests/array/array_filter_variation10.phpt @@ -48,7 +48,11 @@ var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_KEY)); var_dump(array_filter($mixed, 'is_numeric', 0)); -var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_BOTH)); +try { + var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_BOTH)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -88,14 +92,5 @@ array(2) { ["b"]=> int(2) } - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 -array(0) { -} +is_numeric() expects exactly 1 parameter, 2 given Done diff --git a/ext/standard/tests/array/array_filter_variation9.phpt b/ext/standard/tests/array/array_filter_variation9.phpt index a6f5789eae..240f5c10fa 100644 --- a/ext/standard/tests/array/array_filter_variation9.phpt +++ b/ext/standard/tests/array/array_filter_variation9.phpt @@ -13,7 +13,7 @@ Test array_filter() function : usage variations - built-in functions as 'callbac echo "*** Testing array_filter() : usage variations - built-in functions as 'callback' argument ***\n"; -$input = array(0, 1, -1, 10, 100, 1000, 'Hello', null); +$input = array(0, 1, -1, 10, 100, 1000, null); // using built-in function 'is_int' as 'callback' var_dump( array_filter($input, 'is_int') ); @@ -22,10 +22,18 @@ var_dump( array_filter($input, 'is_int') ); var_dump( array_filter($input, 'chr') ); // using language construct 'echo' as 'callback' -var_dump( array_filter($input, 'echo') ); +try { + var_dump( array_filter($input, 'echo') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // using language construct 'exit' as 'callback' -var_dump( array_filter($input, 'exit') ); +try { + var_dump( array_filter($input, 'exit') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -45,9 +53,7 @@ array(6) { [5]=> int(1000) } - -Warning: chr() expects parameter 1 to be int, string given in %s on line %d -array(8) { +array(7) { [0]=> int(0) [1]=> @@ -61,14 +67,8 @@ array(8) { [5]=> int(1000) [6]=> - string(5) "Hello" - [7]=> NULL } - -Warning: array_filter() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL - -Warning: array_filter() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL +array_filter() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name +array_filter() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_intersect_assoc_error.phpt b/ext/standard/tests/array/array_intersect_assoc_error.phpt index a06dbddefe..fa815118ce 100644 --- a/ext/standard/tests/array/array_intersect_assoc_error.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_error.phpt @@ -12,25 +12,29 @@ echo "*** Testing array_intersect_assoc() : error conditions ***\n"; // Zero arguments echo "\n-- Testing array_intersect_assoc() function with Zero arguments --\n"; -var_dump( array_intersect_assoc() ); +try { + var_dump( array_intersect_assoc() ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_intersect_assoc with one less than the expected number of arguments echo "\n-- Testing array_intersect_assoc() function with less than expected no. of arguments --\n"; $arr1 = array(1, 2); -var_dump( array_intersect_assoc($arr1) ); +try { + var_dump( array_intersect_assoc($arr1) ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_assoc() : error conditions *** -- Testing array_intersect_assoc() function with Zero arguments -- - -Warning: array_intersect_assoc(): at least 2 parameters are required, 0 given in %s on line %d -NULL +At least 2 parameters are required, 0 given -- Testing array_intersect_assoc() function with less than expected no. of arguments -- - -Warning: array_intersect_assoc(): at least 2 parameters are required, 1 given in %s on line %d -NULL +At least 2 parameters are required, 1 given Done diff --git a/ext/standard/tests/array/array_intersect_assoc_variation1.phpt b/ext/standard/tests/array/array_intersect_assoc_variation1.phpt index ca11b7cc9b..3490c4f25c 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation1.phpt @@ -93,14 +93,22 @@ $arrays = array( // loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc() $iterator = 1; foreach($arrays as $unexpected_value) { - echo "\n-- Iteration $iterator --"; - - // Calling array_intersect_assoc() with default arguments - var_dump( array_intersect_assoc($unexpected_value, $arr2) ); - - // Calling array_intersect_assoc() with more arguments - var_dump( array_intersect_assoc($unexpected_value, $arr2, $arr3) ); - $iterator++; + echo "\n-- Iteration $iterator --"; + + // Calling array_intersect_assoc() with default arguments + try { + var_dump( array_intersect_assoc($unexpected_value, $arr2) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + // Calling array_intersect_assoc() with more arguments + try { + var_dump( array_intersect_assoc($unexpected_value, $arr2, $arr3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; } // close the file resource used @@ -108,174 +116,78 @@ fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_assoc() : Passing non-array values to $arr1 argument *** --- Iteration 1 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 2 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 3 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 4 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 5 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 6 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 7 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 8 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 9 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 10 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iteration 11 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iteration 12 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - --- Iteration 13 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 1 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 2 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --- Iteration 14 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 3 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 4 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --- Iteration 15 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 5 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iteration 6 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --- Iteration 16 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 7 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 8 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --- Iteration 17 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 9 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 10 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --- Iteration 18 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 11 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 12 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --- Iteration 19 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 13 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 14 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --- Iteration 20 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 15 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iteration 16 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --- Iteration 21 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +-- Iteration 17 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +-- Iteration 18 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --- Iteration 22 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 19 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 20 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --- Iteration 23 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 21 --Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iteration 22 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --- Iteration 24 -- -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +-- Iteration 23 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given -Warning: array_intersect_assoc(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +-- Iteration 24 --Expected parameter 1 to be an array, resource given +Expected parameter 1 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_intersect_assoc_variation2.phpt b/ext/standard/tests/array/array_intersect_assoc_variation2.phpt index 274da6f7b2..12cf4d7307 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation2.phpt @@ -93,15 +93,23 @@ $arrays = array( // loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc() $iterator = 1; foreach($arrays as $unexpected_value) { - echo "\n-- Iteration $iterator --"; - - // Calling array_intersect_assoc() with default arguments - var_dump( array_intersect_assoc($arr1,$unexpected_value) ); - - // Calling array_intersect_assoc() with more arguments - var_dump( array_intersect_assoc($arr1, $unexpected_value, $arr3) ); - - $iterator++; + echo "\n-- Iteration $iterator --"; + + // Calling array_intersect_assoc() with default arguments + try { + var_dump( array_intersect_assoc($arr1,$unexpected_value) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + // Calling array_intersect_assoc() with more arguments + try { + var_dump( array_intersect_assoc($arr1, $unexpected_value, $arr3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + $iterator++; } // close the file resource used @@ -109,174 +117,78 @@ fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_assoc() : Passing non-array values to $arr2 argument *** --- Iteration 1 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iteration 2 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iteration 3 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iteration 4 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iteration 5 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iteration 6 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iteration 7 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iteration 8 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iteration 9 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iteration 10 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - --- Iteration 11 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - --- Iteration 12 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - --- Iteration 13 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 1 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 2 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --- Iteration 14 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 3 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 4 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --- Iteration 15 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 5 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 6 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --- Iteration 16 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 7 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 8 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --- Iteration 17 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 9 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 10 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --- Iteration 18 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 11 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 12 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --- Iteration 19 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 13 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 14 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --- Iteration 20 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 15 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 16 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --- Iteration 21 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +-- Iteration 17 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +-- Iteration 18 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --- Iteration 22 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 19 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 20 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --- Iteration 23 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 21 --Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 22 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --- Iteration 24 -- -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +-- Iteration 23 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given -Warning: array_intersect_assoc(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +-- Iteration 24 --Expected parameter 2 to be an array, resource given +Expected parameter 2 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_intersect_error.phpt b/ext/standard/tests/array/array_intersect_error.phpt index 373a0ddbe0..81be2634db 100644 --- a/ext/standard/tests/array/array_intersect_error.phpt +++ b/ext/standard/tests/array/array_intersect_error.phpt @@ -11,25 +11,29 @@ echo "*** Testing array_intersect() : error conditions ***\n"; // Testing array_intersect() with zero arguments echo "\n-- Testing array_intersect() function with Zero arguments --\n"; -var_dump( array_intersect() ); +try { + var_dump( array_intersect() ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_intersect() with one less than the expected number of arguments echo "\n-- Testing array_intersect() function with less than expected no. of arguments --\n"; $arr1 = array(1, 2); -var_dump( array_intersect($arr1) ); +try { + var_dump( array_intersect($arr1) ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_intersect() : error conditions *** -- Testing array_intersect() function with Zero arguments -- - -Warning: array_intersect(): at least 2 parameters are required, 0 given in %s on line %d -NULL +At least 2 parameters are required, 0 given -- Testing array_intersect() function with less than expected no. of arguments -- - -Warning: array_intersect(): at least 2 parameters are required, 1 given in %s on line %d -NULL +At least 2 parameters are required, 1 given Done diff --git a/ext/standard/tests/array/array_intersect_key_error.phpt b/ext/standard/tests/array/array_intersect_key_error.phpt index 10ad8ad342..7db4b7415f 100644 --- a/ext/standard/tests/array/array_intersect_key_error.phpt +++ b/ext/standard/tests/array/array_intersect_key_error.phpt @@ -14,23 +14,27 @@ $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); // Testing array_intersect_key with one less than the expected number of arguments echo "\n-- Testing array_intersect_key() function with less than expected no. of arguments --\n"; -var_dump( array_intersect_key($array1) ); +try { + var_dump( array_intersect_key($array1) ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_intersect_key with one less than the expected number of arguments echo "\n-- Testing array_intersect_key() function with no arguments --\n"; -var_dump( array_intersect_key() ); +try { + var_dump( array_intersect_key() ); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_key() : error conditions *** -- Testing array_intersect_key() function with less than expected no. of arguments -- - -Warning: array_intersect_key(): at least 2 parameters are required, 1 given in %s on line %d -NULL +At least 2 parameters are required, 1 given -- Testing array_intersect_key() function with no arguments -- - -Warning: array_intersect_key(): at least 2 parameters are required, 0 given in %s on line %d -NULL +At least 2 parameters are required, 0 given ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_key_variation1.phpt b/ext/standard/tests/array/array_intersect_key_variation1.phpt index fb9dd2c7aa..0987205b7e 100644 --- a/ext/standard/tests/array/array_intersect_key_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_key_variation1.phpt @@ -93,222 +93,126 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_key($value, $array2) ); - var_dump( array_intersect_key($value, $array2, $array3) ); + echo "\n--$key--\n"; + try { + var_dump( array_intersect_key($value, $array2) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_intersect_key($value, $array2, $array3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_key() : usage variation *** --int 0-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --resource var-- - -Warning: array_intersect_key(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +Expected parameter 1 to be an array, resource given +Expected parameter 1 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_key_variation2.phpt b/ext/standard/tests/array/array_intersect_key_variation2.phpt index 5d2147b99f..8d46b6efae 100644 --- a/ext/standard/tests/array/array_intersect_key_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_key_variation2.phpt @@ -94,222 +94,126 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_key($array1, $value) ); - var_dump( array_intersect_key($array1, $value, $array3) ); + echo "\n--$key--\n"; + try { + var_dump( array_intersect_key($array1, $value) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_intersect_key($array1, $value, $array3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_key() : usage variation *** --int 0-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --resource var-- - -Warning: array_intersect_key(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL - -Warning: array_intersect_key(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given +Expected parameter 2 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_key_variation3.phpt b/ext/standard/tests/array/array_intersect_key_variation3.phpt deleted file mode 100644 index dca52bafc2..0000000000 --- a/ext/standard/tests/array/array_intersect_key_variation3.phpt +++ /dev/null @@ -1,235 +0,0 @@ ---TEST-- -Test array_intersect_key() function : usage variation - Passing unexpected values to optional argument ---FILE-- -<?php -/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...]) - * Description: Returns the entries of arr1 that have keys which are present in all the other arguments. - * Source code: ext/standard/array.c - */ - -echo "*** Testing array_intersect_key() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); -$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//resource variable -$fp = fopen(__FILE__, "r"); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource data - 'resource var' => $fp, -); - -// loop through each element of the array for arr2 -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_key($array1, $array2, $value) ); -} - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing array_intersect_key() : usage variation *** - ---int 0-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 1-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 12345-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int -12345-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---float 10.5-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -10.5-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float .5-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---uppercase NULL-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase null-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase true-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---lowercase false-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase TRUE-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase FALSE-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---empty string DQ-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---empty string SQ-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string DQ-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string SQ-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---mixed case string-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---heredoc-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---instance of classWithToString-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---undefined var-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---unset var-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---resource var-- - -Warning: array_intersect_key(): Expected parameter 3 to be an array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt index 887ad12d9a..4c4a69250c 100644 --- a/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt @@ -101,222 +101,126 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_uassoc($value, $array2, 'key_compare_func') ); - var_dump( array_intersect_uassoc($value, $array2, $array3, 'key_compare_func') ); + echo "\n--$key--\n"; + try { + var_dump( array_intersect_uassoc($value, $array2, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_intersect_uassoc($value, $array2, $array3, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_uassoc() : usage variation *** --int 0-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --resource-- - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +Expected parameter 1 to be an array, resource given +Expected parameter 1 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt index d482e9ffcc..0daa424314 100644 --- a/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt @@ -101,222 +101,126 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_uassoc($array1, $value, 'key_compare_func') ); - var_dump( array_intersect_uassoc($array1, $value, $array3, 'key_compare_func') ); + echo "\n--$key--\n"; + try { + var_dump( array_intersect_uassoc($array1, $value, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_intersect_uassoc($array1, $value, $array3, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_uassoc() : usage variation *** --int 0-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --resource-- - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL - -Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given +Expected parameter 2 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt deleted file mode 100644 index 42e53101dc..0000000000 --- a/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt +++ /dev/null @@ -1,243 +0,0 @@ ---TEST-- -Test array_intersect_uassoc() function : usage variation - Passing unexpected values to optional third argument ---FILE-- -<?php -/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func) - * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function - * Source code: ext/standard/array.c - */ - -echo "*** Testing array_intersect_uassoc() : usage variation ***\n"; - -// Initialise function arguments -$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); -$array2 = array("a" => "green", "yellow", "red"); - -//Callback function -function key_compare_func($a, $b) { - if ($a === $b) { - return 0; - } - return ($a > $b) ? 1 : -1; -} - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//resource variable -$fp = fopen(__FILE__, "r"); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource data - 'resource' => $fp, -); - -// loop through each element of the array for arr1 -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_uassoc($array1, $array2, $value, 'key_compare_func') ); -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing array_intersect_uassoc() : usage variation *** - ---int 0-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 1-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 12345-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int -12345-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---float 10.5-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -10.5-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float .5-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---uppercase NULL-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase null-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase true-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---lowercase false-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase TRUE-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase FALSE-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---empty string DQ-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---empty string SQ-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string DQ-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string SQ-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---mixed case string-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---heredoc-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---instance of classWithToString-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---undefined var-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---unset var-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---resource-- - -Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_intersect_ukey_variation1.phpt b/ext/standard/tests/array/array_intersect_ukey_variation1.phpt index 86850094b8..cf1525a519 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation1.phpt @@ -99,222 +99,126 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_ukey($value, $array2, 'key_compare_func') ); - var_dump( array_intersect_ukey($value, $array2, $array3, 'key_compare_func') ); + echo "\n--$key--\n"; + try { + var_dump( array_intersect_ukey($value, $array2, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_intersect_ukey($value, $array2, $array3, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_ukey() : usage variation *** --int 0-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --resource var-- - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +Expected parameter 1 to be an array, resource given +Expected parameter 1 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_ukey_variation2.phpt b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt index 82b43628e3..f4df546f8e 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt @@ -99,222 +99,126 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_ukey($array1, $value, 'key_compare_func') ); - var_dump( array_intersect_ukey($array1, $value, $array3, 'key_compare_func') ); + echo "\n--$key--\n"; + try { + var_dump( array_intersect_ukey($array1, $value, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( array_intersect_ukey($array1, $value, $array3, 'key_compare_func') ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_intersect_ukey() : usage variation *** --int 0-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --resource var-- - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given +Expected parameter 2 to be an array, resource given ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_ukey_variation4.phpt b/ext/standard/tests/array/array_intersect_ukey_variation4.phpt deleted file mode 100644 index 35c0d4a2e6..0000000000 --- a/ext/standard/tests/array/array_intersect_ukey_variation4.phpt +++ /dev/null @@ -1,321 +0,0 @@ ---TEST-- -Test array_intersect_ukey() function : usage variation - Passing unexpected values to optional third argument ---FILE-- -<?php -/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func) - * Description: Computes the intersection of arrays using a callback function on the keys for comparison. - * Source code: ext/standard/array.c - */ - -echo "*** Testing array_intersect_ukey() : usage variation ***\n"; - -//Initialise arguments -$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); -$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); -$array4 = array('green' => 5, 'cyan' => 8); - -//Call back function -function key_compare_func($key1, $key2) -{ - if ($key1 == $key2) - return 0; - else - return ($key1 > $key2)? 1:-1; -} - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -//resource variable -$fp = fopen(__FILE__, "r"); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource data - 'resource var' => $fp, -); - -// loop through each element of the array for arr2 - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_intersect_ukey($array1, $array2, $value, 'key_compare_func') ); - var_dump( array_intersect_ukey($array1, $array2, $value, $array4, 'key_compare_func') ); -}; - -fclose($fp); -?> -===DONE=== ---EXPECTF-- -*** Testing array_intersect_ukey() : usage variation *** - ---int 0-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 1-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int 12345-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---int -12345-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - ---float 10.5-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -10.5-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---float .5-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d -NULL - ---uppercase NULL-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase null-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---lowercase true-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---lowercase false-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase TRUE-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---uppercase FALSE-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d -NULL - ---empty string DQ-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---empty string SQ-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string DQ-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---string SQ-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---mixed case string-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---heredoc-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d -NULL - ---instance of classWithToString-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d -NULL - ---undefined var-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---unset var-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - ---resource var-- - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, resource given in %s on line %d -NULL - -Warning: array_intersect_ukey(): Expected parameter 3 to be an array, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt index 122d1e4767..f4b91503bc 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt @@ -14,26 +14,23 @@ $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); $array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); //function name within double quotes -var_dump( array_intersect_ukey($array1, $array2, "unknown_function") ); +try { + var_dump( array_intersect_ukey($array1, $array2, "unknown_function") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //function name within single quotes -var_dump( array_intersect_ukey($array1, $array2, 'unknown_function') ); +try { + var_dump( array_intersect_ukey($array1, $array2, 'unknown_function') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} -//function name without quotes -var_dump( array_intersect_ukey($array1, $array2, unknown_function) ); ?> ===DONE=== --EXPECTF-- *** Testing array_intersect_ukey() : usage variation *** - -Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL - -Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL - -Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d - -Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL +array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name +array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name ===DONE=== diff --git a/ext/standard/tests/array/array_intersect_variation1.phpt b/ext/standard/tests/array/array_intersect_variation1.phpt index 9536dd8c2a..d38a284496 100644 --- a/ext/standard/tests/array/array_intersect_variation1.phpt +++ b/ext/standard/tests/array/array_intersect_variation1.phpt @@ -92,14 +92,22 @@ $arrays = array( // loop through each sub-array within $arrrays to check the behavior of array_intersect() $iterator = 1; foreach($arrays as $unexpected_value) { - echo "\n-- Iterator $iterator --"; - - // Calling array_intersect() with default arguments - var_dump( array_intersect($unexpected_value,$arr2) ); - - // Calling array_intersect() with more arguments - var_dump( array_intersect($unexpected_value, $arr2, $arr3) ); - $iterator++; + echo "\n-- Iterator $iterator --"; + + // Calling array_intersect() with default arguments + try { + var_dump( array_intersect($unexpected_value,$arr2) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + // Calling array_intersect() with more arguments + try { + var_dump( array_intersect($unexpected_value, $arr2, $arr3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; } // close the file resource used @@ -107,174 +115,78 @@ fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_intersect() : Passing non-array values to $arr1 argument *** --- Iterator 1 -- -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iterator 2 -- -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iterator 3 -- -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iterator 4 -- -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iterator 5 -- -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iterator 6 -- -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iterator 7 -- -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iterator 8 -- -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iterator 9 -- -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iterator 10 -- -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iterator 11 -- -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iterator 12 -- -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - --- Iterator 13 -- -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iterator 1 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iterator 2 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --- Iterator 14 -- -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iterator 3 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iterator 4 --Expected parameter 1 to be an array, int given +Expected parameter 1 to be an array, int given --- Iterator 15 -- -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iterator 5 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given -Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- Iterator 6 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --- Iterator 16 -- -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 7 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 8 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given --- Iterator 17 -- -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 9 --Expected parameter 1 to be an array, float given +Expected parameter 1 to be an array, float given -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 10 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --- Iterator 18 -- -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 11 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 12 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --- Iterator 19 -- -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 13 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 14 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given --- Iterator 20 -- -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 15 --Expected parameter 1 to be an array, bool given +Expected parameter 1 to be an array, bool given -Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- Iterator 16 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --- Iterator 21 -- -Warning: array_intersect(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +-- Iterator 17 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given -Warning: array_intersect(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +-- Iterator 18 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --- Iterator 22 -- -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iterator 19 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iterator 20 --Expected parameter 1 to be an array, string given +Expected parameter 1 to be an array, string given --- Iterator 23 -- -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iterator 21 --Expected parameter 1 to be an array, object given +Expected parameter 1 to be an array, object given -Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- Iterator 22 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given --- Iterator 24 -- -Warning: array_intersect(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +-- Iterator 23 --Expected parameter 1 to be an array, null given +Expected parameter 1 to be an array, null given -Warning: array_intersect(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +-- Iterator 24 --Expected parameter 1 to be an array, resource given +Expected parameter 1 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_intersect_variation2.phpt b/ext/standard/tests/array/array_intersect_variation2.phpt index 1db37b8467..08f6c9bb48 100644 --- a/ext/standard/tests/array/array_intersect_variation2.phpt +++ b/ext/standard/tests/array/array_intersect_variation2.phpt @@ -92,15 +92,23 @@ $arrays = array( // loop through each sub-array within $arrrays to check the behavior of array_intersect() $iterator = 1; foreach($arrays as $unexpected_value) { - echo "\n-- Iterator $iterator --"; - - // Calling array_intersect() with default arguments - var_dump( array_intersect($arr1,$unexpected_value) ); - - // Calling array_intersect() with more arguments - var_dump( array_intersect($arr1, $unexpected_value, $arr3) ); - - $iterator++; + echo "\n-- Iterator $iterator --"; + + // Calling array_intersect() with default arguments + try { + var_dump( array_intersect($arr1,$unexpected_value) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + // Calling array_intersect() with more arguments + try { + var_dump( array_intersect($arr1, $unexpected_value, $arr3) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + $iterator++; } // close the file resource used @@ -108,174 +116,78 @@ fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_intersect() : Passing non-array values to $arr2 argument *** --- Iterator 1 -- -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iterator 2 -- -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iterator 3 -- -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iterator 4 -- -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d -NULL - --- Iterator 5 -- -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iterator 6 -- -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iterator 7 -- -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iterator 8 -- -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iterator 9 -- -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d -NULL - --- Iterator 10 -- -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - --- Iterator 11 -- -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL - --- Iterator 12 -- -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL - --- Iterator 13 -- -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iterator 1 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iterator 2 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --- Iterator 14 -- -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iterator 3 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iterator 4 --Expected parameter 2 to be an array, int given +Expected parameter 2 to be an array, int given --- Iterator 15 -- -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iterator 5 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given -Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iterator 6 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --- Iterator 16 -- -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 7 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 8 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given --- Iterator 17 -- -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 9 --Expected parameter 2 to be an array, float given +Expected parameter 2 to be an array, float given -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 10 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --- Iterator 18 -- -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 11 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 12 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --- Iterator 19 -- -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 13 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 14 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given --- Iterator 20 -- -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 15 --Expected parameter 2 to be an array, bool given +Expected parameter 2 to be an array, bool given -Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iterator 16 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --- Iterator 21 -- -Warning: array_intersect(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +-- Iterator 17 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given -Warning: array_intersect(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +-- Iterator 18 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --- Iterator 22 -- -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iterator 19 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iterator 20 --Expected parameter 2 to be an array, string given +Expected parameter 2 to be an array, string given --- Iterator 23 -- -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iterator 21 --Expected parameter 2 to be an array, object given +Expected parameter 2 to be an array, object given -Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iterator 22 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given --- Iterator 24 -- -Warning: array_intersect(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +-- Iterator 23 --Expected parameter 2 to be an array, null given +Expected parameter 2 to be an array, null given -Warning: array_intersect(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +-- Iterator 24 --Expected parameter 2 to be an array, resource given +Expected parameter 2 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt index 78a144f829..f66648f17d 100644 --- a/ext/standard/tests/array/array_key_exists.phpt +++ b/ext/standard/tests/array/array_key_exists.phpt @@ -69,24 +69,8 @@ foreach ($search_arrays_v as $search_array) { } echo "\n*** Testing error conditions ***\n"; -//Zeor args -var_dump( array_key_exists() ); // first args as array var_dump( array_key_exists(array(), array()) ); -// second args as string -var_dump( array_key_exists("", "") ); -// second args a integer -var_dump( array_key_exists(1, 1) ); -// second args as NULL -var_dump( array_key_exists(1, NULL) ); -// second args as boolean -var_dump( array_key_exists(1, true) ); -// first args as boolean -var_dump( array_key_exists(false, true) ); -// second args as float -var_dump( array_key_exists(false, 17.5) ); -// args more than expected -var_dump( array_key_exists(1, array(), array()) ); // first argument as floating point value var_dump( array_key_exists(17.5, array(1,23) ) ) ; @@ -249,33 +233,9 @@ bool(true) *** Testing error conditions *** -Warning: array_key_exists() expects exactly 2 parameters, 0 given in %s on line %d -NULL - Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d bool(false) -Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, int given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, null given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, float given in %s on line %d -NULL - -Warning: array_key_exists() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d bool(false) diff --git a/ext/standard/tests/array/array_keys_error.phpt b/ext/standard/tests/array/array_keys_error.phpt index 46a989b839..0febae29c7 100644 --- a/ext/standard/tests/array/array_keys_error.phpt +++ b/ext/standard/tests/array/array_keys_error.phpt @@ -3,32 +3,19 @@ Test array_keys() function (error conditions) --FILE-- <?php -echo "\n*** Testing error conditions ***"; -var_dump(array_keys(100)); -var_dump(array_keys("string")); -var_dump(array_keys(new stdclass)); // object -var_dump(array_keys()); // Zero arguments -var_dump(array_keys(array(), "", TRUE, 100)); // args > expected +echo "\n*** Testing error conditions ***\n"; +try { + var_dump(array_keys(new stdclass)); // object +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(array_keys(array(1,2,3, new stdClass => array()))); // (W)illegal offset echo "Done\n"; ?> --EXPECTF-- *** Testing error conditions *** -Warning: array_keys() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_keys() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_keys() expects parameter 1 to be array, object given in %s on line %d -NULL - -Warning: array_keys() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: array_keys() expects at most 3 parameters, 4 given in %s on line %d -NULL +array_keys() expects parameter 1 to be array, object given Warning: Illegal offset type in %s on line %d array(3) { diff --git a/ext/standard/tests/array/array_map_error.phpt b/ext/standard/tests/array/array_map_error.phpt index 56dd033521..d15f28425e 100644 --- a/ext/standard/tests/array/array_map_error.phpt +++ b/ext/standard/tests/array/array_map_error.phpt @@ -9,10 +9,6 @@ Test array_map() function : error conditions echo "*** Testing array_map() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing array_map() function with Zero arguments --\n"; -var_dump( array_map() ); - // Testing array_map with one less than the expected number of arguments echo "\n-- Testing array_map() function with one less than expected no. of arguments --\n"; function callback1() { @@ -45,15 +41,8 @@ echo "Done"; --EXPECTF-- *** Testing array_map() : error conditions *** --- Testing array_map() function with Zero arguments -- - -Warning: array_map() expects at least 2 parameters, 0 given in %s on line %d%d -NULL - -- Testing array_map() function with one less than expected no. of arguments -- - -Warning: array_map() expects at least 2 parameters, 1 given in %s on line %d%d -NULL +Exception: array_map() expects at least 2 parameters, 1 given -- Testing array_map() function with less no. of arrays than callback function arguments -- Exception: Too few arguments to function callback2(), 1 passed and exactly 2 expected diff --git a/ext/standard/tests/array/array_map_object1.phpt b/ext/standard/tests/array/array_map_object1.phpt index b808381048..43cc4484e6 100644 --- a/ext/standard/tests/array/array_map_object1.phpt +++ b/ext/standard/tests/array/array_map_object1.phpt @@ -22,13 +22,17 @@ echo "-- simple class with public variable and method --\n"; class SimpleClass { public $var1 = 1; - public function square($n) { + public static function square($n) { return $n * $n; } } function test($cb, $args) { echo join('::', $cb) . "\n"; - var_dump(array_map($cb, $args)); + try { + var_dump(array_map($cb, $args)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } test(array('SimpleClass', 'square'), array(1, 2)); @@ -36,7 +40,7 @@ echo "\n-- simple class with private variable and method --\n"; class SimpleClassPri { private $var1 = 10; - private function add($n) { + private static function add($n) { return $var + $n; } } @@ -46,7 +50,7 @@ echo "\n-- simple class with protected variable and method --\n"; class SimpleClassPro { protected $var1 = 5; - protected function mul($n) { + protected static function mul($n) { return $var1 * $n; } } @@ -62,14 +66,14 @@ echo "\n-- abstract class --\n"; abstract class AbstractClass { protected $var2 = 5; - abstract function emptyFunction(); + abstract static function emptyFunction(); } // class deriving the above abstract class class ChildClass extends AbstractClass { private $var3; - public function emptyFunction() { + public static function emptyFunction() { echo "defined in child\n"; } } @@ -79,7 +83,7 @@ echo "\n-- class with final method --\n"; class FinalClass { private $var4; - final function finalMethod() { + final static function finalMethod() { echo "This function can't be overloaded\n"; } } @@ -126,8 +130,6 @@ test(array('InterClass', 'square'), array(1, 2)); *** Testing array_map() : object functionality *** -- simple class with public variable and method -- SimpleClass::square - -Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method SimpleClass::square() should not be called statically in %sarray_map_object1.php on line %d array(2) { [0]=> int(1) @@ -137,26 +139,18 @@ array(2) { -- simple class with private variable and method -- SimpleClassPri::add - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add() -- simple class with protected variable and method -- SimpleClassPro::mul - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul() -- class without members -- EmptyClass - -Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, array must have exactly two members -- abstract class -- ChildClass::emptyFunction - -Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method ChildClass::emptyFunction() should not be called statically in %sarray_map_object1.php on line %d defined in child defined in child array(2) { @@ -168,8 +162,6 @@ array(2) { -- class with final method -- FinalClass::finalMethod - -Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method FinalClass::finalMethod() should not be called statically in %sarray_map_object1.php on line %d This function can't be overloaded This function can't be overloaded array(2) { @@ -188,13 +180,9 @@ array(2) { int(4) } StaticClass::cube - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube() StaticClass::retVal - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal() -- class implementing an interface -- InterClass::square array(2) { diff --git a/ext/standard/tests/array/array_map_object2.phpt b/ext/standard/tests/array/array_map_object2.phpt index 7cfb528bf2..e5218ccbe4 100644 --- a/ext/standard/tests/array/array_map_object2.phpt +++ b/ext/standard/tests/array/array_map_object2.phpt @@ -26,21 +26,25 @@ class SimpleClass } echo "-- with non-existent class --\n"; -var_dump( array_map(array('non-existent', 'square'), array(1, 2)) ); +try { + var_dump( array_map(array('non-existent', 'square'), array(1, 2)) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- with existent class and non-existent method --\n"; -var_dump( array_map(array('SimpleClass', 'non-existent'), array(1, 2)) ); +try { + var_dump( array_map(array('SimpleClass', 'non-existent'), array(1, 2)) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> --EXPECTF-- *** Testing array_map() : with non-existent class and method *** -- with non-existent class -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'non-existent' not found in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'non-existent' not found -- with existent class and non-existent method -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'SimpleClass' does not have a method 'non-existent' in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'SimpleClass' does not have a method 'non-existent' Done diff --git a/ext/standard/tests/array/array_map_object3.phpt b/ext/standard/tests/array/array_map_object3.phpt index 114d1d3134..2f1536df5c 100644 --- a/ext/standard/tests/array/array_map_object3.phpt +++ b/ext/standard/tests/array/array_map_object3.phpt @@ -51,13 +51,21 @@ echo "-- accessing parent method from child class --\n"; var_dump( array_map(array('ChildClass', 'staticParent1'), $arr1) ); echo "-- accessing child method from parent class --\n"; -var_dump( array_map(array('ParentClass', 'staticChild'), $arr1) ); +try { + var_dump( array_map(array('ParentClass', 'staticChild'), $arr1) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- accessing parent method using child class object --\n"; var_dump( array_map(array($childobj, 'staticParent1'), $arr1) ); echo "-- accessing child method using parent class object --\n"; -var_dump( array_map(array($parentobj, 'staticChild'), $arr1) ); +try { + var_dump( array_map(array($parentobj, 'staticChild'), $arr1) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -73,9 +81,7 @@ array(3) { int(7) } -- accessing child method from parent class -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' -- accessing parent method using child class object -- array(3) { [0]=> @@ -86,7 +92,5 @@ array(3) { int(7) } -- accessing child method using parent class object -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' Done diff --git a/ext/standard/tests/array/array_map_variation10.phpt b/ext/standard/tests/array/array_map_variation10.phpt index 5b80126966..df071a414b 100644 --- a/ext/standard/tests/array/array_map_variation10.phpt +++ b/ext/standard/tests/array/array_map_variation10.phpt @@ -33,11 +33,15 @@ echo "-- anonymous function with NULL body --\n"; var_dump( array_map( function($a) { }, $array1)); echo "-- passing NULL as 'arr1' --\n"; -var_dump( array_map( function($a) { return array($a); }, NULL)); +try { + var_dump( array_map( function($a) { return array($a); }, NULL)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_map() : anonymous callback function *** -- anonymous function with all parameters and body -- array(3) { @@ -84,7 +88,5 @@ array(3) { NULL } -- passing NULL as 'arr1' -- - -Warning: array_map(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given Done diff --git a/ext/standard/tests/array/array_map_variation12.phpt b/ext/standard/tests/array/array_map_variation12.phpt index b258c2d31b..67abde0108 100644 --- a/ext/standard/tests/array/array_map_variation12.phpt +++ b/ext/standard/tests/array/array_map_variation12.phpt @@ -20,10 +20,18 @@ echo "-- with built-in function 'pow' and two parameters --\n"; var_dump( array_map('pow', $array1, $array2)); echo "-- with built-in function 'pow' and one parameter --\n"; -var_dump( array_map('pow', $array1)); +try { + var_dump( array_map('pow', $array1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- with language construct --\n"; -var_dump( array_map('echo', $array1)); +try { + var_dump( array_map('echo', $array1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -39,22 +47,7 @@ array(3) { int(243) } -- with built-in function 'pow' and one parameter -- - -Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d -array(3) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL -} +pow() expects exactly 2 parameters, 1 given -- with language construct -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_map_variation14.phpt b/ext/standard/tests/array/array_map_variation14.phpt index 771d3f949e..2764cb7374 100644 --- a/ext/standard/tests/array/array_map_variation14.phpt +++ b/ext/standard/tests/array/array_map_variation14.phpt @@ -36,10 +36,18 @@ echo "-- with undefined variable --\n"; var_dump( array_map(@$undefined_var, $arr1) ); echo "-- with empty string --\n"; -var_dump( array_map("", $arr1, $arr2) ); +try { + var_dump( array_map("", $arr1, $arr2) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- with empty array --\n"; -var_dump( array_map(array(), $arr1, $arr2) ); +try { + var_dump( array_map(array(), $arr1, $arr2) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -115,11 +123,7 @@ array(2) { int(2) } -- with empty string -- - -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name -- with empty array -- - -Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, array must have exactly two members Done diff --git a/ext/standard/tests/array/array_map_variation15.phpt b/ext/standard/tests/array/array_map_variation15.phpt index b29af47713..f36d55bd5f 100644 --- a/ext/standard/tests/array/array_map_variation15.phpt +++ b/ext/standard/tests/array/array_map_variation15.phpt @@ -18,13 +18,15 @@ $arr1 = array(1, 2); $arr2 = array("one", "two"); $arr3 = array(1.1, 2.2); -var_dump( array_map('non_existent', $arr1, $arr2, $arr3) ); +try { + var_dump( array_map('non_existent', $arr1, $arr2, $arr3) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_map() : non existent 'callback' function *** - -Warning: array_map() expects parameter 1 to be a valid callback, function 'non_existent' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'non_existent' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_map_variation16.phpt b/ext/standard/tests/array/array_map_variation16.phpt index c4987cb385..0c80337c76 100644 --- a/ext/standard/tests/array/array_map_variation16.phpt +++ b/ext/standard/tests/array/array_map_variation16.phpt @@ -30,8 +30,12 @@ $callback_names = array( ); for($count = 0; $count < count($callback_names); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( array_map($callback_names[$count], $arr1) ); + echo "-- Iteration ".($count + 1)." --\n"; + try { + var_dump( array_map($callback_names[$count], $arr1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } echo "Done"; @@ -39,35 +43,19 @@ echo "Done"; --EXPECTF-- *** Testing array_map() : non-permmited built-in functions *** -- Iteration 1 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name -- Iteration 2 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'array' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'array' not found or invalid function name -- Iteration 3 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'empty' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'empty' not found or invalid function name -- Iteration 4 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'eval' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'eval' not found or invalid function name -- Iteration 5 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'exit' not found or invalid function name -- Iteration 6 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'isset' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'isset' not found or invalid function name -- Iteration 7 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'list' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'list' not found or invalid function name -- Iteration 8 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'print' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'print' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_map_variation17.phpt b/ext/standard/tests/array/array_map_variation17.phpt index 1cfbdd7beb..4558dc999f 100644 --- a/ext/standard/tests/array/array_map_variation17.phpt +++ b/ext/standard/tests/array/array_map_variation17.phpt @@ -66,93 +66,77 @@ $unexpected_callbacks = array( // loop through each element of $inputs to check the behavior of array_map for($count = 0; $count < count($unexpected_callbacks); $count++) { - echo "\n-- Iteration ".($count + 1)." --"; - var_dump( array_map($unexpected_callbacks[$count], $arr1)); + echo "\n-- Iteration ".($count + 1)." --\n"; + try { + var_dump( array_map($unexpected_callbacks[$count], $arr1)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_map() : unexpected values for 'callback' argument *** -- Iteration 1 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 2 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 3 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 4 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 5 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 6 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 7 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 8 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 9 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 10 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 11 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 12 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 13 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 14 -- -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name -- Iteration 15 -- -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name -- Iteration 16 -- -Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, array must have exactly two members -- Iteration 17 -- -Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object -- Iteration 18 -- -Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object -- Iteration 19 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 20 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given Done diff --git a/ext/standard/tests/array/array_merge.phpt b/ext/standard/tests/array/array_merge.phpt index 0afc2084af..08ecbf7147 100644 --- a/ext/standard/tests/array/array_merge.phpt +++ b/ext/standard/tests/array/array_merge.phpt @@ -78,12 +78,6 @@ var_dump(array_merge($begin_array[6])); echo "\n*** Testing array_merge() with typecasting non-array to array ***\n"; var_dump(array_merge($begin_array[4], (array)"type1", (array)10, (array)12.34)); -echo "\n*** Testing error conditions ***"; -/* Invalid arguments */ -var_dump(array_merge(100, 200)); -var_dump(array_merge($begin_array[0], $begin_array[1], 100)); -var_dump(array_merge($begin_array[0], $begin_array[1], $arr4)); - echo "\n*** Testing array_merge without any arguments ***\n"; var_dump(array_merge()); @@ -747,18 +741,6 @@ array(7) { float(12.34) } -*** Testing error conditions *** -Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_merge(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - -Notice: Undefined variable: arr4 in %s on line %d - -Warning: array_merge(): Expected parameter 3 to be an array, null given in %s on line %d -NULL - *** Testing array_merge without any arguments *** array(0) { } diff --git a/ext/standard/tests/array/array_merge_recursive_variation1.phpt b/ext/standard/tests/array/array_merge_recursive_variation1.phpt index 071e9eadb5..3d15d56b81 100644 --- a/ext/standard/tests/array/array_merge_recursive_variation1.phpt +++ b/ext/standard/tests/array/array_merge_recursive_variation1.phpt @@ -88,17 +88,25 @@ $arr2 = array(1, array("hello", 'world')); // loop through each element of $arrays and check the behavior of array_merge_recursive() $iterator = 1; foreach($arrays as $arr1) { - echo "\n-- Iteration $iterator --"; - - // with default argument - echo "\n-- With default argument --"; - var_dump( array_merge_recursive($arr1) ); - - // with more arguments - echo "-- With more arguments --"; - var_dump( array_merge_recursive($arr1, $arr2) ); - - $iterator++; + echo "\n-- Iteration $iterator --"; + + // with default argument + echo "\n-- With default argument --"; + try { + var_dump( array_merge_recursive($arr1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + // with more arguments + echo "-- With more arguments --"; + try { + var_dump( array_merge_recursive($arr1, $arr2) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + $iterator++; } // close the file resource used @@ -106,198 +114,102 @@ fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_merge_recursive() : Passing non array values to $arr1 argument *** -- Iteration 1 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, int given +-- With more arguments --Expected parameter 1 to be an array, int given -- Iteration 2 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, int given +-- With more arguments --Expected parameter 1 to be an array, int given -- Iteration 3 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, int given +-- With more arguments --Expected parameter 1 to be an array, int given -- Iteration 4 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, int given +-- With more arguments --Expected parameter 1 to be an array, int given -- Iteration 5 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, float given +-- With more arguments --Expected parameter 1 to be an array, float given -- Iteration 6 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, float given +-- With more arguments --Expected parameter 1 to be an array, float given -- Iteration 7 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, float given +-- With more arguments --Expected parameter 1 to be an array, float given -- Iteration 8 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, float given +-- With more arguments --Expected parameter 1 to be an array, float given -- Iteration 9 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, float given +-- With more arguments --Expected parameter 1 to be an array, float given -- Iteration 10 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, null given +-- With more arguments --Expected parameter 1 to be an array, null given -- Iteration 11 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, null given +-- With more arguments --Expected parameter 1 to be an array, null given -- Iteration 12 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, bool given +-- With more arguments --Expected parameter 1 to be an array, bool given -- Iteration 13 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, bool given +-- With more arguments --Expected parameter 1 to be an array, bool given -- Iteration 14 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, bool given +-- With more arguments --Expected parameter 1 to be an array, bool given -- Iteration 15 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, bool given +-- With more arguments --Expected parameter 1 to be an array, bool given -- Iteration 16 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, string given +-- With more arguments --Expected parameter 1 to be an array, string given -- Iteration 17 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, string given +-- With more arguments --Expected parameter 1 to be an array, string given -- Iteration 18 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, string given +-- With more arguments --Expected parameter 1 to be an array, string given -- Iteration 19 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, string given +-- With more arguments --Expected parameter 1 to be an array, string given -- Iteration 20 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, string given +-- With more arguments --Expected parameter 1 to be an array, string given -- Iteration 21 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, null given +-- With more arguments --Expected parameter 1 to be an array, null given -- Iteration 22 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, null given +-- With more arguments --Expected parameter 1 to be an array, null given -- Iteration 23 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, resource given +-- With more arguments --Expected parameter 1 to be an array, resource given -- Iteration 24 -- --- With default argument -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, object given in %s on line %d -NULL --- With more arguments -- -Warning: array_merge_recursive(): Expected parameter 1 to be an array, object given in %s on line %d -NULL +-- With default argument --Expected parameter 1 to be an array, object given +-- With more arguments --Expected parameter 1 to be an array, object given Done diff --git a/ext/standard/tests/array/array_merge_recursive_variation2.phpt b/ext/standard/tests/array/array_merge_recursive_variation2.phpt index f14d5d9bb3..eec9634630 100644 --- a/ext/standard/tests/array/array_merge_recursive_variation2.phpt +++ b/ext/standard/tests/array/array_merge_recursive_variation2.phpt @@ -88,9 +88,13 @@ $arrays = array ( // loop through each element of $arrays and check the behavior of array_merge_recursive() $iterator = 1; foreach($arrays as $arr2) { - echo "\n-- Iteration $iterator --"; - var_dump( array_merge_recursive($arr1, $arr2) ); - $iterator++; + echo "\n-- Iteration $iterator --"; + try { + var_dump( array_merge_recursive($arr1, $arr2) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; } // close the file resource used @@ -98,102 +102,54 @@ fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_merge_recursive() : Passing non array values to $arr2 argument *** --- Iteration 1 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 1 --Expected parameter 2 to be an array, int given --- Iteration 2 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 2 --Expected parameter 2 to be an array, int given --- Iteration 3 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 3 --Expected parameter 2 to be an array, int given --- Iteration 4 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +-- Iteration 4 --Expected parameter 2 to be an array, int given --- Iteration 5 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 5 --Expected parameter 2 to be an array, float given --- Iteration 6 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 6 --Expected parameter 2 to be an array, float given --- Iteration 7 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 7 --Expected parameter 2 to be an array, float given --- Iteration 8 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 8 --Expected parameter 2 to be an array, float given --- Iteration 9 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +-- Iteration 9 --Expected parameter 2 to be an array, float given --- Iteration 10 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 10 --Expected parameter 2 to be an array, null given --- Iteration 11 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 11 --Expected parameter 2 to be an array, null given --- Iteration 12 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 12 --Expected parameter 2 to be an array, bool given --- Iteration 13 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 13 --Expected parameter 2 to be an array, bool given --- Iteration 14 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 14 --Expected parameter 2 to be an array, bool given --- Iteration 15 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +-- Iteration 15 --Expected parameter 2 to be an array, bool given --- Iteration 16 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 16 --Expected parameter 2 to be an array, string given --- Iteration 17 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 17 --Expected parameter 2 to be an array, string given --- Iteration 18 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 18 --Expected parameter 2 to be an array, string given --- Iteration 19 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 19 --Expected parameter 2 to be an array, string given --- Iteration 20 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +-- Iteration 20 --Expected parameter 2 to be an array, string given --- Iteration 21 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 21 --Expected parameter 2 to be an array, null given --- Iteration 22 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +-- Iteration 22 --Expected parameter 2 to be an array, null given --- Iteration 23 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +-- Iteration 23 --Expected parameter 2 to be an array, resource given --- Iteration 24 -- -Warning: array_merge_recursive(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +-- Iteration 24 --Expected parameter 2 to be an array, object given Done diff --git a/ext/standard/tests/array/array_merge_variation1.phpt b/ext/standard/tests/array/array_merge_variation1.phpt index 0335fe473b..16e702e8a1 100644 --- a/ext/standard/tests/array/array_merge_variation1.phpt +++ b/ext/standard/tests/array/array_merge_variation1.phpt @@ -102,129 +102,8 @@ echo "Done"; -- Iteration 1 -- -Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - --- Iteration 18 -- -array(2) { - [0]=> - int(1) - [1]=> - int(2) -} - --- Iteration 19 -- - -Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: array_merge(): Expected parameter 1 to be an array, object given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: array_merge(): Expected parameter 1 to be an array, resource given in %s on line %d -NULL -Done +Fatal error: Uncaught TypeError: Expected parameter 1 to be an array, int given in %s:%d +Stack trace: +#0 %s(%d): array_merge(0, Array) +#1 {main} + thrown in %s on line %d diff --git a/ext/standard/tests/array/array_merge_variation2.phpt b/ext/standard/tests/array/array_merge_variation2.phpt index fd7e9ccfc8..57715d484b 100644 --- a/ext/standard/tests/array/array_merge_variation2.phpt +++ b/ext/standard/tests/array/array_merge_variation2.phpt @@ -88,102 +88,72 @@ $inputs = array( // loop through each element of $inputs to check the behavior of array_merge() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_merge($arr1, $input) ); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + try { + var_dump( array_merge($arr1, $input) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + $iterator++; }; fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_merge() : usage variations *** -- Iteration 1 -- - -Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 2 -- - -Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 3 -- - -Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 4 -- - -Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d -NULL +Expected parameter 2 to be an array, int given -- Iteration 5 -- - -Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 6 -- - -Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 7 -- - -Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 8 -- - -Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 9 -- - -Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d -NULL +Expected parameter 2 to be an array, float given -- Iteration 10 -- - -Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 11 -- - -Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 12 -- - -Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 13 -- - -Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 14 -- - -Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 15 -- - -Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d -NULL +Expected parameter 2 to be an array, bool given -- Iteration 16 -- - -Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 17 -- - -Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 18 -- array(2) { @@ -194,37 +164,23 @@ array(2) { } -- Iteration 19 -- - -Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 20 -- - -Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 21 -- - -Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d -NULL +Expected parameter 2 to be an array, string given -- Iteration 22 -- - -Warning: array_merge(): Expected parameter 2 to be an array, object given in %s on line %d -NULL +Expected parameter 2 to be an array, object given -- Iteration 23 -- - -Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 24 -- - -Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d -NULL +Expected parameter 2 to be an array, null given -- Iteration 25 -- - -Warning: array_merge(): Expected parameter 2 to be an array, resource given in %s on line %d -NULL +Expected parameter 2 to be an array, resource given Done diff --git a/ext/standard/tests/array/array_multisort_error.phpt b/ext/standard/tests/array/array_multisort_error.phpt index 3e78b78ac0..5d3bab456a 100644 --- a/ext/standard/tests/array/array_multisort_error.phpt +++ b/ext/standard/tests/array/array_multisort_error.phpt @@ -10,35 +10,30 @@ Test array_multisort() function : error conditions echo "*** Testing array_multisort() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing array_multisort() function with Zero arguments --\n"; -var_dump( array_multisort() ); - echo "\n-- Testing array_multisort() function with repeated flags --\n"; $ar1 = array(1); -var_dump( array_multisort($ar1, SORT_ASC, SORT_ASC) ); +try { + var_dump( array_multisort($ar1, SORT_ASC, SORT_ASC) ); +} catch (Error $e) { + echo $e->getMessage() . "\n"; +} echo "\n-- Testing array_multisort() function with repeated flags --\n"; $ar1 = array(1); -var_dump( array_multisort($ar1, SORT_STRING, SORT_NUMERIC) ); +try { + var_dump( array_multisort($ar1, SORT_STRING, SORT_NUMERIC) ); +} catch (Error $e) { + echo $e->getMessage() . "\n"; +} ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_multisort() : error conditions *** --- Testing array_multisort() function with Zero arguments -- - -Warning: array_multisort() expects at least 1 parameter, 0 given in %sarray_multisort_error.php on line %d -NULL - -- Testing array_multisort() function with repeated flags -- - -Warning: array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified in %sarray_multisort_error.php on line %d -bool(false) +Argument #3 is expected to be an array or sorting flag that has not already been specified -- Testing array_multisort() function with repeated flags -- - -Warning: array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified in %sarray_multisort_error.php on line %d -bool(false) +Argument #3 is expected to be an array or sorting flag that has not already been specified ===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation1.phpt b/ext/standard/tests/array/array_multisort_variation1.phpt index 9a33a270f1..763944054a 100644 --- a/ext/standard/tests/array/array_multisort_variation1.phpt +++ b/ext/standard/tests/array/array_multisort_variation1.phpt @@ -11,8 +11,8 @@ Test array_multisort() function : usage variation echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } @@ -97,111 +97,90 @@ $inputs = array( foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( array_multisort($value)); + try { + var_dump( array_multisort($value)); + } catch (Error $e) { + echo $e->getMessage() . "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_multisort() : usage variation *** --int 0-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or sorting flag that has not already been specified --int 1-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or sorting flag that has not already been specified --int 12345-- -Error: 2 - array_multisort(): Argument #1 is an unknown sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is an unknown sort flag --int -12345-- -Error: 2 - array_multisort(): Argument #1 is an unknown sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is an unknown sort flag --float 10.5-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --float -10.5-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --float 12.3456789000e10-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --float -12.3456789000e10-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --float .5-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --uppercase NULL-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --lowercase null-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --lowercase true-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --lowercase false-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --uppercase TRUE-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --uppercase FALSE-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --empty string DQ-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --empty string SQ-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --string DQ-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --string SQ-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --mixed case string-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --heredoc-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --instance of classWithToString-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --instance of classWithoutToString-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --undefined var-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag --unset var-- -Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d) -bool(false) +Argument #1 is expected to be an array or a sort flag ===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation2.phpt b/ext/standard/tests/array/array_multisort_variation2.phpt index 8c26a8347b..b23d8b19fa 100644 --- a/ext/standard/tests/array/array_multisort_variation2.phpt +++ b/ext/standard/tests/array/array_multisort_variation2.phpt @@ -11,8 +11,8 @@ Test array_multisort() function : usage variation echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } @@ -104,13 +104,17 @@ $inputs = array( // loop through each element of the array for SORT_REGULAR|SORT_NUMERIC|SORT_STRING|SORT_NATURAL|SORT_FLAG_CASE]] foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_multisort($ar1, $value) ); + echo "\n--$key--\n"; + try { + var_dump( array_multisort($ar1, $value) ); + } catch (Error $e) { + echo $e->getMessage() . "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_multisort() : usage variation *** --int 0-- @@ -120,109 +124,83 @@ bool(true) bool(true) --int 12345-- -Error: 2 - array_multisort(): Argument #2 is an unknown sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is an unknown sort flag --int -12345-- -Error: 2 - array_multisort(): Argument #2 is an unknown sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is an unknown sort flag --float 10.5-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --float -10.5-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --float 12.3456789000e10-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --float -12.3456789000e10-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --float .5-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --empty array-- -Error: 2 - array_multisort(): Array sizes are inconsistent, %sarray_multisort_variation2.php(%d) -bool(false) +Array sizes are inconsistent --int indexed array-- -Error: 2 - array_multisort(): Array sizes are inconsistent, %sarray_multisort_variation2.php(%d) -bool(false) +Array sizes are inconsistent --associative array-- bool(true) --nested arrays-- -Error: 2 - array_multisort(): Array sizes are inconsistent, %sarray_multisort_variation2.php(%d) -bool(false) +Array sizes are inconsistent --uppercase NULL-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --lowercase null-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --lowercase true-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --lowercase false-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --uppercase TRUE-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --uppercase FALSE-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --empty string DQ-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --empty string SQ-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --string DQ-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --string SQ-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --mixed case string-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --heredoc-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --instance of classWithToString-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --instance of classWithoutToString-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --undefined var-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag --unset var-- -Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d) -bool(false) +Argument #2 is expected to be an array or a sort flag ===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation3.phpt b/ext/standard/tests/array/array_multisort_variation3.phpt index 28130e31fd..42b1d9fbe5 100644 --- a/ext/standard/tests/array/array_multisort_variation3.phpt +++ b/ext/standard/tests/array/array_multisort_variation3.phpt @@ -11,8 +11,8 @@ Test array_multisort() function : usage variation echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } @@ -95,114 +95,92 @@ $inputs = array( ); // loop through each element of the array for ar2 - foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_multisort($ar1, SORT_REGULAR, $value) ); + echo "\n--$key--\n"; + try { + var_dump( array_multisort($ar1, SORT_REGULAR, $value) ); + } catch (Error $e) { + echo $e->getMessage() . "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_multisort() : usage variation *** --int 0-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or sorting flag that has not already been specified --int 1-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or sorting flag that has not already been specified --int 12345-- -Error: 2 - array_multisort(): Argument #3 is an unknown sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is an unknown sort flag --int -12345-- -Error: 2 - array_multisort(): Argument #3 is an unknown sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is an unknown sort flag --float 10.5-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --float -10.5-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --float 12.3456789000e10-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --float -12.3456789000e10-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --float .5-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --uppercase NULL-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --lowercase null-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --lowercase true-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --lowercase false-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --uppercase TRUE-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --uppercase FALSE-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --empty string DQ-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --empty string SQ-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --string DQ-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --string SQ-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --mixed case string-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --heredoc-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --instance of classWithToString-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --instance of classWithoutToString-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --undefined var-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag --unset var-- -Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d) -bool(false) +Argument #3 is expected to be an array or a sort flag ===DONE=== diff --git a/ext/standard/tests/array/array_multisort_variation8.phpt b/ext/standard/tests/array/array_multisort_variation8.phpt index 00b0ccb012..d681ef92c5 100644 --- a/ext/standard/tests/array/array_multisort_variation8.phpt +++ b/ext/standard/tests/array/array_multisort_variation8.phpt @@ -11,7 +11,7 @@ Test array_multisort() function : usage variation - test sort order of all types echo "*** Testing array_multisort() : usage variation - test sort order of all types***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { // We're testing sort order not errors so ignore. } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/array/array_pad.phpt b/ext/standard/tests/array/array_pad.phpt index c267516730..ce6e1b2b04 100644 --- a/ext/standard/tests/array/array_pad.phpt +++ b/ext/standard/tests/array/array_pad.phpt @@ -3,9 +3,6 @@ array_pad() tests --FILE-- <?php -var_dump(array_pad()); -var_dump(array_pad(array())); -var_dump(array_pad(array(), 1)); var_dump(array_pad(array(), 1, 0)); var_dump(array_pad(array(), 0, 0)); @@ -15,20 +12,17 @@ var_dump(array_pad(array("", -1, 2.0), 5, array())); var_dump(array_pad(array("", -1, 2.0), 2, array())); var_dump(array_pad(array("", -1, 2.0), -3, array())); var_dump(array_pad(array("", -1, 2.0), -4, array())); -var_dump(array_pad(array("", -1, 2.0), 2000000, 0)); -var_dump(array_pad("", 2000000, 0)); -echo "Done\n"; -?> ---EXPECTF-- -Warning: array_pad() expects exactly 3 parameters, 0 given in %s on line %d -NULL +try { + var_dump(array_pad(array("", -1, 2.0), 2000000, 0)); +} catch (Error $e) { + echo $e->getMessage() . "\n"; +} -Warning: array_pad() expects exactly 3 parameters, 1 given in %s on line %d -NULL +?> -Warning: array_pad() expects exactly 3 parameters, 2 given in %s on line %d -NULL +DONE +--EXPECT-- array(1) { [0]=> int(0) @@ -92,10 +86,6 @@ array(4) { [3]=> float(2) } +You may only pad up to 1048576 elements at a time -Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d -bool(false) - -Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d -NULL -Done +DONE diff --git a/ext/standard/tests/array/array_push.phpt b/ext/standard/tests/array/array_push.phpt index 52e754f94d..227a520ac1 100644 --- a/ext/standard/tests/array/array_push.phpt +++ b/ext/standard/tests/array/array_push.phpt @@ -31,16 +31,7 @@ $mixed_array = array( ); /* Error Conditions */ -echo "\n*** Testing Error Conditions ***\n"; - -/* Zero argument */ -var_dump( array_push() ); - -/* Scalar argument */ -var_dump( array_push($number, 22) ); - -/* String argument */ -var_dump( array_push($str, 22) ); +echo "\n*** Testing Edge Conditions ***\n"; /* Invalid Number of arguments */ var_dump( array_push($mixed_array[1],1,2) ); @@ -70,16 +61,7 @@ var_dump( $mixed_array[2] ); echo"\nDone"; ?> --EXPECTF-- -*** Testing Error Conditions *** - -Warning: array_push() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: array_push() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_push() expects parameter 1 to be array, string given in %s on line %d -NULL +*** Testing Edge Conditions *** int(11) int(1) diff --git a/ext/standard/tests/array/array_rand.phpt b/ext/standard/tests/array/array_rand.phpt index db432dc9b4..5895727548 100644 --- a/ext/standard/tests/array/array_rand.phpt +++ b/ext/standard/tests/array/array_rand.phpt @@ -3,39 +3,47 @@ array_rand() tests --FILE-- <?php -var_dump(array_rand()); -var_dump(array_rand(array())); -var_dump(array_rand(array(), 0)); -var_dump(array_rand(0, 0)); -var_dump(array_rand(array(1,2,3), 0)); -var_dump(array_rand(array(1,2,3), -1)); -var_dump(array_rand(array(1,2,3), 10)); -var_dump(array_rand(array(1,2,3), 3)); -var_dump(array_rand(array(1,2,3), 2)); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: array_rand() expects at least 1 parameter, 0 given in %s on line %d -NULL +try { + var_dump(array_rand(array())); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -Warning: array_rand(): Array is empty in %s on line %d -NULL +try { + var_dump(array_rand(array(), 0)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -Warning: array_rand(): Array is empty in %s on line %d -NULL +try { + var_dump(array_rand(array(1,2,3), 0)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -Warning: array_rand() expects parameter 1 to be array, int given in %s on line %d -NULL +try { + var_dump(array_rand(array(1,2,3), -1)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL +try { + var_dump(array_rand(array(1,2,3), 10)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL +var_dump(array_rand(array(1,2,3), 3)); +var_dump(array_rand(array(1,2,3), 2)); -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL +echo "Done\n"; +?> +--EXPECTF-- +Array is empty +Array is empty +Second argument has to be between 1 and the number of elements in the array +Second argument has to be between 1 and the number of elements in the array +Second argument has to be between 1 and the number of elements in the array array(3) { [0]=> int(%d) diff --git a/ext/standard/tests/array/array_rand_variation5.phpt b/ext/standard/tests/array/array_rand_variation5.phpt index 30eb7d7801..03e20d6e07 100644 --- a/ext/standard/tests/array/array_rand_variation5.phpt +++ b/ext/standard/tests/array/array_rand_variation5.phpt @@ -32,17 +32,36 @@ var_dump( array_rand($input, 1) ); // with valid $num_req value // with invalid num_req value echo"\n-- With num_req = 0 --\n"; -var_dump( array_rand($input, 0) ); // with $num_req=0 +try { + var_dump( array_rand($input, 0) ); // with $num_req=0 +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + echo"\n-- With num_req = -1 --\n"; -var_dump( array_rand($input, -1) ); // with $num_req=-1 +try { + var_dump( array_rand($input, -1) ); // with $num_req=-1 +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + echo"\n-- With num_req = -2 --\n"; -var_dump( array_rand($input, -2) ); // with $num_req=-2 -echo"\n-- With num_req more than number of members in 'input' array --\n"; -var_dump( array_rand($input, 13) ); // with $num_req=13 +try { + var_dump( array_rand($input, -2) ); // with $num_req=-2 +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} +echo"\n-- With num_req more than number of members in 'input' array --\n"; +try { + var_dump( array_rand($input, 13) ); // with $num_req=13 +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -echo "Done"; ?> + +DONE --EXPECTF-- *** Testing array_rand() : with invalid values for 'req_num' *** @@ -53,22 +72,15 @@ int(%d) int(%d) -- With num_req = 0 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL +Second argument has to be between 1 and the number of elements in the array -- With num_req = -1 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL +Second argument has to be between 1 and the number of elements in the array -- With num_req = -2 -- - -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL +Second argument has to be between 1 and the number of elements in the array -- With num_req more than number of members in 'input' array -- +Second argument has to be between 1 and the number of elements in the array -Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d -NULL -Done +DONE diff --git a/ext/standard/tests/array/array_replace.phpt b/ext/standard/tests/array/array_replace.phpt index 6ba9e43fd7..48b616ab04 100644 --- a/ext/standard/tests/array/array_replace.phpt +++ b/ext/standard/tests/array/array_replace.phpt @@ -42,11 +42,15 @@ $data = array_replace_recursive($array1, $array2); var_dump($data); echo " -- Testing array_replace_recursive() w/ endless recusrsion --\n"; -$data = array_replace_recursive($array3, $array4); +try { + $data = array_replace_recursive($array3, $array4); + var_dump($data); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -var_dump($data); ?> ---EXPECTF-- +--EXPECT-- -- Testing array_replace() -- array(5) { [0]=> @@ -107,16 +111,4 @@ array(5) { } } -- Testing array_replace_recursive() w/ endless recusrsion -- - -Warning: array_replace_recursive(): recursion detected in %s on line %d -array(1) { - [0]=> - array(1) { - [0]=> - array(1) { - [0]=> - array(0) { - } - } - } -} +Recursion detected diff --git a/ext/standard/tests/array/array_search1.phpt b/ext/standard/tests/array/array_search1.phpt index 49563f9712..10c1672e54 100644 --- a/ext/standard/tests/array/array_search1.phpt +++ b/ext/standard/tests/array/array_search1.phpt @@ -5,8 +5,6 @@ array_search() tests $a = array(1=>0, 2=>1, 4=>3, "a"=>"b", "c"=>"d"); -var_dump(array_search(1)); -var_dump(array_search(1,1)); var_dump(array_search("a",$a)); var_dump(array_search("0",$a, true)); var_dump(array_search("0",$a)); @@ -18,12 +16,7 @@ var_dump(array_search(-1,$a, true)); echo "Done\n"; ?> ---EXPECTF-- -Warning: array_search() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: array_search() expects parameter 2 to be array, int given in %s on line %d -NULL +--EXPECT-- int(1) bool(false) int(1) diff --git a/ext/standard/tests/array/array_search_variation3.phpt b/ext/standard/tests/array/array_search_variation3.phpt index 41b0b5bb20..596c36f805 100644 --- a/ext/standard/tests/array/array_search_variation3.phpt +++ b/ext/standard/tests/array/array_search_variation3.phpt @@ -33,9 +33,17 @@ class array_search_check { $array_search_obj = new array_search_check(); //creating new object //error: as wrong datatype for second argument -var_dump( array_search("array_var", $array_search_obj) ); +try { + var_dump( array_search("array_var", $array_search_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //error: as wrong datatype for second argument -var_dump( array_search("foo", $array_search_obj) ); +try { + var_dump( array_search("foo", $array_search_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //element found as "one" exists in array $array_var var_dump( array_search("one", $array_search_obj->array_var) ); @@ -48,11 +56,7 @@ string(5) "three" int(5) *** Testing objects with array_search() *** - -Warning: array_search() expects parameter 2 to be array, object given in %s on line %d -NULL - -Warning: array_search() expects parameter 2 to be array, object given in %s on line %d -NULL +array_search() expects parameter 2 to be array, object given +array_search() expects parameter 2 to be array, object given int(1) Done diff --git a/ext/standard/tests/array/array_slice.phpt b/ext/standard/tests/array/array_slice.phpt index 59d804350b..d19f5195d6 100644 --- a/ext/standard/tests/array/array_slice.phpt +++ b/ext/standard/tests/array/array_slice.phpt @@ -20,26 +20,6 @@ $var_array = array( $num = 4; $str = "john"; -/* Zero args */ -echo"\n*** Output for Zero Argument ***\n"; -array_slice(); - -/* Single args */ -echo"\n*** Output for Single array Argument ***\n"; -array_slice($var_array); - -/* More than valid no. of args (ie. >4 ) */ -echo"\n*** Output for invalid number of Arguments ***\n"; -array_slice($var_array, 2, 4, true, 3); - -/* Scalar arg */ -echo"\n*** Output for scalar Argument ***\n"; -array_slice($num, 2); - -/* String arg */ -echo"\n*** Output for string Argument ***\n"; -array_slice($str, 2); - $counter = 1; foreach ($var_array as $sub_array) { @@ -89,26 +69,6 @@ foreach ($var_array as $sub_array) ?> --EXPECTF-- -*** Output for Zero Argument *** - -Warning: array_slice() expects at least 2 parameters, 0 given in %s on line %d - -*** Output for Single array Argument *** - -Warning: array_slice() expects at least 2 parameters, 1 given in %s on line %d - -*** Output for invalid number of Arguments *** - -Warning: array_slice() expects at most 4 parameters, 5 given in %s on line %d - -*** Output for scalar Argument *** - -Warning: array_slice() expects parameter 1 to be array, int given in %s on line %d - -*** Output for string Argument *** - -Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d - *** Iteration 1 *** *** Variation with first two Arguments *** diff --git a/ext/standard/tests/array/array_slice_variation1.phpt b/ext/standard/tests/array/array_slice_variation1.phpt index 7b6d712a1f..46f33b9503 100644 --- a/ext/standard/tests/array/array_slice_variation1.phpt +++ b/ext/standard/tests/array/array_slice_variation1.phpt @@ -15,12 +15,20 @@ var_dump(array_slice(range(1, 3), -1, NULL, 1)); $a = 'foo'; -var_dump(array_slice(range(1, 3), 0, $a)); -var_dump(array_slice(range(1, 3), 0, $a)); +try { + var_dump(array_slice(range(1, 3), 0, $a)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(array_slice(range(1, 3), 0, $a)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump($a); ?> ---EXPECT-- +--EXPECTF-- array(3) { [0]=> int(1) @@ -53,8 +61,6 @@ array(1) { [2]=> int(3) } -array(0) { -} -array(0) { -} +array_slice() expects parameter 3 to be int, string given +array_slice() expects parameter 3 to be int, string given string(3) "foo" diff --git a/ext/standard/tests/array/array_slice_variation2.phpt b/ext/standard/tests/array/array_slice_variation2.phpt deleted file mode 100644 index a76d68e6e0..0000000000 --- a/ext/standard/tests/array/array_slice_variation2.phpt +++ /dev/null @@ -1,303 +0,0 @@ ---TEST-- -Test array_slice() function : usage variations - Pass different data types as $offset arg ---SKIPIF-- -<?php if (PHP_INT_SIZE > 4) die("skip this test is for 32bit platform only"); ?> ---FILE-- -<?php -/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]]) - * Description: Returns elements specified by offset and length - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $offset argument to array_slice() to test behaviour - */ - -echo "*** Testing array_slice() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$input_array = array('one' => 1, 2, 'three' => 3, 4); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $offset argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, -); - -// loop through each element of $inputs to check the behavior of array_slice() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_slice($input_array, $input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_slice() : usage variations *** - --- Iteration 1 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 2 -- -array(3) { - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 3 -- -array(0) { -} - --- Iteration 4 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 5 -- -array(0) { -} - --- Iteration 6 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 7 -- - -Warning: array_slice() expects parameter 2 to be int, float given in %s on line %d -NULL - --- Iteration 8 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 9 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 10 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 11 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 12 -- -array(3) { - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 13 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 14 -- -array(3) { - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 15 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 16 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: array_slice() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 22 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 23 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} -Done diff --git a/ext/standard/tests/array/array_udiff_assoc_variation1.phpt b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt index 2cbc9572d2..9f320c04ad 100644 --- a/ext/standard/tests/array/array_udiff_assoc_variation1.phpt +++ b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff_assoc($value, $arr2, $key_comp_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_udiff_assoc($value, $arr2, $key_comp_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_udiff_assoc() : usage variation *** --int 0-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_udiff_assoc_variation2.phpt b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt index 1a2c1ed978..e0eaaf63ce 100644 --- a/ext/standard/tests/array/array_udiff_assoc_variation2.phpt +++ b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff_assoc($arr1, $value, $key_comp_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_udiff_assoc($arr1, $value, $key_comp_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_udiff_assoc() : usage variation *** --int 0-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_udiff_assoc_variation4.phpt b/ext/standard/tests/array/array_udiff_assoc_variation4.phpt deleted file mode 100644 index 20a5afa202..0000000000 --- a/ext/standard/tests/array/array_udiff_assoc_variation4.phpt +++ /dev/null @@ -1,228 +0,0 @@ ---TEST-- -Test array_udiff_assoc() function : usage variation ---FILE-- -<?php -/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func) - * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function. - * Source code: ext/standard/array.c - * Alias to functions: - */ - -echo "*** Testing array_udiff_assoc() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$arr1 = array(1, 2); -$arr2 = array(1, 2); - -include('compare_function.inc'); -$key_comp_func = 'compare_function'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for ... - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff_assoc($arr1, $arr2, $value, $key_comp_func) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing array_udiff_assoc() : usage variation *** - ---int 0-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---int 1-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---int 12345-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---int -12345-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---float 10.5-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---float -10.5-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---float .5-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---uppercase NULL-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---lowercase null-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---lowercase true-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---lowercase false-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---uppercase TRUE-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---uppercase FALSE-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---empty string DQ-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---empty string SQ-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---string DQ-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---string SQ-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---mixed case string-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---heredoc-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---instance of classWithToString-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---undefined var-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d -NULL - ---unset var-- - -Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt index 4496194b62..bbc213aee4 100644 --- a/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt @@ -92,137 +92,91 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff_uassoc($value, $arr2, $data_comp_func, $key_comp_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_udiff_uassoc($value, $arr2, $data_comp_func, $key_comp_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_udiff_uassoc() : usage variation *** --int 0-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt index 2324c5a47b..9466dc952b 100644 --- a/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt @@ -92,137 +92,91 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff_uassoc($arr1, $value, $data_comp_func, $key_comp_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_udiff_uassoc($arr1, $value, $data_comp_func, $key_comp_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_udiff_uassoc() : usage variation *** --int 0-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt deleted file mode 100644 index 820f0466ad..0000000000 --- a/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt +++ /dev/null @@ -1,229 +0,0 @@ ---TEST-- -Test array_udiff_uassoc() function : usage variation ---FILE-- -<?php -/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func) - * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions. - * Source code: ext/standard/array.c - * Alias to functions: - */ - -echo "*** Testing array_udiff_uassoc() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$arr1 = array(1, 2); -$arr2 = array(1, 2); - -include('compare_function.inc'); -$data_comp_func = 'compare_function'; -$key_comp_func = 'compare_function'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for ... - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff_uassoc($arr1, $arr2, $value, $data_comp_func, $key_comp_func) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing array_udiff_uassoc() : usage variation *** - ---int 0-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---int 1-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---int 12345-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---int -12345-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---float 10.5-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---float -10.5-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---float .5-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---uppercase NULL-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---lowercase null-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---lowercase true-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---lowercase false-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---uppercase TRUE-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---uppercase FALSE-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---empty string DQ-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---empty string SQ-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---string DQ-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---string SQ-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---mixed case string-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---heredoc-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---instance of classWithToString-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---undefined var-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d -NULL - ---unset var-- - -Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_udiff_variation1.phpt b/ext/standard/tests/array/array_udiff_variation1.phpt index 5eb84146a1..f462be78c0 100644 --- a/ext/standard/tests/array/array_udiff_variation1.phpt +++ b/ext/standard/tests/array/array_udiff_variation1.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff($value, $arr2, $data_comp_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_udiff($value, $arr2, $data_comp_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_udiff() : usage variation *** --int 0-- - -Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_udiff(): Expected parameter 1 to be an array, object given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_udiff(): Expected parameter 1 to be an array, object given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_udiff_variation2.phpt b/ext/standard/tests/array/array_udiff_variation2.phpt index 61aa1f0c9a..ee478837cd 100644 --- a/ext/standard/tests/array/array_udiff_variation2.phpt +++ b/ext/standard/tests/array/array_udiff_variation2.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff($arr1, $value, $data_comp_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_udiff($arr1, $value, $data_comp_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_udiff() : usage variation *** --int 0-- - -Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_udiff(): Expected parameter 2 to be an array, object given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_udiff(): Expected parameter 2 to be an array, object given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_udiff_variation4.phpt b/ext/standard/tests/array/array_udiff_variation4.phpt deleted file mode 100644 index a92c5ddfdf..0000000000 --- a/ext/standard/tests/array/array_udiff_variation4.phpt +++ /dev/null @@ -1,228 +0,0 @@ ---TEST-- -Test array_udiff() function : usage variation ---FILE-- -<?php -/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func) - * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments. Elements are compared by user supplied function. - * Source code: ext/standard/array.c - * Alias to functions: - */ - -echo "*** Testing array_udiff() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$arr1 = array(1, 2); -$arr2 = array(1, 2); - -include('compare_function.inc'); -$data_comp_func = 'compare_function'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for ... - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_udiff($arr1, $arr2, $value, $data_comp_func) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing array_udiff() : usage variation *** - ---int 0-- - -Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d -NULL - ---int 1-- - -Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d -NULL - ---int 12345-- - -Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d -NULL - ---int -12345-- - -Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d -NULL - ---float 10.5-- - -Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d -NULL - ---float -10.5-- - -Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d -NULL - ---float .5-- - -Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d -NULL - ---uppercase NULL-- - -Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d -NULL - ---lowercase null-- - -Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d -NULL - ---lowercase true-- - -Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d -NULL - ---lowercase false-- - -Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d -NULL - ---uppercase TRUE-- - -Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d -NULL - ---uppercase FALSE-- - -Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d -NULL - ---empty string DQ-- - -Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d -NULL - ---empty string SQ-- - -Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d -NULL - ---string DQ-- - -Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d -NULL - ---string SQ-- - -Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d -NULL - ---mixed case string-- - -Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d -NULL - ---heredoc-- - -Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d -NULL - ---instance of classWithToString-- - -Warning: array_udiff(): Expected parameter 3 to be an array, object given in %sarray_udiff_variation4.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_udiff(): Expected parameter 3 to be an array, object given in %sarray_udiff_variation4.php on line %d -NULL - ---undefined var-- - -Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d -NULL - ---unset var-- - -Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt index a2babcdb02..8a3ffe909d 100644 --- a/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt +++ b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect_assoc($value, $arr2, $data_compare_function) ); + echo "\n--$key--\n"; + try { + var_dump( array_uintersect_assoc($value, $arr2, $data_compare_function) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_uintersect_assoc() : usage variation *** --int 0-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt index 8723157506..3c04bd5a36 100644 --- a/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt +++ b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect_assoc($arr1, $value, $data_compare_function) ); + echo "\n--$key--\n"; + try { + var_dump( array_uintersect_assoc($arr1, $value, $data_compare_function) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_uintersect_assoc() : usage variation *** --int 0-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt deleted file mode 100644 index 3024246a3d..0000000000 --- a/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt +++ /dev/null @@ -1,228 +0,0 @@ ---TEST-- -Test array_uintersect_assoc() function : usage variation ---FILE-- -<?php -/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func) - * Description: U - * Source code: ext/standard/array.c - * Alias to functions: - */ - -echo "*** Testing array_uintersect_assoc() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$arr1 = array(1, 2); -$arr2 = array(1, 2); - -include('compare_function.inc'); -$data_compare_function = 'compare_function'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for ... - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect_assoc($arr1, $arr2, $value, $data_compare_function ) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing array_uintersect_assoc() : usage variation *** - ---int 0-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---int 1-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---int 12345-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---int -12345-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---float 10.5-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---float -10.5-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---float .5-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---uppercase NULL-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---lowercase null-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---lowercase true-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---lowercase false-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---uppercase TRUE-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---uppercase FALSE-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---empty string DQ-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---empty string SQ-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---string DQ-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---string SQ-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---mixed case string-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---heredoc-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---instance of classWithToString-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---undefined var-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d -NULL - ---unset var-- - -Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt index 84d4e634cf..385fffed96 100644 --- a/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt @@ -92,137 +92,91 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect_uassoc($value, $arr2, $data_compare_func, $key_compare_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_uintersect_uassoc($value, $arr2, $data_compare_func, $key_compare_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_uintersect_uassoc() : usage variation *** --int 0-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt index 8692026fc4..74eeddf4ff 100644 --- a/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt +++ b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt @@ -92,137 +92,91 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect_uassoc($arr1, $value, $data_compare_func, $key_compare_func) ); + echo "\n--$key--\n"; + try { + var_dump( array_uintersect_uassoc($arr1, $value, $data_compare_func, $key_compare_func) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_uintersect_uassoc() : usage variation *** --int 0-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt deleted file mode 100644 index d1db008416..0000000000 --- a/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt +++ /dev/null @@ -1,229 +0,0 @@ ---TEST-- -Test array_uintersect_uassoc() function : usage variation ---FILE-- -<?php -/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func) - * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks. - * Source code: ext/standard/array.c - * Alias to functions: - */ - -echo "*** Testing array_uintersect_uassoc() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$arr1 = array(1, 2); -$arr2 = array(1, 2); - -include('compare_function.inc'); -$data_compare_func = 'compare_function'; -$key_compare_func = 'compare_function'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for ... - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect_uassoc($arr1, $arr2, $value, $data_compare_func, $key_compare_func) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing array_uintersect_uassoc() : usage variation *** - ---int 0-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---int 1-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---int 12345-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---int -12345-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---float 10.5-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---float -10.5-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---float .5-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---uppercase NULL-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---lowercase null-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---lowercase true-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---lowercase false-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---uppercase TRUE-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---uppercase FALSE-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---empty string DQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---empty string SQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---string DQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---string SQ-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---mixed case string-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---heredoc-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---instance of classWithToString-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---undefined var-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL - ---unset var-- - -Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation1.phpt b/ext/standard/tests/array/array_uintersect_variation1.phpt index c88177018b..32e2177758 100644 --- a/ext/standard/tests/array/array_uintersect_variation1.phpt +++ b/ext/standard/tests/array/array_uintersect_variation1.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr1 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect($value, $arr2, $data_compare_function) ); + echo "\n--$key--\n"; + try { + var_dump( array_uintersect($value, $arr2, $data_compare_function) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_uintersect() : usage variation *** --int 0-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 1-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int 12345-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --int -12345-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, int given --float 10.5-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -10.5-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float 12.3456789000e10-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float -12.3456789000e10-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --float .5-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, float given --uppercase NULL-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase null-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --lowercase true-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --lowercase false-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase TRUE-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --uppercase FALSE-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, bool given --empty string DQ-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --empty string SQ-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string DQ-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --string SQ-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --mixed case string-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --heredoc-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, string given --instance of classWithToString-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, object given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --instance of classWithoutToString-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, object given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, object given --undefined var-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given --unset var-- - -Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d -NULL +Expected parameter 1 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation2.phpt b/ext/standard/tests/array/array_uintersect_variation2.phpt index ee52e21c72..bf914e9bc6 100644 --- a/ext/standard/tests/array/array_uintersect_variation2.phpt +++ b/ext/standard/tests/array/array_uintersect_variation2.phpt @@ -91,137 +91,91 @@ $inputs = array( // loop through each element of the array for arr2 foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect($arr1, $value, $data_compare_function) ); + echo "\n--$key--\n"; + try { + var_dump( array_uintersect($arr1, $value, $data_compare_function) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_uintersect() : usage variation *** --int 0-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 1-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int 12345-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --int -12345-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, int given --float 10.5-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -10.5-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float 12.3456789000e10-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float -12.3456789000e10-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --float .5-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, float given --uppercase NULL-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase null-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --lowercase true-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --lowercase false-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase TRUE-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --uppercase FALSE-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, bool given --empty string DQ-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --empty string SQ-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string DQ-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --string SQ-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --mixed case string-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --heredoc-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, string given --instance of classWithToString-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, object given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --instance of classWithoutToString-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, object given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, object given --undefined var-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given --unset var-- - -Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d -NULL +Expected parameter 2 to be an array, null given ===DONE=== diff --git a/ext/standard/tests/array/array_uintersect_variation4.phpt b/ext/standard/tests/array/array_uintersect_variation4.phpt deleted file mode 100644 index abc33e591b..0000000000 --- a/ext/standard/tests/array/array_uintersect_variation4.phpt +++ /dev/null @@ -1,228 +0,0 @@ ---TEST-- -Test array_uintersect() function : usage variation ---FILE-- -<?php -/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func) - * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Data is compared by using an user-supplied callback. - * Source code: ext/standard/array.c - * Alias to functions: - */ - -echo "*** Testing array_uintersect() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$arr1 = array(1, 2); -$arr2 = array(1, 2); - -include('compare_function.inc'); -$data_compare_function = 'compare_function'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for ... - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( array_uintersect($arr1, $arr2, $value, $data_compare_function) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing array_uintersect() : usage variation *** - ---int 0-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d -NULL - ---int 1-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d -NULL - ---int 12345-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d -NULL - ---int -12345-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d -NULL - ---float 10.5-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d -NULL - ---float -10.5-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d -NULL - ---float 12.3456789000e10-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d -NULL - ---float -12.3456789000e10-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d -NULL - ---float .5-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d -NULL - ---uppercase NULL-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d -NULL - ---lowercase null-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d -NULL - ---lowercase true-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d -NULL - ---lowercase false-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d -NULL - ---uppercase TRUE-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d -NULL - ---uppercase FALSE-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d -NULL - ---empty string DQ-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d -NULL - ---empty string SQ-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d -NULL - ---string DQ-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d -NULL - ---string SQ-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d -NULL - ---mixed case string-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d -NULL - ---heredoc-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d -NULL - ---instance of classWithToString-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, object given in %sarray_uintersect_variation4.php on line %d -NULL - ---instance of classWithoutToString-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, object given in %sarray_uintersect_variation4.php on line %d -NULL - ---undefined var-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d -NULL - ---unset var-- - -Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/array/array_unshift.phpt b/ext/standard/tests/array/array_unshift.phpt index 9b474277a9..9ebe83391e 100644 --- a/ext/standard/tests/array/array_unshift.phpt +++ b/ext/standard/tests/array/array_unshift.phpt @@ -7,8 +7,6 @@ $a = array(); $s = ""; var_dump(array_unshift($a, $s)); var_dump($a); -var_dump(array_unshift($s, $a)); -var_dump($a); var_dump(array_unshift($a, $a)); var_dump($a); @@ -20,13 +18,6 @@ array(1) { [0]=> string(0) "" } - -Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d -NULL -array(1) { - [0]=> - string(0) "" -} int(2) array(2) { [0]=> diff --git a/ext/standard/tests/array/array_walk.phpt b/ext/standard/tests/array/array_walk.phpt index 7cd8a8cf7a..cf792bfa19 100644 --- a/ext/standard/tests/array/array_walk.phpt +++ b/ext/standard/tests/array/array_walk.phpt @@ -3,12 +3,6 @@ array_walk() tests --FILE-- <?php -var_dump(array_walk()); -$var = 1; -var_dump(array_walk($var,1)); -$var = array(); -var_dump(array_walk($var,"")); - function foo($v1, $v2, $v3) { var_dump($v1); var_dump($v2); @@ -31,14 +25,6 @@ try { echo "Done\n"; ?> --EXPECTF-- -Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL int(1) int(0) string(4) "data" diff --git a/ext/standard/tests/array/array_walk_closure.phpt b/ext/standard/tests/array/array_walk_closure.phpt index 0a5d854582..7ac62d7484 100644 --- a/ext/standard/tests/array/array_walk_closure.phpt +++ b/ext/standard/tests/array/array_walk_closure.phpt @@ -3,14 +3,6 @@ array_walk() closure tests --FILE-- <?php -var_dump(array_walk()); - -$ar = false; -var_dump(array_walk($ar, $ar)); - -$ar = NULL; -var_dump(array_walk($ar, $ar)); - $ar = ["one" => 1, "two"=>2, "three" => 3]; var_dump(array_walk($ar, function(){ var_dump(func_get_args());})); @@ -94,14 +86,6 @@ try { echo "Done\n"; ?> --EXPECTF-- -Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d -NULL array(2) { [0]=> int(1) diff --git a/ext/standard/tests/array/array_walk_error2.phpt b/ext/standard/tests/array/array_walk_error2.phpt index a4026180fb..73445892a6 100644 --- a/ext/standard/tests/array/array_walk_error2.phpt +++ b/ext/standard/tests/array/array_walk_error2.phpt @@ -61,7 +61,5 @@ Exception: Too few arguments to function callback2(), 3 passed and exactly 4 exp Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected -- Testing array_walk() function with too many callback parameters -- - -Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d -NULL +Exception: array_walk() expects at most 3 parameters, 4 given Done diff --git a/ext/standard/tests/array/array_walk_objects.phpt b/ext/standard/tests/array/array_walk_objects.phpt index fc04304fc5..9f3ac8c1cd 100644 --- a/ext/standard/tests/array/array_walk_objects.phpt +++ b/ext/standard/tests/array/array_walk_objects.phpt @@ -24,7 +24,11 @@ array_walk($t, "walk"); $var = array(); array_walk($var, "walk"); $var = ""; -array_walk($var, "walk"); +try { + array_walk($var, "walk"); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -39,6 +43,5 @@ string(10) "%r\0%r*%r\0%rvar_pro" string(14) "test_protected" string(7) "var_pub" string(11) "test_public" - -Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d +array_walk() expects parameter 1 to be array, string given Done diff --git a/ext/standard/tests/array/array_walk_rec_objects.phpt b/ext/standard/tests/array/array_walk_rec_objects.phpt index a83c227a3b..097143e8ec 100644 --- a/ext/standard/tests/array/array_walk_rec_objects.phpt +++ b/ext/standard/tests/array/array_walk_rec_objects.phpt @@ -24,7 +24,11 @@ array_walk_recursive($t, "walk"); $var = array(); array_walk_recursive($var, "walk"); $var = ""; -array_walk_recursive($var, "walk"); +try { + array_walk_recursive($var, "walk"); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -39,6 +43,5 @@ string(10) "%r\0%r*%r\0%rvar_pro" string(14) "test_protected" string(7) "var_pub" string(11) "test_public" - -Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d +array_walk_recursive() expects parameter 1 to be array, string given Done diff --git a/ext/standard/tests/array/array_walk_recursive1.phpt b/ext/standard/tests/array/array_walk_recursive1.phpt index 962f133e4c..f952b4410b 100644 --- a/ext/standard/tests/array/array_walk_recursive1.phpt +++ b/ext/standard/tests/array/array_walk_recursive1.phpt @@ -3,12 +3,6 @@ array_walk_recursive() tests --FILE-- <?php -var_dump(array_walk_recursive()); -$var = 1; -var_dump(array_walk_recursive($var,1)); -$var = array(); -var_dump(array_walk_recursive($var,"")); - function foo($v1, $v2, $v3) { var_dump($v1); var_dump($v2); @@ -31,14 +25,6 @@ try { echo "Done\n"; ?> --EXPECTF-- -Warning: array_walk_recursive() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL int(1) int(0) string(4) "data" diff --git a/ext/standard/tests/array/array_walk_recursive_error2.phpt b/ext/standard/tests/array/array_walk_recursive_error2.phpt index b162a1c9dc..e9bd7ea175 100644 --- a/ext/standard/tests/array/array_walk_recursive_error2.phpt +++ b/ext/standard/tests/array/array_walk_recursive_error2.phpt @@ -61,7 +61,5 @@ Exception: Too few arguments to function callback2(), 3 passed and exactly 4 exp Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected -- Testing array_walk_recursive() function with too many callback parameters -- - -Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d -NULL +Exception: array_walk_recursive() expects at most 3 parameters, 4 given Done diff --git a/ext/standard/tests/array/array_walk_recursive_variation7.phpt b/ext/standard/tests/array/array_walk_recursive_variation7.phpt index 06dc1aaa09..a0c159d71d 100644 --- a/ext/standard/tests/array/array_walk_recursive_variation7.phpt +++ b/ext/standard/tests/array/array_walk_recursive_variation7.phpt @@ -29,9 +29,6 @@ var_dump( array_walk_recursive($input, function($value, $key) { var_dump($key); echo "-- Anonymous function with three arguments --\n"; var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10)); -echo "-- Anonymous function with one more argument --\n"; -var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30)); - echo "-- Anonymous function with null argument --\n"; var_dump( array_walk_recursive( $input, function() { echo "1\n"; })); echo "Done" @@ -80,10 +77,6 @@ int(0) int(10) bool(true) --- Anonymous function with one more argument -- - -Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d -NULL -- Anonymous function with null argument -- 1 1 diff --git a/ext/standard/tests/array/array_walk_recursive_variation8.phpt b/ext/standard/tests/array/array_walk_recursive_variation8.phpt index 2db8067fe0..51eba1e0e0 100644 --- a/ext/standard/tests/array/array_walk_recursive_variation8.phpt +++ b/ext/standard/tests/array/array_walk_recursive_variation8.phpt @@ -25,7 +25,11 @@ echo "-- With 'min' built-in function --\n"; var_dump( array_walk_recursive($input, "min")); echo "-- With 'echo' language construct --\n"; -var_dump( array_walk_recursive($input, "echo")); +try { + var_dump( array_walk_recursive($input, "echo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -36,7 +40,5 @@ bool(true) -- With 'min' built-in function -- bool(true) -- With 'echo' language construct -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_walk_recursive() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_walk_variation7.phpt b/ext/standard/tests/array/array_walk_variation7.phpt index 671ad44309..0354782eda 100644 --- a/ext/standard/tests/array/array_walk_variation7.phpt +++ b/ext/standard/tests/array/array_walk_variation7.phpt @@ -29,9 +29,6 @@ var_dump( array_walk($input, function($value, $key) { var_dump($key); var_dump($ echo "-- Anonymous function with three arguments --\n"; var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10)); -echo "-- Anonymous function with one more argument --\n"; -var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30)); - echo "-- Anonymous function with null argument --\n"; var_dump( array_walk( $input, function() { echo "1\n"; })); echo "Done" @@ -80,10 +77,6 @@ int(0) int(10) bool(true) --- Anonymous function with one more argument -- - -Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d -NULL -- Anonymous function with null argument -- 1 1 diff --git a/ext/standard/tests/array/array_walk_variation8.phpt b/ext/standard/tests/array/array_walk_variation8.phpt index 829baf1add..baa5f3914b 100644 --- a/ext/standard/tests/array/array_walk_variation8.phpt +++ b/ext/standard/tests/array/array_walk_variation8.phpt @@ -25,7 +25,11 @@ echo "-- With 'min' built-in function --\n"; var_dump( array_walk($input, "min")); echo "-- With 'echo' language construct --\n"; -var_dump( array_walk($input, "echo")); +try { + var_dump( array_walk($input, "echo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -36,7 +40,5 @@ bool(true) -- With 'min' built-in function -- bool(true) -- With 'echo' language construct -- - -Warning: array_walk() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_walk() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name Done diff --git a/ext/standard/tests/array/bug35014.phpt b/ext/standard/tests/array/bug35014.phpt index f858bf107b..b674590fd6 100644 --- a/ext/standard/tests/array/bug35014.phpt +++ b/ext/standard/tests/array/bug35014.phpt @@ -7,7 +7,6 @@ precision=14 --FILE-- <?php $tests = array( - 'foo', array(), array(0), array(3), @@ -22,9 +21,7 @@ foreach ($tests as $v) { var_dump(array_product($v)); } ?> ---EXPECTF-- -Warning: array_product() expects parameter 1 to be array, string given in %s on line %d -NULL +--EXPECT-- int(1) int(0) int(3) diff --git a/ext/standard/tests/array/bug35014_64bit.phpt b/ext/standard/tests/array/bug35014_64bit.phpt index 5caf48c6ee..3b3d29b5be 100644 --- a/ext/standard/tests/array/bug35014_64bit.phpt +++ b/ext/standard/tests/array/bug35014_64bit.phpt @@ -7,7 +7,6 @@ precision=14 --FILE-- <?php $tests = array( - 'foo', array(), array(0), array(3), @@ -22,9 +21,7 @@ foreach ($tests as $v) { var_dump(array_product($v)); } ?> ---EXPECTF-- -Warning: array_product() expects parameter 1 to be array, string given in %s on line %d -NULL +--EXPECT-- int(1) int(0) int(3) diff --git a/ext/standard/tests/array/bug40191.phpt b/ext/standard/tests/array/bug40191.phpt index f5e439821d..b94e709364 100644 --- a/ext/standard/tests/array/bug40191.phpt +++ b/ext/standard/tests/array/bug40191.phpt @@ -8,12 +8,14 @@ $arrObj->append('foo'); $arrObj->append('bar'); $arrObj->append('foo'); -$arr = array_unique($arrObj); -var_dump($arr); +try { + $arr = array_unique($arrObj); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> ---EXPECTF-- -Warning: array_unique() expects parameter 1 to be array, object given in %s on line %d -NULL +--EXPECT-- +array_unique() expects parameter 1 to be array, object given Done diff --git a/ext/standard/tests/array/bug42177.phpt b/ext/standard/tests/array/bug42177.phpt index 5678ca3cac..dc5297b302 100644 --- a/ext/standard/tests/array/bug42177.phpt +++ b/ext/standard/tests/array/bug42177.phpt @@ -18,7 +18,11 @@ unset( $a1, $a2 ); $a1 = array(); $a2 = array( 'key1' => &$a1 ); $a1 = array_merge_recursive( $a1, $a2 ); -$a1 = array_merge_recursive( $a1, $a2 ); +try { + $a1 = array_merge_recursive( $a1, $a2 ); +} catch (\Error $e) { + echo $e->getMessage() . " on line " . $e->getLine() . "\n"; +} unset( $a1, $a2 ); $x = 'foo'; @@ -30,5 +34,5 @@ $a1 = array_merge_recursive( $a1, $a2 ); unset( $a1, $a2 ); ?> ---EXPECTF-- -Warning: array_merge_recursive(): recursion detected in %s on line 18 +--EXPECT-- +Recursion detected on line 19 diff --git a/ext/standard/tests/array/bug43495.phpt b/ext/standard/tests/array/bug43495.phpt index 522ff1903b..cb011d3d44 100644 --- a/ext/standard/tests/array/bug43495.phpt +++ b/ext/standard/tests/array/bug43495.phpt @@ -8,14 +8,21 @@ $a["key1"]["key2"]["key3"]=&$a; $b=array("key1"=>array("key2"=>array())); $b["key1"]["key2"]["key3"]=&$b; -array_merge_recursive($a,$b); + +try { + array_merge_recursive($a,$b); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} /* Break recursion */ $a["key1"]["key2"]["key3"] = null; $b["key1"]["key2"]["key3"] = null; -echo "Done.\n"; ?> ---EXPECTF-- -Warning: array_merge_recursive(): recursion detected in %sbug43495.php on line %d -Done. + +DONE +--EXPECT-- +Recursion detected + +DONE diff --git a/ext/standard/tests/array/bug65251.phpt b/ext/standard/tests/array/bug65251.phpt index 014517794c..3e0f3a1e27 100644 --- a/ext/standard/tests/array/bug65251.phpt +++ b/ext/standard/tests/array/bug65251.phpt @@ -3,8 +3,12 @@ Bug #65251: array_merge_recursive() recursion detection broken --FILE-- <?php -array_merge_recursive($GLOBALS, $GLOBALS) +try { + array_merge_recursive($GLOBALS, $GLOBALS); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} ?> ---EXPECTF-- -Warning: array_merge_recursive(): recursion detected in %s on line %d +--EXPECT-- +Recursion detected diff --git a/ext/standard/tests/array/bug67693.phpt b/ext/standard/tests/array/bug67693.phpt index 516436c511..c9aa2d86fa 100644 --- a/ext/standard/tests/array/bug67693.phpt +++ b/ext/standard/tests/array/bug67693.phpt @@ -16,9 +16,9 @@ echo"\nDone"; ?> --EXPECT-- array(2) { - [0]=> + [-1]=> int(0) - [1]=> + [0]=> int(0) } diff --git a/ext/standard/tests/array/bug70713.phpt b/ext/standard/tests/array/bug70713.phpt index 7cd0a0f113..f24720607d 100644 --- a/ext/standard/tests/array/bug70713.phpt +++ b/ext/standard/tests/array/bug70713.phpt @@ -19,8 +19,13 @@ class obj } $arr = array('string' => new obj); -array_walk_recursive($arr, 'settype'); + +try { + array_walk_recursive($arr, 'settype'); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} ?> ---EXPECTF-- -Warning: array_walk_recursive(): Iterated value is no longer an array or object in %s on line %d +--EXPECT-- +Iterated value is no longer an array or object diff --git a/ext/standard/tests/array/bug71220.phpt b/ext/standard/tests/array/bug71220.phpt index 49e5bb7719..ed46b25e18 100644 --- a/ext/standard/tests/array/bug71220.phpt +++ b/ext/standard/tests/array/bug71220.phpt @@ -3,8 +3,14 @@ Bug #71220 (Null pointer deref (segfault) in compact via ob_start) --FILE-- <?php ob_start("compact"); -ob_end_clean(); +try { + ob_end_clean(); +} catch (\Error $e) { + echo $e->getMessage(); +} ?> -okey + +OKAY --EXPECT-- -okey +Cannot call compact() dynamically +OKAY diff --git a/ext/standard/tests/array/bug77395.phpt b/ext/standard/tests/array/bug77395.phpt index 7910e36982..b90e9dd976 100644 --- a/ext/standard/tests/array/bug77395.phpt +++ b/ext/standard/tests/array/bug77395.phpt @@ -10,7 +10,12 @@ function error_handle($level, $message, $file = '', $line = 0){ } set_error_handler('error_handle'); $data = [['aa'=> 'bb',], ['aa'=> 'bb',],]; -array_multisort(array_column($data, 'bb'),SORT_DESC, $data); // PHP Warning error + +try { + array_multisort(array_column($data, 'bb'),SORT_DESC, $data); // PHP Warning error +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} ?> --EXPECT-- -array_multisort(): Array sizes are inconsistent +Array sizes are inconsistent diff --git a/ext/standard/tests/array/bug77931.phpt b/ext/standard/tests/array/bug77931.phpt index 98a2eb91cf..45a241f27f 100644 --- a/ext/standard/tests/array/bug77931.phpt +++ b/ext/standard/tests/array/bug77931.phpt @@ -3,14 +3,24 @@ Bug #77931: Warning for array_map mentions wrong type --FILE-- <?php -array_map('trim', array(), 1); -array_map('trim', array(), array(), true); -array_map('trim', array(), array(), array(), null); +try { + array_map('trim', array(), 1); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + array_map('trim', array(), array(), true); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + array_map('trim', array(), array(), array(), null); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: array_map(): Expected parameter 3 to be an array, int given in %s on line %d - -Warning: array_map(): Expected parameter 4 to be an array, bool given in %s on line %d - -Warning: array_map(): Expected parameter 5 to be an array, null given in %s on line %d +--EXPECT-- +Expected parameter 3 to be an array, int given +Expected parameter 4 to be an array, bool given +Expected parameter 5 to be an array, null given diff --git a/ext/standard/tests/array/compact_variation1.phpt b/ext/standard/tests/array/compact_variation1.phpt index d2b9fc45df..9201bc5aa1 100644 --- a/ext/standard/tests/array/compact_variation1.phpt +++ b/ext/standard/tests/array/compact_variation1.phpt @@ -10,7 +10,7 @@ Test compact() function : usage variations - arrays containing references. /* * compact variations - arrays with references */ -echo "*** Testing compact() : usage variations - arrays containg references ***\n"; +echo "*** Testing compact() : usage variations - arrays containing references ***\n"; $a = 1; $b = 2; $c = 3; @@ -20,31 +20,34 @@ $arr2 = array("a", array(array(array("b")))); $arr2[1][0][0][] = &$arr2; $arr2[1][0][0][] = &$arr2[1]; $arr3 = array(&$string); -var_dump(compact($arr1)); -var_dump(compact($arr2)); -var_dump(compact($arr3)); -echo "Done"; -?> ---EXPECTF-- -*** Testing compact() : usage variations - arrays containg references *** -Warning: compact(): recursion detected in %s on line %d -array(1) { - ["a"]=> - int(1) +try { + var_dump(compact($arr1)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; } -Warning: compact(): recursion detected in %s on line %d +try { + var_dump(compact($arr2)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -Warning: compact(): recursion detected in %s on line %d -array(2) { - ["a"]=> - int(1) - ["b"]=> - int(2) +try { + var_dump(compact($arr3)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; } +?> + +DONE +--EXPECT-- +*** Testing compact() : usage variations - arrays containing references *** +Recursion detected +Recursion detected array(1) { ["c"]=> int(3) } -Done + +DONE diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt index 175cfe7118..1fd2e8e6ca 100644 --- a/ext/standard/tests/array/count_recursive.phpt +++ b/ext/standard/tests/array/count_recursive.phpt @@ -111,16 +111,6 @@ for( $i =0; $i < count( $mode_arr ); $i++) { var_dump(count($arr, $mode_arr[$i])); } - -echo "\n-- Testing error conditions --"; -var_dump( count() ); // No. of args = 0 -var_dump( count(array(), COUNT_NORMAL, 100) ); // No. of args > expected - -/* Testing Invalid type arguments */ -var_dump( count("string", ABCD) ); -var_dump( count(100, "string") ); -var_dump( count(array(), "") ); - echo "\nDone"; /* closing the resource handles */ @@ -230,22 +220,4 @@ For mode '1' count is => int(9) For mode '' count is => int(3) For mode '' count is => int(3) --- Testing error conditions -- -Warning: count() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: count() expects at most 2 parameters, 3 given in %s on line %d -NULL - -Warning: Use of undefined constant ABCD - assumed 'ABCD' (this will throw an Error in a future version of PHP) in %s on line %d - -Warning: count() expects parameter 2 to be int, %s given in %s on line %d -NULL - -Warning: count() expects parameter 2 to be int, %s given in %s on line %d -NULL - -Warning: count() expects parameter 2 to be int, %s given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/array/each.phpt b/ext/standard/tests/array/each.phpt Binary files differdeleted file mode 100644 index 4af2097a7d..0000000000 --- a/ext/standard/tests/array/each.phpt +++ /dev/null diff --git a/ext/standard/tests/array/each_basic.phpt b/ext/standard/tests/array/each_basic.phpt deleted file mode 100644 index cd38682dc7..0000000000 --- a/ext/standard/tests/array/each_basic.phpt +++ /dev/null @@ -1,76 +0,0 @@ ---TEST-- -Test each() function : basic functionality ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test basic functionality of each() - */ - -echo "*** Testing each() : basic functionality ***\n"; - -$arr = array ('one' => 1, 'zero', 'two' => 'deux', 20 => 'twenty'); -echo "\n-- Passed array: --\n"; -var_dump($arr); - -echo "\n-- Initial position: --\n"; -var_dump(each($arr)); - -echo "\n-- End position: --\n"; -end($arr); -var_dump(each($arr)); - -echo "\n-- Passed the end of array: --\n"; -var_dump(each($arr)); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : basic functionality *** - --- Passed array: -- -array(4) { - ["one"]=> - int(1) - [0]=> - string(4) "zero" - ["two"]=> - string(4) "deux" - [20]=> - string(6) "twenty" -} - --- Initial position: -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - int(1) - ["value"]=> - int(1) - [0]=> - string(3) "one" - ["key"]=> - string(3) "one" -} - --- End position: -- -array(4) { - [1]=> - string(6) "twenty" - ["value"]=> - string(6) "twenty" - [0]=> - int(20) - ["key"]=> - int(20) -} - --- Passed the end of array: -- -bool(false) -Done diff --git a/ext/standard/tests/array/each_error.phpt b/ext/standard/tests/array/each_error.phpt deleted file mode 100644 index e7ee4976ed..0000000000 --- a/ext/standard/tests/array/each_error.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Test each() function : error conditions - pass incorrect number of args ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass an incorrect number of arguments to each() to test behaviour - */ - -echo "*** Testing each() : error conditions ***\n"; - -// Zero arguments -echo "\n-- Testing each() function with Zero arguments --\n"; -var_dump( each() ); - -//Test each with one more than the expected number of arguments -echo "\n-- Testing each() function with more than expected no. of arguments --\n"; -$arr = array(1, 2); -$extra_arg = 10; -var_dump( each($arr, $extra_arg) ); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : error conditions *** - --- Testing each() function with Zero arguments -- - -Warning: each() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing each() function with more than expected no. of arguments -- - -Warning: each() expects exactly 1 parameter, 2 given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/each_variation1.phpt b/ext/standard/tests/array/each_variation1.phpt deleted file mode 100644 index 6b75d5e15c..0000000000 --- a/ext/standard/tests/array/each_variation1.phpt +++ /dev/null @@ -1,223 +0,0 @@ ---TEST-- -Test each() function : usage variations - Pass different data types as $arr arg ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass different data types as $arr arg to each() to test behaviour - */ - -echo "*** Testing each() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $arr argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of each() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( each($input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Iteration 1 -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 2 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 3 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 4 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 5 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 6 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 7 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 8 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 9 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 10 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 11 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 12 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 13 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 14 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 15 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 16 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 17 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 18 -- -bool(false) - --- Iteration 19 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 20 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 21 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 22 -- -bool(false) - --- Iteration 23 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 24 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 25 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/each_variation2.phpt b/ext/standard/tests/array/each_variation2.phpt deleted file mode 100644 index 34eeedc9a8..0000000000 --- a/ext/standard/tests/array/each_variation2.phpt +++ /dev/null @@ -1,249 +0,0 @@ ---TEST-- -Test each() function : usage variations - arrays of different data types ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass arrays of different data types as $arr argument to each() to test behaviour - */ - -echo "*** Testing each() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// arrays of different data types to be passed as $arr -$inputs = array( - - // int data -/*1*/ 'int' => array( - 0, - 1, - 12345, - -2345, - ), - - // float data -/*2*/ 'float' => array( - 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - ), - - // null data -/*3*/ 'null' => array( - NULL, - null, - ), - - // boolean data -/*4*/ 'bool' => array( - true, - false, - TRUE, - FALSE, - ), - - // empty data -/*5*/ 'empty string' => array( - "", - '', - ), - -/*6*/ 'empty array' => array( - ), - - // string data -/*7*/ 'string' => array( - "string", - 'string', - $heredoc, - ), - - // object data -/*8*/ 'object' => array( - new classA(), - ), - - // undefined data -/*9*/ 'undefined' => array( - @$undefined_var, - ), - - // unset data -/*10*/ 'unset' => array( - @$unset_var, - ), - - // resource variable -/*11*/ 'resource' => array( - $fp - ), -); - -// loop through each element of $inputs to check the behavior of each() -$iterator = 1; -foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator: $key data --\n"; - var_dump( each($input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Iteration 1: int data -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - int(0) - ["value"]=> - int(0) - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 2: float data -- -array(4) { - [1]=> - float(10.5) - ["value"]=> - float(10.5) - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 3: null data -- -array(4) { - [1]=> - NULL - ["value"]=> - NULL - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 4: bool data -- -array(4) { - [1]=> - bool(true) - ["value"]=> - bool(true) - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 5: empty string data -- -array(4) { - [1]=> - string(0) "" - ["value"]=> - string(0) "" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 6: empty array data -- -bool(false) - --- Iteration 7: string data -- -array(4) { - [1]=> - string(6) "string" - ["value"]=> - string(6) "string" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 8: object data -- -array(4) { - [1]=> - object(classA)#%d (0) { - } - ["value"]=> - object(classA)#%d (0) { - } - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 9: undefined data -- -array(4) { - [1]=> - NULL - ["value"]=> - NULL - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 10: unset data -- -array(4) { - [1]=> - NULL - ["value"]=> - NULL - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 11: resource data -- -array(4) { - [1]=> - resource(%d) of type (stream) - ["value"]=> - resource(%d) of type (stream) - [0]=> - int(0) - ["key"]=> - int(0) -} -Done diff --git a/ext/standard/tests/array/each_variation3.phpt b/ext/standard/tests/array/each_variation3.phpt deleted file mode 100644 index 32342d6d78..0000000000 --- a/ext/standard/tests/array/each_variation3.phpt +++ /dev/null @@ -1,254 +0,0 @@ ---TEST-- -Test each() function : usage variations - keys of different data types ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass each() arrays where the keys are different data types to test behaviour - */ - -echo "*** Testing each() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// unexpected values to be passed as $arr -$inputs = array( - - // int data -/*1*/ 'int' => array( - 0 => 'zero', - 1 => 'one', - 12345 => 'positive', - -2345 => 'negative', - ), - - // float data -/*2*/ 'float' => array( - 10.5 => 'positive', - -10.5 => 'negative', - .5 => 'half', - ), - -/*3*/ 'extreme floats' => array( - 12.3456789000e6 => 'large', - 12.3456789000E-10 => 'small', - ), - - // null data -/*4*/ 'null uppercase' => array( - NULL => 'null 1', - ), - -/*5*/ 'null lowercase' => array( - null => 'null 2', - ), - - // boolean data -/*6*/ 'bool lowercase' => array( - true => 'lowert', - false => 'lowerf', - ), - -/*7*/ 'bool uppercase' => array( - TRUE => 'uppert', - FALSE => 'upperf', - ), - - // empty data -/*8*/ 'empty double quotes' => array( - "" => 'emptyd', - ), - -/*9*/ 'empty single quotes' => array( - '' => 'emptys', - ), - - // string data -/*10*/ 'string' => array( - "stringd" => 'stringd', - 'strings' => 'strings', - $heredoc => 'stringh', - ), - - // undefined data -/*11*/ 'undefined' => array( - @$undefined_var => 'undefined', - ), - - // unset data -/*12*/ 'unset' => array( - @$unset_var => 'unset', - ), -); - -// loop through each element of $inputs to check the behavior of each() -$iterator = 1; -foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator: $key data --\n"; - var_dump( each($input) ); - $iterator++; -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Iteration 1: int data -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 2: float data -- -array(4) { - [1]=> - string(8) "positive" - ["value"]=> - string(8) "positive" - [0]=> - int(10) - ["key"]=> - int(10) -} - --- Iteration 3: extreme floats data -- -array(4) { - [1]=> - string(5) "large" - ["value"]=> - string(5) "large" - [0]=> - int(12345678) - ["key"]=> - int(12345678) -} - --- Iteration 4: null uppercase data -- -array(4) { - [1]=> - string(6) "null 1" - ["value"]=> - string(6) "null 1" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 5: null lowercase data -- -array(4) { - [1]=> - string(6) "null 2" - ["value"]=> - string(6) "null 2" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 6: bool lowercase data -- -array(4) { - [1]=> - string(6) "lowert" - ["value"]=> - string(6) "lowert" - [0]=> - int(1) - ["key"]=> - int(1) -} - --- Iteration 7: bool uppercase data -- -array(4) { - [1]=> - string(6) "uppert" - ["value"]=> - string(6) "uppert" - [0]=> - int(1) - ["key"]=> - int(1) -} - --- Iteration 8: empty double quotes data -- -array(4) { - [1]=> - string(6) "emptyd" - ["value"]=> - string(6) "emptyd" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 9: empty single quotes data -- -array(4) { - [1]=> - string(6) "emptys" - ["value"]=> - string(6) "emptys" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 10: string data -- -array(4) { - [1]=> - string(7) "stringd" - ["value"]=> - string(7) "stringd" - [0]=> - string(7) "stringd" - ["key"]=> - string(7) "stringd" -} - --- Iteration 11: undefined data -- -array(4) { - [1]=> - string(9) "undefined" - ["value"]=> - string(9) "undefined" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 12: unset data -- -array(4) { - [1]=> - string(5) "unset" - ["value"]=> - string(5) "unset" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} -Done diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt deleted file mode 100644 index 64fbb4a8d0..0000000000 --- a/ext/standard/tests/array/each_variation4.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -Test each() function : usage variations - Referenced variables ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test behaviour of each() when: - * 1. Passed an array made up of referenced variables - * 2. Passed an array as $arr argument by reference - */ - -echo "*** Testing each() : usage variations ***\n"; - -echo "\n-- Array made up of referenced variables: --\n"; -$val1 = 'foo'; -$val2 = 'bar'; - -$arr1 = array('one' => &$val1, &$val2); - -echo "-- Call each until at the end of the array: --\n"; -var_dump( each($arr1) ); -var_dump( each($arr1) ); -var_dump( each($arr1) ); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Array made up of referenced variables: -- --- Call each until at the end of the array: -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(3) "foo" - ["value"]=> - string(3) "foo" - [0]=> - string(3) "one" - ["key"]=> - string(3) "one" -} -array(4) { - [1]=> - string(3) "bar" - ["value"]=> - string(3) "bar" - [0]=> - int(0) - ["key"]=> - int(0) -} -bool(false) -Done diff --git a/ext/standard/tests/array/each_variation5.phpt b/ext/standard/tests/array/each_variation5.phpt deleted file mode 100644 index 441882f962..0000000000 --- a/ext/standard/tests/array/each_variation5.phpt +++ /dev/null @@ -1,97 +0,0 @@ ---TEST-- -Test each() function : usage variations - Multi-dimensional arrays ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test behaviour of each() when passed: - * 1. a two-dimensional array - * 2. a sub-array - */ - -echo "*** Testing each() : usage variations ***\n"; - -$arr = array ('zero', - array(1, 2, 3), - 'one' => 'un', - array('a', 'b', 'c') - ); - -echo "\n-- Pass each() a two-dimensional array --\n"; -for ($i = 1; $i < count($arr); $i++) { - var_dump( each($arr) ); -} - -echo "\n-- Pass each() a sub-array --\n"; -var_dump( each($arr[2])); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Pass each() a two-dimensional array -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} -array(4) { - [1]=> - array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - } - ["value"]=> - array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - } - [0]=> - int(1) - ["key"]=> - int(1) -} -array(4) { - [1]=> - string(2) "un" - ["value"]=> - string(2) "un" - [0]=> - string(3) "one" - ["key"]=> - string(3) "one" -} - --- Pass each() a sub-array -- -array(4) { - [1]=> - string(1) "a" - ["value"]=> - string(1) "a" - [0]=> - int(0) - ["key"]=> - int(0) -} -Done diff --git a/ext/standard/tests/array/each_variation6.phpt b/ext/standard/tests/array/each_variation6.phpt deleted file mode 100644 index de52ba5965..0000000000 --- a/ext/standard/tests/array/each_variation6.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -Test each() function : usage variations - Internal array pointer ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test the position of the internal array pointer after a call to each() - */ - -echo "*** Testing each() : usage variations ***\n"; - -$arr = array('zero', 'one', 'two', 'abc', 'xyz'); - -echo "\n-- Current position: --\n"; -echo key($arr) . " => " . current($arr) . "\n"; - -echo "\n-- Call to each(): --\n"; -var_dump( each($arr) ); - -echo "\n-- New position: --\n"; -echo key($arr) . " => " . current($arr) . "\n"; - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Current position: -- -0 => zero - --- Call to each(): -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- New position: -- -1 => one -Done diff --git a/ext/standard/tests/array/end.phpt b/ext/standard/tests/array/end.phpt index 724f2e612f..a7474a7e73 100644 --- a/ext/standard/tests/array/end.phpt +++ b/ext/standard/tests/array/end.phpt @@ -106,21 +106,6 @@ $resources = array($file_handle, $dir_handle); var_dump( end($resources) ); var_dump( current($resources) ); -echo "\n*** Testing error conditions ***\n"; -/* checking for unexpected number of arguments */ -var_dump( end() ); -var_dump( end($array[0], $array[0]) ); - -/* checking for unexpected type of arguments */ -$var=1; -$var1="string"; -var_dump( end($var) ); -var_dump( end($var1) ); - -/* checking null array */ -$null_array = array(); -var_dump( end($null_array) ); - echo "Done\n"; @@ -219,19 +204,4 @@ array(2) { *** Testing end() on resource type *** resource(%d) of type (stream) resource(%d) of type (stream) - -*** Testing error conditions *** - -Warning: end() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: end() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, string given in %s on line %d -NULL -bool(false) Done diff --git a/ext/standard/tests/array/end_64bit.phpt b/ext/standard/tests/array/end_64bit.phpt index 0049041848..ba20693d0f 100644 --- a/ext/standard/tests/array/end_64bit.phpt +++ b/ext/standard/tests/array/end_64bit.phpt @@ -106,21 +106,6 @@ $resources = array($file_handle, $dir_handle); var_dump( end($resources) ); var_dump( current($resources) ); -echo "\n*** Testing error conditions ***\n"; -/* checking for unexpected number of arguments */ -var_dump( end() ); -var_dump( end($array[0], $array[0]) ); - -/* checking for unexpected type of arguments */ -$var=1; -$var1="string"; -var_dump( end($var) ); -var_dump( end($var1) ); - -/* checking null array */ -$null_array = array(); -var_dump( end($null_array) ); - echo "Done\n"; ?> @@ -218,19 +203,4 @@ array(2) { *** Testing end() on resource type *** resource(%d) of type (stream) resource(%d) of type (stream) - -*** Testing error conditions *** - -Warning: end() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: end() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, string given in %s on line %d -NULL -bool(false) Done diff --git a/ext/standard/tests/array/extract_error.phpt b/ext/standard/tests/array/extract_error.phpt index e8bcf8f5d8..2103a1b9a4 100644 --- a/ext/standard/tests/array/extract_error.phpt +++ b/ext/standard/tests/array/extract_error.phpt @@ -6,53 +6,35 @@ Test extract() function (error conditions) /* Testing Error Conditions */ echo "*** Testing Error Conditions ***\n"; -/* Zero Arguments */ -var_dump( extract() ); - /* Invalid second argument ( only 0-6 is valid) */ $arr = array(1); -var_dump( extract($arr, -1 . "wddr") ); -var_dump( extract($arr, 7 , "wddr") ); - -/* scalar argument */ -$val = 1; -var_dump( extract($val) ); -/* string argument */ -$str = "test"; -var_dump( extract($str) ); +try { + var_dump( extract($arr, -1 . "wddr") ); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} -/* More than valid number of arguments i.e. 3 args */ -var_dump( extract($arr, EXTR_SKIP, "aa", "ee") ); +try { + var_dump( extract($arr, 7 , "wddr") ); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} /* Two Arguments, second as prefix but without prefix string as third argument */ -var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) ); +try { + var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) ); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} echo "Done\n"; ?> --EXPECTF-- *** Testing Error Conditions *** -Warning: extract() expects at least 1 parameter, 0 given in %s on line %d -NULL - Notice: A non well formed numeric value encountered in %s on line %d - -Warning: extract(): Invalid extract type in %s on line %d -NULL - -Warning: extract(): Invalid extract type in %s on line %d -NULL - -Warning: extract() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: extract() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: extract() expects at most 3 parameters, 4 given in %s on line %d -NULL - -Warning: extract(): specified extract type requires the prefix parameter in %s on line %d -NULL +Invalid extract type +Invalid extract type +Specified extract type requires the prefix parameter Done diff --git a/ext/standard/tests/array/extract_error_variation1.phpt b/ext/standard/tests/array/extract_error_variation1.phpt new file mode 100644 index 0000000000..ec3078a0b9 --- /dev/null +++ b/ext/standard/tests/array/extract_error_variation1.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test extract() function - error condition - Invalid prefix. +--FILE-- +<?php +$a = ["1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five"]; + +try { + extract($a, EXTR_PREFIX_ALL, '85bogus'); +} catch (\Error $e) { + echo $e->getMessage(); +} +?> +--EXPECT-- +Prefix is not a valid identifier diff --git a/ext/standard/tests/array/in_array_variation3.phpt b/ext/standard/tests/array/in_array_variation3.phpt index f07d1dea89..0b58990041 100644 --- a/ext/standard/tests/array/in_array_variation3.phpt +++ b/ext/standard/tests/array/in_array_variation3.phpt @@ -36,9 +36,17 @@ class in_array_check { $in_array_obj = new in_array_check(); //creating new object //error: as wrong datatype for second argument -var_dump( in_array("array_var", $in_array_obj) ); +try { + var_dump( in_array("array_var", $in_array_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //error: as wrong datatype for second argument -var_dump( in_array("foo", $in_array_obj) ); +try { + var_dump( in_array("foo", $in_array_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //element found as "one" exists in array $array_var var_dump( in_array("one", $in_array_obj->array_var) ); @@ -51,11 +59,7 @@ bool(true) bool(true) *** Testing objects with in_array() *** - -Warning: in_array() expects parameter 2 to be array, object given in %s on line %d -NULL - -Warning: in_array() expects parameter 2 to be array, object given in %s on line %d -NULL +in_array() expects parameter 2 to be array, object given +in_array() expects parameter 2 to be array, object given bool(true) Done diff --git a/ext/standard/tests/array/max.phpt b/ext/standard/tests/array/max.phpt index ae4f304eae..9e6448cd52 100644 --- a/ext/standard/tests/array/max.phpt +++ b/ext/standard/tests/array/max.phpt @@ -5,10 +5,24 @@ precision=14 --FILE-- <?php -var_dump(max()); -var_dump(max(1)); -var_dump(max(array())); -var_dump(max(new stdclass)); +try { + var_dump(max(1)); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(max(array())); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(max(new stdclass)); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} + var_dump(max(2,1,2)); var_dump(max(2.1,2.11,2.09)); var_dump(max("", "t", "b")); @@ -19,18 +33,10 @@ var_dump(max(0, true, false, true)); echo "Done\n"; ?> ---EXPECTF-- -Warning: max() expects at least 1 parameter, 0 given in %s on line 3 -NULL - -Warning: max(): When only one parameter is given, it must be an array in %s on line 4 -NULL - -Warning: max(): Array must contain at least one element in %s on line 5 -bool(false) - -Warning: max(): When only one parameter is given, it must be an array in %s on line 6 -NULL +--EXPECT-- +When only one parameter is given, it must be an array +Array must contain at least one element +When only one parameter is given, it must be an array int(2) float(2.11) string(1) "t" diff --git a/ext/standard/tests/array/min.phpt b/ext/standard/tests/array/min.phpt index cb8c7cfdca..85defa6e85 100644 --- a/ext/standard/tests/array/min.phpt +++ b/ext/standard/tests/array/min.phpt @@ -5,10 +5,24 @@ precision=14 --FILE-- <?php -var_dump(min()); -var_dump(min(1)); -var_dump(min(array())); -var_dump(min(new stdclass)); +try { + var_dump(min(1)); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(min(array())); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(min(new stdclass)); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} + var_dump(min(2,1,2)); var_dump(min(2.1,2.11,2.09)); var_dump(min("", "t", "b")); @@ -19,18 +33,10 @@ var_dump(min(0, true, false, true)); echo "Done\n"; ?> ---EXPECTF-- -Warning: min() expects at least 1 parameter, 0 given in %s on line 3 -NULL - -Warning: min(): When only one parameter is given, it must be an array in %s on line 4 -NULL - -Warning: min(): Array must contain at least one element in %s on line 5 -bool(false) - -Warning: min(): When only one parameter is given, it must be an array in %s on line 6 -NULL +--EXPECT-- +When only one parameter is given, it must be an array +Array must contain at least one element +When only one parameter is given, it must be an array int(1) float(2.09) string(0) "" diff --git a/ext/standard/tests/array/negative_index.phpt b/ext/standard/tests/array/negative_index.phpt new file mode 100644 index 0000000000..a9f442acbd --- /dev/null +++ b/ext/standard/tests/array/negative_index.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test arrays starting with negative indices +--FILE-- +<?php + +$a = array_fill(-2, 3, true); +$b = [-2 => true, true, true]; +$c = ["string" => true, -2 => true, true, true]; +unset($c["string"]); +$d[-2] = true; +$d[] = true; +$d[] = true; +$e = [-2 => false]; +array_pop($e); +$e[] = true; +$e[] = true; +$e[] = true; + +var_dump($a === $b && $b === $c && $c === $d && $d == $e); +var_dump($a); +?> +--EXPECT-- +bool(true) +array(3) { + [-2]=> + bool(true) + [-1]=> + bool(true) + [0]=> + bool(true) +} diff --git a/ext/standard/tests/array/range_bug70239_0.phpt b/ext/standard/tests/array/range_bug70239_0.phpt index edfdd05fbc..c902a168b2 100644 --- a/ext/standard/tests/array/range_bug70239_0.phpt +++ b/ext/standard/tests/array/range_bug70239_0.phpt @@ -2,9 +2,13 @@ Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 1 --FILE-- <?php -range(0, pow(2.0, 100000000)); +try { + range(0, pow(2.0, 100000000)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} ?> ===DONE=== ---EXPECTF-- -Warning: range(): Invalid range supplied: start=0 end=inf in %srange_bug70239_0.php on line %d +--EXPECT-- +Invalid range supplied: start=0 end=inf ===DONE=== diff --git a/ext/standard/tests/array/range_bug70239_1.phpt b/ext/standard/tests/array/range_bug70239_1.phpt index 75419cf829..6d12348f67 100644 --- a/ext/standard/tests/array/range_bug70239_1.phpt +++ b/ext/standard/tests/array/range_bug70239_1.phpt @@ -2,9 +2,13 @@ Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 2 --FILE-- <?php -range(pow(2.0, 100000000), pow(2.0, 100000000) + 1); +try { + range(pow(2.0, 100000000), pow(2.0, 100000000) + 1); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} ?> ===DONE=== ---EXPECTF-- -Warning: range(): Invalid range supplied: start=inf end=inf in %srange_bug70239_1.php on line %d +--EXPECT-- +Invalid range supplied: start=inf end=inf ===DONE=== diff --git a/ext/standard/tests/array/range_bug70239_2.phpt b/ext/standard/tests/array/range_bug70239_2.phpt index 76ed638669..c9396b3cb4 100644 --- a/ext/standard/tests/array/range_bug70239_2.phpt +++ b/ext/standard/tests/array/range_bug70239_2.phpt @@ -2,10 +2,13 @@ Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 3 --FILE-- <?php -var_dump(range(0, PHP_INT_MAX)); +try { + var_dump(range(0, PHP_INT_MAX)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} ?> ===DONE=== --EXPECTF-- -Warning: range(): The supplied range exceeds the maximum array size: start=0 end=%d in %srange_bug70239_2.php on line %d -bool(false) +The supplied range exceeds the maximum array size: start=0 end=%d ===DONE=== diff --git a/ext/standard/tests/array/range_bug70239_3.phpt b/ext/standard/tests/array/range_bug70239_3.phpt index 8402870c82..e49267bfe3 100644 --- a/ext/standard/tests/array/range_bug70239_3.phpt +++ b/ext/standard/tests/array/range_bug70239_3.phpt @@ -2,10 +2,13 @@ Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 4 --FILE-- <?php -var_dump(range(PHP_INT_MIN, 0)); +try { + var_dump(range(PHP_INT_MIN, 0)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} ?> ===DONE=== --EXPECTF-- -Warning: range(): The supplied range exceeds the maximum array size: start=-%d end=0 in %srange_bug70239_3.php on line %d -bool(false) +The supplied range exceeds the maximum array size: start=-%d end=0 ===DONE=== diff --git a/ext/standard/tests/array/range_errors.phpt b/ext/standard/tests/array/range_errors.phpt index b63e9874bf..971eade4be 100644 --- a/ext/standard/tests/array/range_errors.phpt +++ b/ext/standard/tests/array/range_errors.phpt @@ -7,34 +7,84 @@ precision=14 echo "\n*** Testing error conditions ***\n"; -echo "\n-- Testing ( (low < high) && (step = 0) ) --"; -var_dump( range(1, 2, 0) ); -var_dump( range("a", "b", 0) ); - -echo "\n\n-- Testing ( (low > high) && (step = 0) ) --"; -var_dump( range(2, 1, 0) ); -var_dump( range("b", "a", 0) ); - -echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --"; -var_dump( range(1.0, 7.0, 6.5) ); - -echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --"; -var_dump( range(7.0, 1.0, 6.5) ); - -echo "\n-- Testing Invalid number of arguments --"; -var_dump( range() ); // No.of args = 0 -var_dump( range(1) ); // No.of args < expected -var_dump( range(1,2,3,4) ); // No.of args > expected -var_dump( range(-1, -2, 2) ); -var_dump( range("a", "j", "z") ); -var_dump( range(0, 1, "140962482048819216326.24") ); -var_dump( range(0, 1, "140962482048819216326.24.") ); - -echo "\n-- Testing Invalid steps --"; +echo "\n-- Testing ( (low < high) && (step = 0) ) --\n"; +try { + var_dump( range(1, 2, 0) ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +try { + var_dump( range("a", "b", 0) ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +echo "\n\n-- Testing ( (low > high) && (step = 0) ) --\n"; +try { + var_dump( range(2, 1, 0) ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +try { + var_dump( range("b", "a", 0) ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --\n"; +try { + var_dump( range(1.0, 7.0, 6.5) ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --\n"; +try { + var_dump( range(7.0, 1.0, 6.5) ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +echo "\n-- Testing other conditions --\n"; +try { + var_dump( range(-1, -2, 2) ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +try { + var_dump( range("a", "j", "z") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +try { + var_dump( range(0, 1, "140962482048819216326.24") ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +try { + var_dump( range(0, 1, "140962482048819216326.24.") ); +} catch (\Error $e) { + echo $e->getMessage(), "\n"; +} + +echo "\n-- Testing Invalid steps --\n"; $step_arr = array( "string", NULL, FALSE, "", "\0" ); foreach( $step_arr as $step ) { - var_dump( range( 1, 5, $step ) ); + try { + var_dump( range( 1, 5, $step ) ); + } catch (\TypeError $e) { + echo $e->getMessage(), "\n"; + } catch (\Error $e) { + echo $e->getMessage(), "\n"; + } } echo "Done\n"; @@ -43,65 +93,34 @@ echo "Done\n"; *** Testing error conditions *** -- Testing ( (low < high) && (step = 0) ) -- -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) - -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) +step exceeds the specified range +step exceeds the specified range -- Testing ( (low > high) && (step = 0) ) -- -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) - -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) +step exceeds the specified range +step exceeds the specified range -- Testing ( (low < high) && (high-low < step) ) -- -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) +step exceeds the specified range -- Testing ( (low > high) && (low-high < step) ) -- -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) - --- Testing Invalid number of arguments -- -Warning: range() expects at least 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: range() expects at least 2 parameters, 1 given in %s on line %d -bool(false) +step exceeds the specified range -Warning: range() expects at most 3 parameters, 4 given in %s on line %d -bool(false) +-- Testing other conditions -- +step exceeds the specified range +range() expects parameter 3 to be int or float, string given +step exceeds the specified range -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) - -Warning: range(): Invalid range string - must be numeric in %s on line %d -bool(false) - -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) - -Warning: range(): Invalid range string - must be numeric in %s on line %d -bool(false) +Notice: A non well formed numeric value encountered in %s on line %d +step exceeds the specified range -- Testing Invalid steps -- -Warning: range(): Invalid range string - must be numeric in %s on line %d -bool(false) - -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) - -Warning: range(): step exceeds the specified range in %s on line %d -bool(false) - -Warning: range(): Invalid range string - must be numeric in %s on line %d -bool(false) - -Warning: range(): Invalid range string - must be numeric in %s on line %d -bool(false) +range() expects parameter 3 to be int or float, string given +step exceeds the specified range +step exceeds the specified range +range() expects parameter 3 to be int or float, string given +range() expects parameter 3 to be int or float, string given Done diff --git a/ext/standard/tests/array/range_variation.phpt b/ext/standard/tests/array/range_variation.phpt index f7fc9e0815..3de5f6188f 100644 --- a/ext/standard/tests/array/range_variation.phpt +++ b/ext/standard/tests/array/range_variation.phpt @@ -18,7 +18,11 @@ for( $i = 0; $i < count($low_arr); $i++) { echo "\n*** Possible variatins with steps ***\n"; var_dump( range( 1, 5, TRUE ) ); -var_dump( range( 1, 5, array(1, 2) ) ); +try { + var_dump( range( 1, 5, array(1, 2) ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -611,16 +615,5 @@ array(5) { [4]=> int(5) } -array(5) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - [3]=> - int(4) - [4]=> - int(5) -} +range() expects parameter 3 to be int or float, array given Done diff --git a/ext/standard/tests/array/uasort_variation8.phpt b/ext/standard/tests/array/uasort_variation8.phpt index 2bb2b46512..d27cd569c0 100644 --- a/ext/standard/tests/array/uasort_variation8.phpt +++ b/ext/standard/tests/array/uasort_variation8.phpt @@ -10,7 +10,6 @@ Test uasort() function : usage variations - built-in function as 'cmp_function' /* * Passing different built-in library functions in place of 'cmp_function' * valid comparison functions: strcmp() & strcasecmp() -* language constructs: echo & exit */ echo "*** Testing uasort() : built in function as 'cmp_function' ***\n"; @@ -28,13 +27,6 @@ echo "-- Testing uasort() with built-in 'cmp_function': strcmp() --\n"; var_dump( uasort($array_arg, 'strcmp') ); // expecting: bool(true) var_dump($array_arg); -// Testing with language construct as comparison function -echo "-- Testing uasort() with language construct as 'cmp_function' --\n"; -var_dump( uasort($languageConstruct_fun_arg, 'echo') ); // expecting: bool(false) - -echo "-- Testing uasort() with language construct as 'cmp_function' --\n"; -var_dump( uasort($languageConstruct_fun_arg, 'exit') ); // expecting: bool(false) - echo "Done" ?> --EXPECTF-- @@ -67,12 +59,4 @@ array(5) { ["o"]=> string(6) "orange" } --- Testing uasort() with language construct as 'cmp_function' -- - -Warning: uasort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL --- Testing uasort() with language construct as 'cmp_function' -- - -Warning: uasort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL Done diff --git a/ext/standard/tests/array/usort_variation8.phpt b/ext/standard/tests/array/usort_variation8.phpt index 3296c4a36a..98c303e083 100644 --- a/ext/standard/tests/array/usort_variation8.phpt +++ b/ext/standard/tests/array/usort_variation8.phpt @@ -30,14 +30,6 @@ $temp_array2 = $array_arg; var_dump( usort($temp_array2, 'strcmp') ); var_dump($temp_array2); -// Testing with language construct as comparison function -echo "\n-- Testing usort() with language construct as 'cmp_function' --\n"; -$temp_array3 = $array_arg; -var_dump( usort($temp_array3, 'echo') ); - -echo "\n-- Testing usort() with language construct as 'cmp_function' --\n"; -$temp_array4 = $array_arg; -var_dump( usort($temp_array4, 'exit') ); ?> ===DONE=== --EXPECTF-- @@ -72,14 +64,4 @@ array(5) { [4]=> string(6) "orange" } - --- Testing usort() with language construct as 'cmp_function' -- - -Warning: usort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL - --- Testing usort() with language construct as 'cmp_function' -- - -Warning: usort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/assert/assert.phpt b/ext/standard/tests/assert/assert.phpt index 08e1188d60..71b0649141 100644 --- a/ext/standard/tests/assert/assert.phpt +++ b/ext/standard/tests/assert/assert.phpt @@ -1,44 +1,41 @@ --TEST-- assert() --INI-- -error_reporting = 2039 assert.active = 0 assert.warning = 1 assert.callback = assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php -function a($file,$line,$myev) +function a($file, $line, $unused, $desc) { - echo "assertion failed $line,\"$myev\"\n"; + echo "assertion failed $line,\"$desc\"\n"; } class a { - function assert($file,$line,$myev) + static function assert($file, $line, $unused, $desc) { - echo "class assertion failed $line,\"$myev\"\n"; + echo "class assertion failed $line,\"$desc\"\n"; } } assert_options(ASSERT_ACTIVE,1); -assert_options(ASSERT_QUIET_EVAL,1); assert_options(ASSERT_WARNING,0); $a = 0; assert_options(ASSERT_CALLBACK,"a"); -assert('$a != 0'); +assert($a != 0); assert_options(ASSERT_CALLBACK,array("a","assert")); -assert('$a != 0'); +assert($a != 0); $obj = new a(); assert_options(ASSERT_CALLBACK,array(&$obj,"assert")); -assert('$a != 0'); +assert($a != 0); ?> --EXPECT-- -assertion failed 22,"$a != 0" -class assertion failed 25,"$a != 0" -class assertion failed 29,"$a != 0" +assertion failed 21,"assert($a != 0)" +class assertion failed 24,"assert($a != 0)" +class assertion failed 28,"assert($a != 0)" diff --git a/ext/standard/tests/assert/assert02.phpt b/ext/standard/tests/assert/assert02.phpt deleted file mode 100644 index 85b72369cb..0000000000 --- a/ext/standard/tests/assert/assert02.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -catch assert() errors ---INI-- -assert.active=1 -assert.warning=1 -assert.callback= -assert.bail=0 -assert.quiet_eval=0 ---FILE-- -<?php - -assert(1); -assert('1'); -assert('$a'); - -try { - assert('aa=sd+as+safsafasfasafsaf'); -} catch (Throwable $e) { - echo $e->getMessage(), "\n"; -} - -assert('0'); - -assert_options(ASSERT_BAIL, 1); - -try { - assert('aa=sd+as+safsafasfasafsaf'); -} catch (Throwable $e) { - echo $e->getMessage(), "\n"; -} - -echo "done\n"; - -?> ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Notice: Undefined variable: a in %sassert02.php(%d) : assert code on line 1 - -Warning: assert(): Assertion "$a" failed in %sassert02.php on line %d - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -Failure evaluating code: -aa=sd+as+safsafasfasafsaf - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Warning: assert(): Assertion "0" failed in %sassert02.php on line %d - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Fatal error: Uncaught ParseError: syntax error, unexpected '=', expecting ';' in %s(%d) : assert code:1 -Stack trace: -#0 %s(%d): assert('aa=sd+as+safsaf...') -#1 {main} - -Next Error: Failure evaluating code: -aa=sd+as+safsafasfasafsaf in %s:%d -Stack trace: -#0 %s(%d): assert('aa=sd+as+safsaf...') -#1 {main} - thrown in %s on line %d diff --git a/ext/standard/tests/assert/assert03.phpt b/ext/standard/tests/assert/assert03.phpt index 80c42df473..3b231405f6 100644 --- a/ext/standard/tests/assert/assert03.phpt +++ b/ext/standard/tests/assert/assert03.phpt @@ -5,38 +5,33 @@ assert.active = 1 assert.warning = 0 assert.callback = assert.bail = 0 -assert.quiet_eval = 1 --FILE-- <?php -function a($file,$line,$myev) +function a($file, $line, $unused, $desc) { - echo "assertion failed - a - $line,\"$myev\"\n"; + echo "assertion failed - a - $line,\"$desc\"\n"; } -function b($file,$line,$myev) +function b($file, $line, $unused, $desc) { - echo "assertion failed - b - $line,\"$myev\"\n"; + echo "assertion failed - b - $line,\"$desc\"\n"; } assert_options(ASSERT_ACTIVE,1); -assert_options(ASSERT_QUIET_EVAL,1); assert_options(ASSERT_WARNING,0); $a = 0; -assert_options(ASSERT_CALLBACK,"a"); -assert('$a != 0'); +assert_options(ASSERT_CALLBACK, "a"); +assert($a != 0); /* Modify call back using ini_set() */ ini_set("assert.callback", "b"); -assert('$a != 0'); +assert($a != 0); ?> ==DONE== ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -assertion failed - a - %d,"$a != 0" - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -assertion failed - b - %d,"$a != 0" +--EXPECT-- +assertion failed - a - 18,"assert($a != 0)" +assertion failed - b - 22,"assert($a != 0)" ==DONE== diff --git a/ext/standard/tests/assert/assert04.phpt b/ext/standard/tests/assert/assert04.phpt index 0100229958..35f7668ce1 100644 --- a/ext/standard/tests/assert/assert04.phpt +++ b/ext/standard/tests/assert/assert04.phpt @@ -5,24 +5,14 @@ assert.active = 1 assert.warning = 1 assert.callback = assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php /* Assert not active */ assert_options(ASSERT_ACTIVE, 0); assert(1); - /* Wrong parameter count in assert */ assert_options(ASSERT_ACTIVE, 1); -assert(2, "failure", 3); - -/* Wrong parameter count in assert_options */ -assert_options(ASSERT_ACTIVE, 0, 2); - -/* Wrong parameter name in assert_options */ -$test="ASSERT_FRED"; -assert_options($test, 1); /* Assert false */ assert(0); @@ -36,12 +26,6 @@ echo "not reached\n"; ?> --EXPECTF-- -Warning: assert() expects at most 2 parameters, 3 given in %s on line %d - -Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d - -Warning: assert_options() expects parameter 1 to be int, string given in %s on line %d - Warning: assert(): assert(0) failed in %s on line %d Warning: assert(): assert(0) failed in %s on line %d diff --git a/ext/standard/tests/assert/assert_basic.phpt b/ext/standard/tests/assert/assert_basic.phpt index 73b3e73206..ce53a17a61 100644 --- a/ext/standard/tests/assert/assert_basic.phpt +++ b/ext/standard/tests/assert/assert_basic.phpt @@ -5,29 +5,16 @@ assert.active = 1 assert.warning = 0 assert.callback = f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php function f1() { echo "f1 called\n"; } -//String assert -$sa = "0 != 0"; -var_dump($r2=assert($sa)); -$sa = "0 == 0"; -var_dump($r2=assert($sa)); -//Non string assert -var_dump($r2=assert(0)); -var_dump($r2=assert(1)); ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -f1 called -bool(false) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -bool(true) +var_dump($r2 = assert(0)); +var_dump($r2 = assert(1)); +--EXPECT-- f1 called bool(false) bool(true) diff --git a/ext/standard/tests/assert/assert_basic1.phpt b/ext/standard/tests/assert/assert_basic1.phpt index a5bcda3316..cd4a5601ab 100644 --- a/ext/standard/tests/assert/assert_basic1.phpt +++ b/ext/standard/tests/assert/assert_basic1.phpt @@ -5,7 +5,6 @@ assert.active = 0 assert.warning = 0 assert.callback = f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php function f1() @@ -13,17 +12,9 @@ function f1() echo "f1 called\n"; } -//String assert -$sa = "0 != 0"; -var_dump($r2=assert($sa)); -$sa = "0 == 0"; -var_dump($r2=assert($sa)); - -//Non string assert var_dump($r2=assert(0)); var_dump($r2=assert(1)); +?> --EXPECT-- bool(true) bool(true) -bool(true) -bool(true) diff --git a/ext/standard/tests/assert/assert_basic2.phpt b/ext/standard/tests/assert/assert_basic2.phpt index d6c150d0d0..052e7d4e89 100644 --- a/ext/standard/tests/assert/assert_basic2.phpt +++ b/ext/standard/tests/assert/assert_basic2.phpt @@ -5,7 +5,6 @@ assert.active = 1 assert.warning = 1 assert.callback=f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php function f2() diff --git a/ext/standard/tests/assert/assert_basic3.phpt b/ext/standard/tests/assert/assert_basic3.phpt index a7fd990cbe..87103cbfbb 100644 --- a/ext/standard/tests/assert/assert_basic3.phpt +++ b/ext/standard/tests/assert/assert_basic3.phpt @@ -4,7 +4,6 @@ assert() - basic - Test that bailout works assert.active = 1 assert.warning = 1 assert.callback = f1 -assert.quiet_eval = 1 assert.bail = 0 --FILE-- <?php @@ -15,13 +14,10 @@ function f1() //bail out on error var_dump($rao=assert_options(ASSERT_BAIL, 1)); -$sa = "0 != 0"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo "If this is printed BAIL hasn't worked"; --EXPECTF-- int(0) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f1 called -Warning: assert(): assert($sa): "0 != 0" failed in %s on line 10 +Warning: assert(): assert(0 != 0) failed in %s on line %d diff --git a/ext/standard/tests/assert/assert_basic4.phpt b/ext/standard/tests/assert/assert_basic4.phpt index 4e78cf9ec1..289c51860e 100644 --- a/ext/standard/tests/assert/assert_basic4.phpt +++ b/ext/standard/tests/assert/assert_basic4.phpt @@ -4,7 +4,6 @@ assert() - basic - test initial values using ini.get and assert_options assert.active = 0 assert.warning = 0 assert.bail = 0 -assert.quiet_eval = 0 assert.callback = f1 --FILE-- <?php @@ -14,23 +13,19 @@ assert.callback = f1 echo "Initial values: assert_options(ASSERT_ACTIVE) => [".assert_options(ASSERT_ACTIVE)."]\n"; echo "Initial values: assert_options(ASSERT_WARNING) => [".assert_options(ASSERT_WARNING)."]\n"; echo "Initial values: assert_options(ASSERT_BAIL) => [".assert_options(ASSERT_BAIL)."]\n"; -echo "Initial values: assert_options(ASSERT_QUIET_EVAL) => [".assert_options(ASSERT_QUIET_EVAL)."]\n"; echo "Initial values: assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; //Using ini.get; echo "Initial values: ini.get(\"assert.active\") => [".ini_get("assert.active")."]\n"; echo "Initial values: ini.get(\"assert.warning\") => [".ini_get("assert.warning")."]\n"; echo "Initial values: ini.get(\"assert.bail\") => [".ini_get("assert.bail")."]\n"; -echo "Initial values: ini.get(\"assert.quiet_eval\") => [".ini_get("assert.quiet_eval")."]\n"; echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n"; --EXPECT-- Initial values: assert_options(ASSERT_ACTIVE) => [0] Initial values: assert_options(ASSERT_WARNING) => [0] Initial values: assert_options(ASSERT_BAIL) => [0] -Initial values: assert_options(ASSERT_QUIET_EVAL) => [0] Initial values: assert_options(ASSERT_CALLBACK) => [f1] Initial values: ini.get("assert.active") => [0] Initial values: ini.get("assert.warning") => [0] Initial values: ini.get("assert.bail") => [0] -Initial values: ini.get("assert.quiet_eval") => [0] Initial values: ini.get("assert.callback") => [f1] diff --git a/ext/standard/tests/assert/assert_basic5.phpt b/ext/standard/tests/assert/assert_basic5.phpt index f4943cdf16..cf2ed6ded3 100644 --- a/ext/standard/tests/assert/assert_basic5.phpt +++ b/ext/standard/tests/assert/assert_basic5.phpt @@ -5,7 +5,6 @@ assert.active = 1 assert.warning = 0 assert.callback = f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php function f1() @@ -15,22 +14,16 @@ function f1() //switch warning on and test return value var_dump($rao=assert_options(ASSERT_WARNING, 1)); -$sa = "0 != 0"; -var_dump($r2=assert($sa)); -$sa = "0 == 0"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); +var_dump($r2=assert(0 == 0)); //switch warning on and test return value var_dump($rao=assert_options(ASSERT_WARNING, 0)); --EXPECTF-- int(0) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f1 called -Warning: assert(): assert($sa): "0 != 0" failed in %s on line 10 +Warning: assert(): assert(0 != 0) failed in %s on line %d bool(false) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d bool(true) int(1) diff --git a/ext/standard/tests/assert/assert_basic6.phpt b/ext/standard/tests/assert/assert_basic6.phpt deleted file mode 100644 index 216c85c94b..0000000000 --- a/ext/standard/tests/assert/assert_basic6.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -assert() - basic - Test that bailout works ---INI-- -assert.active = 1 -assert.warning = 1 -assert.callback = f1 -assert.quiet_eval = 1 -assert.bail = 0 ---FILE-- -<?php -function f1($message) -{ - echo "f1 called\n"; -} - -//bail out on error -var_dump($rao = assert_options(ASSERT_BAIL, 1)); -$sa = "0 != 0"; -var_dump($r2 = assert($sa, "0 is 0")); -echo "If this is printed BAIL hasn't worked"; ---EXPECTF-- -int(0) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -f1 called - -Warning: assert(): 0 is 0: "0 != 0" failed in %s on line 10 diff --git a/ext/standard/tests/assert/assert_closures.phpt b/ext/standard/tests/assert/assert_closures.phpt index 4a013283a8..13a7e5415e 100644 --- a/ext/standard/tests/assert/assert_closures.phpt +++ b/ext/standard/tests/assert/assert_closures.phpt @@ -4,7 +4,6 @@ assert() - basic - accept closures as callback. assert.active = 1 assert.warning = 1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php assert_options(ASSERT_CALLBACK, function () { echo "Hello World!\n"; }); diff --git a/ext/standard/tests/assert/assert_error.phpt b/ext/standard/tests/assert/assert_error.phpt deleted file mode 100644 index 6e04060765..0000000000 --- a/ext/standard/tests/assert/assert_error.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -assert() - error - give assert nonsense string with quiet_eval on then off ---INI-- -assert.active = 1 -assert.warning = 1 -assert.callback = f1 -assert.bail = 0 -assert.quiet_eval = 0 ---FILE-- -<?php -function f1() -{ - echo "f1 called\n"; -} - -$sa = "threemeninaboat"; - -var_dump($r2=assert($sa)); - -var_dump($ra0 = assert_options(ASSERT_QUIET_EVAL, 1)); - -var_dump($r2=assert($sa)); ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Warning: Use of undefined constant threemeninaboat - assumed 'threemeninaboat' (this will throw an Error in a future version of PHP) in %s(9) : assert code on line 1 -bool(true) -int(0) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -bool(true) diff --git a/ext/standard/tests/assert/assert_error2.phpt b/ext/standard/tests/assert/assert_error2.phpt index d1b6f1745f..de00743b1b 100644 --- a/ext/standard/tests/assert/assert_error2.phpt +++ b/ext/standard/tests/assert/assert_error2.phpt @@ -4,7 +4,6 @@ assert() - basic - Test that bailout works assert.active = 1 assert.warning = 1 assert.callback = f1 -assert.quiet_eval = 1 assert.bail = 0 error_reporting = -1 display_errors = 1 @@ -17,18 +16,10 @@ function f1($script, $line, $message, $user_message) //bail out on error var_dump($rao = assert_options(ASSERT_BAIL, 1)); -var_dump($r2 = assert("0 != 0")); +var_dump($r2 = assert(0 != 0)); echo "If this is printed BAIL hasn't worked"; --EXPECTF-- int(0) +f1 called -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Warning: assert(): Assertion "0 != 0" failed in %s on line 9 - -Fatal error: Uncaught ArgumentCountError: Too few arguments to function f1(), 3 passed and exactly 4 expected in %sassert_error2.php:2 -Stack trace: -#0 [internal function]: f1('%s', 9, '0 != 0') -#1 %sassert_error2.php(9): assert('0 != 0') -#2 {main} - thrown in %sassert_error2.php on line 2 +Warning: assert(): assert(0 != 0) failed in %s on line %d diff --git a/ext/standard/tests/assert/assert_error3.phpt b/ext/standard/tests/assert/assert_error3.phpt deleted file mode 100644 index 24538f4b04..0000000000 --- a/ext/standard/tests/assert/assert_error3.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -assert() - basic - Test recoverable error ---INI-- -assert.active = 1 -assert.warning = 1 -assert.callback = f1 -assert.quiet_eval = 0 -assert.bail = 0 -error_reporting = -1 -display_errors = 1 ---FILE-- -<?php -var_dump($r2 = assert("0 $ 0")); ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Fatal error: Uncaught ParseError: syntax error, unexpected '$', expecting ';' in %s(%d) : assert code:1 -Stack trace: -#0 %s(%d): assert('0 $ 0') -#1 {main} - -Next Error: Failure evaluating code: -0 $ 0 in %s:%d -Stack trace: -#0 %s(%d): assert('0 $ 0') -#1 {main} - thrown in %s on line %d diff --git a/ext/standard/tests/assert/assert_error4.phpt b/ext/standard/tests/assert/assert_error4.phpt deleted file mode 100644 index 59b4df6935..0000000000 --- a/ext/standard/tests/assert/assert_error4.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -assert() - basic - Test recoverable error ---INI-- -assert.active = 1 -assert.warning = 1 -assert.callback = f1 -assert.quiet_eval = 0 -assert.bail = 0 -error_reporting = -1 -display_errors = 1 ---FILE-- -<?php -$sa = "0 $ 0"; -var_dump($r2 = assert($sa, "Describing what was asserted")); ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Fatal error: Uncaught ParseError: syntax error, unexpected '$', expecting ';' in %s(%d) : assert code:1 -Stack trace: -#0 %s(%d): assert('0 $ 0', 'Describing what...') -#1 {main} - -Next Error: Failure evaluating code: -Describing what was asserted:"0 $ 0" in %s:%d -Stack trace: -#0 %s(%d): assert('0 $ 0', 'Describing what...') -#1 {main} - thrown in %s on line %d diff --git a/ext/standard/tests/assert/assert_options_error.phpt b/ext/standard/tests/assert/assert_options_error.phpt new file mode 100644 index 0000000000..0b50370b6c --- /dev/null +++ b/ext/standard/tests/assert/assert_options_error.phpt @@ -0,0 +1,13 @@ +--TEST-- +assert_options() - unknown assert option. + +--FILE-- +<?php +try { + assert_options(1000); +} catch (\Error $e) { + echo $e->getMessage(); +} +?> +--EXPECT-- +Unknown value 1000
\ No newline at end of file diff --git a/ext/standard/tests/assert/assert_variation.phpt b/ext/standard/tests/assert/assert_variation.phpt index 023f6690c5..d0cb90ff66 100644 --- a/ext/standard/tests/assert/assert_variation.phpt +++ b/ext/standard/tests/assert/assert_variation.phpt @@ -5,7 +5,6 @@ assert.active = 1 assert.warning = 0 assert.callback = f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php function f1() @@ -22,29 +21,28 @@ function f3() } class c1 { - function assert($file, $line, $myev) + static function assert($file, $line, $unused, $desc) { - echo "Class assertion failed $line, \"$myev\"\n"; + echo "Class assertion failed $line, \"$desc\"\n"; } } echo "Initial values: assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -$sa = "0 != 0"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Change callback function using ini.set and test return value \n"; var_dump($rv = ini_set("assert.callback","f2")); echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Change callback function using assert_options and test return value \n"; var_dump($rv=assert_options(ASSERT_CALLBACK, "f3")); echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; @@ -52,14 +50,14 @@ echo "Reset the name of the callback routine to a class method and check that it var_dump($rc=assert_options(ASSERT_CALLBACK, "c1")); echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Reset callback options to use a class method \n"; var_dump($rc = assert_options(ASSERT_CALLBACK,array("c1","assert"))); var_dump($rao=assert_options(ASSERT_CALLBACK)); echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Reset callback options to use an object method \n"; @@ -67,13 +65,11 @@ $o = new c1(); var_dump($rc=assert_options(ASSERT_CALLBACK,array(&$o,"assert"))); var_dump($rao=assert_options(ASSERT_CALLBACK)); echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; --EXPECTF-- Initial values: assert_options(ASSERT_CALLBACK) => [f1] Initial values: ini.get("assert.callback") => [f1] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f1 called bool(false) @@ -81,8 +77,6 @@ Change callback function using ini.set and test return value string(2) "f1" assert_options(ASSERT_CALLBACK) => [f2] ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f2 called bool(false) @@ -90,8 +84,6 @@ Change callback function using assert_options and test return value string(2) "f2" assert_options(ASSERT_CALLBACK) => [f3] ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f3 called bool(false) @@ -99,8 +91,6 @@ Reset the name of the callback routine to a class method and check that it works string(2) "f3" assert_options(ASSERT_CALLBACK) => [c1] ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d bool(false) Reset callback options to use a class method @@ -113,11 +103,7 @@ array(2) { } ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Deprecated: Non-static method c1::assert() should not be called statically in %s on line 53 -Class assertion failed 53, "0 != 0" +Class assertion failed 52, "assert(0 != 0)" bool(false) Reset callback options to use an object method @@ -136,7 +122,5 @@ array(2) { } ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -Class assertion failed 61, "0 != 0" +Class assertion failed 60, "assert(0 != 0)" bool(false) diff --git a/ext/standard/tests/assert/bug73303.phpt b/ext/standard/tests/assert/bug73303.phpt deleted file mode 100644 index 7264f5a322..0000000000 --- a/ext/standard/tests/assert/bug73303.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -Bug #73303: Scope not inherited by eval in assert() ---FILE-- -<?php - -class Test { - public $prop; - - public function main(){ - assert('self::checkCacheKey(get_object_vars($this))'); - echo 'Success'; - } - private static function checkCacheKey($obj_properties){ - return count($obj_properties) == 1; - } -} - -$obj = new Test(); -$obj->main(); - -?> ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -Success diff --git a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt index dd852ef61f..650002ce1a 100644 --- a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt +++ b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt @@ -9,7 +9,7 @@ Test get_class_methods() function : usage variations - unexpected types */ -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/get_class_variation_001.phpt b/ext/standard/tests/class_object/get_class_variation_001.phpt index b142f8ace9..8c1543d711 100644 --- a/ext/standard/tests/class_object/get_class_variation_001.phpt +++ b/ext/standard/tests/class_object/get_class_variation_001.phpt @@ -67,8 +67,12 @@ $values = array( // loop through each element of the array for object foreach($values as $value) { - echo @"\nArg value: $value (type: " . gettype($value) . ")\n"; - var_dump( get_class($value) ); + echo @"\nArg value: $value (type: " . gettype($value) . ")\n"; + try { + var_dump( get_class($value) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; echo "Done"; @@ -76,137 +80,85 @@ echo "Done"; --EXPECTF-- *** Testing get_class() : usage variations *** -Notice: Undefined variable: undefined_var in %sget_class_variation_001.php on line 58 +Notice: Undefined variable: undefined_var in %s on line %d -Notice: Undefined variable: unset_var in %sget_class_variation_001.php on line 61 +Notice: Undefined variable: unset_var in %s on line %d Arg value: 0 (type: integer) - -Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, int given Arg value: 1 (type: integer) - -Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, int given Arg value: 12345 (type: integer) - -Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, int given Arg value: -2345 (type: integer) - -Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, int given Arg value: 10.5 (type: double) - -Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, float given Arg value: -10.5 (type: double) - -Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, float given Arg value: 101234567000 (type: double) - -Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, float given Arg value: 1.07654321E-9 (type: double) - -Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, float given Arg value: 0.5 (type: double) - -Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, float given Arg value: Array (type: array) - -Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, array given Arg value: Array (type: array) - -Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, array given Arg value: Array (type: array) - -Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, array given Arg value: Array (type: array) - -Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, array given Arg value: Array (type: array) - -Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, array given Arg value: (type: NULL) - -Warning: get_class() expects parameter 1 to be object, null given in %s on line %d -bool(false) +get_class() expects parameter 1 to be object, null given Arg value: (type: NULL) - -Warning: get_class() expects parameter 1 to be object, null given in %s on line %d -bool(false) +get_class() expects parameter 1 to be object, null given Arg value: 1 (type: boolean) - -Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, bool given Arg value: (type: boolean) - -Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, bool given Arg value: 1 (type: boolean) - -Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, bool given Arg value: (type: boolean) - -Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, bool given Arg value: (type: string) - -Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, string given Arg value: (type: string) - -Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, string given Arg value: string (type: string) - -Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, string given Arg value: string (type: string) - -Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d -bool(false) +get_class() expects parameter 1 to be object, string given Arg value: (type: NULL) - -Warning: get_class() expects parameter 1 to be object, null given in %s on line %d -bool(false) +get_class() expects parameter 1 to be object, null given Arg value: (type: NULL) - -Warning: get_class() expects parameter 1 to be object, null given in %s on line %d -bool(false) +get_class() expects parameter 1 to be object, null given Done diff --git a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt index 0ad5756837..985330d413 100644 --- a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt +++ b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt index d65bfcbc26..e545616667 100644 --- a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt +++ b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt index 0a4c575258..3e5447308b 100644 --- a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt +++ b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/method_exists_variation_001.phpt b/ext/standard/tests/class_object/method_exists_variation_001.phpt index 4accebe20a..93497c34b1 100644 --- a/ext/standard/tests/class_object/method_exists_variation_001.phpt +++ b/ext/standard/tests/class_object/method_exists_variation_001.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/property_exists_error.phpt b/ext/standard/tests/class_object/property_exists_error.phpt index 217a5c61f9..7a2f4712da 100644 --- a/ext/standard/tests/class_object/property_exists_error.phpt +++ b/ext/standard/tests/class_object/property_exists_error.phpt @@ -10,19 +10,8 @@ Test property_exists() function : error conditions echo "*** Testing property_exists() : error conditions ***\n"; -$object_or_class = "obj"; -$property_name = 'string_val'; -$extra_arg = 10; - - -echo "\n-- Testing property_exists() function with more than expected no. of arguments --\n"; -var_dump( property_exists($object_or_class, $property_name, $extra_arg) ); - - -echo "\n-- Testing property_exists() function with less than expected no. of arguments --\n"; -var_dump( property_exists($object_or_class) ); - echo "\n-- Testing property_exists() function with incorrect arguments --\n"; +$property_name = 'string_val'; var_dump( property_exists(10, $property_name) ); ?> @@ -30,16 +19,6 @@ var_dump( property_exists(10, $property_name) ); --EXPECTF-- *** Testing property_exists() : error conditions *** --- Testing property_exists() function with more than expected no. of arguments -- - -Warning: property_exists() expects exactly 2 parameters, 3 given in %sproperty_exists_error.php on line %d -NULL - --- Testing property_exists() function with less than expected no. of arguments -- - -Warning: property_exists() expects exactly 2 parameters, 1 given in %sproperty_exists_error.php on line %d -NULL - -- Testing property_exists() function with incorrect arguments -- Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists_error.php on line %d diff --git a/ext/standard/tests/dir/bug41693.phpt b/ext/standard/tests/dir/bug41693.phpt new file mode 100644 index 0000000000..c42ca2faea --- /dev/null +++ b/ext/standard/tests/dir/bug41693.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #41693 (scandir() allows empty directory names) +--FILE-- +<?php + +try { + var_dump(scandir('')); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + +?> +--EXPECT-- +Directory name cannot be empty diff --git a/ext/standard/tests/dir/closedir_error-win32-mb.phpt b/ext/standard/tests/dir/closedir_error-win32-mb.phpt deleted file mode 100644 index e0a399c688..0000000000 --- a/ext/standard/tests/dir/closedir_error-win32-mb.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -Test closedir() function : error conditions - Pass incorrect number of arguments ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die("skip Valid only on Windows"); -} -?> ---FILE-- -<?php -/* Prototype : void closedir([resource $dir_handle]) - * Description: Close directory connection identified by the dir_handle - * Source code: ext/standard/dir.c - * Alias to functions: close - */ - -/* - * Pass incorrect number of arguments to closedir() to test behaviour - */ - -echo "*** Testing closedir() : error conditions ***\n"; - - -//Test closedir with one more than the expected number of arguments -echo "\n-- Testing closedir() function with more than expected no. of arguments --\n"; - -$dir_path = __DIR__ . '\私はガラスを食べられますclosedir_error'; -mkdir($dir_path); -$dir_handle = opendir($dir_path); - -$extra_arg = 10; -var_dump( closedir($dir_handle, $extra_arg) ); - -//successfully close the directory handle so can delete in CLEAN section -closedir($dir_handle); -?> -===DONE=== ---CLEAN-- -<?php -$base_dir = __DIR__; -$dir_path = $base_dir . '\私はガラスを食べられますclosedir_error'; -rmdir($dir_path); -?> ---EXPECTF-- -*** Testing closedir() : error conditions *** - --- Testing closedir() function with more than expected no. of arguments -- - -Warning: closedir() expects at most 1 parameter, 2 given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt b/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt index 07b9ab869a..26d410f4bd 100644 --- a/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt +++ b/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt @@ -32,7 +32,11 @@ echo "Directory Handle: "; var_dump($dh); echo "\n-- Close directory handle second time: --\n"; -var_dump(closedir($dh)); +try { + var_dump(closedir($dh)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Directory Handle: "; var_dump($dh); ?> @@ -50,8 +54,6 @@ NULL Directory Handle: resource(%d) of type (Unknown) -- Close directory handle second time: -- - -Warning: closedir(): %s is not a valid Directory resource in %s on line %d -bool(false) +closedir(): %s is not a valid Directory resource Directory Handle: resource(%d) of type (Unknown) ===DONE=== diff --git a/ext/standard/tests/dir/closedir_variation2.phpt b/ext/standard/tests/dir/closedir_variation2.phpt index cb85750e71..7c814a4926 100644 --- a/ext/standard/tests/dir/closedir_variation2.phpt +++ b/ext/standard/tests/dir/closedir_variation2.phpt @@ -26,7 +26,11 @@ echo "Directory Handle: "; var_dump($dh); echo "\n-- Close directory handle second time: --\n"; -var_dump(closedir($dh)); +try { + var_dump(closedir($dh)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Directory Handle: "; var_dump($dh); ?> @@ -44,8 +48,6 @@ NULL Directory Handle: resource(%d) of type (Unknown) -- Close directory handle second time: -- - -Warning: closedir(): supplied resource is not a valid Directory resource in %s on line %d -bool(false) +closedir(): supplied resource is not a valid Directory resource Directory Handle: resource(%d) of type (Unknown) ===DONE=== diff --git a/ext/standard/tests/dir/closedir_variation3.phpt b/ext/standard/tests/dir/closedir_variation3.phpt index 7d7fdcbf0e..7c65f5f877 100644 --- a/ext/standard/tests/dir/closedir_variation3.phpt +++ b/ext/standard/tests/dir/closedir_variation3.phpt @@ -18,8 +18,11 @@ echo "\n-- Open a file using fopen() --\n"; var_dump($fp = fopen(__FILE__, 'r')); echo "\n-- Try to close the file pointer using closedir() --\n"; -var_dump(closedir($fp)); - +try { + var_dump(closedir($fp)); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} echo "\n-- Check file pointer: --\n"; var_dump($fp); @@ -35,9 +38,7 @@ if(is_resource($fp)) { resource(%d) of type (stream) -- Try to close the file pointer using closedir() -- - -Warning: closedir(): %d is not a valid Directory resource in %s on line %d -bool(false) +%d is not a valid Directory resource -- Check file pointer: -- resource(%d) of type (stream) diff --git a/ext/standard/tests/dir/dir_basic-win32-mb.phpt b/ext/standard/tests/dir/dir_basic-win32-mb.phpt index d643846852..2106bc37d6 100644 --- a/ext/standard/tests/dir/dir_basic-win32-mb.phpt +++ b/ext/standard/tests/dir/dir_basic-win32-mb.phpt @@ -44,8 +44,12 @@ echo "\nClose directory:\n"; var_dump( $d->close() ); var_dump( $d ); -echo "\nTest read after closing the dir:"; -var_dump( $d->read() ); +echo "\nTest read after closing the dir:\n"; +try { + var_dump( $d->read() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // delete temp files delete_files($dir_path, 3, "私はガラスを食べられますdir_basic", 1, ".tmp"); @@ -87,6 +91,5 @@ object(Directory)#%d (2) { } Test read after closing the dir: -Warning: Directory::read(): %s is not a valid Directory resource in %s on line %d -bool(false) +Directory::read(): %s is not a valid Directory resource Done diff --git a/ext/standard/tests/dir/dir_basic.phpt b/ext/standard/tests/dir/dir_basic.phpt index 4360a749c7..15f8061b7b 100644 --- a/ext/standard/tests/dir/dir_basic.phpt +++ b/ext/standard/tests/dir/dir_basic.phpt @@ -38,8 +38,12 @@ echo "\nClose directory:\n"; var_dump( $d->close() ); var_dump( $d ); -echo "\nTest read after closing the dir:"; -var_dump( $d->read() ); +echo "\nTest read after closing the dir:\n"; +try { + var_dump( $d->read() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // delete temp files delete_files($dir_path, 3, "dir_basic", 1, ".tmp"); @@ -81,6 +85,5 @@ object(Directory)#%d (2) { } Test read after closing the dir: -Warning: Directory::read(): supplied resource is not a valid Directory resource in %s on line %d -bool(false) +Directory::read(): supplied resource is not a valid Directory resource Done diff --git a/ext/standard/tests/dir/readdir_variation7.phpt b/ext/standard/tests/dir/readdir_variation7.phpt index 2cd23b8bfc..7950d58823 100644 --- a/ext/standard/tests/dir/readdir_variation7.phpt +++ b/ext/standard/tests/dir/readdir_variation7.phpt @@ -15,14 +15,16 @@ echo "*** Testing readdir() : usage variations ***\n"; // get a resource variable var_dump($fp = fopen(__FILE__, "r")); -var_dump( readdir($fp) ); +try { + var_dump( readdir($fp) ); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} ?> ===DONE=== --EXPECTF-- *** Testing readdir() : usage variations *** resource(%d) of type (stream) - -Warning: readdir(): %d is not a valid Directory resource in %s on line %d -bool(false) +%d is not a valid Directory resource ===DONE=== diff --git a/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt b/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt index e46640c41e..d38571c88a 100644 --- a/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt +++ b/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt @@ -29,7 +29,11 @@ var_dump(readdir($dir_handle)); closedir($dir_handle); echo "\n-- Call to rewinddir() --\n"; -var_dump(rewinddir($dir_handle)); +try { + var_dump(rewinddir($dir_handle)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== --CLEAN-- @@ -45,7 +49,5 @@ resource(%d) of type (stream) string(%d) "%s" -- Call to rewinddir() -- - -Warning: rewinddir(): %s is not a valid Directory resource in %s on line %d -bool(false) +rewinddir(): %s is not a valid Directory resource ===DONE=== diff --git a/ext/standard/tests/dir/rewinddir_variation2.phpt b/ext/standard/tests/dir/rewinddir_variation2.phpt index 02654aa80c..ca646f2002 100644 --- a/ext/standard/tests/dir/rewinddir_variation2.phpt +++ b/ext/standard/tests/dir/rewinddir_variation2.phpt @@ -23,7 +23,11 @@ var_dump(readdir($dir_handle)); closedir($dir_handle); echo "\n-- Call to rewinddir() --\n"; -var_dump(rewinddir($dir_handle)); +try { + var_dump(rewinddir($dir_handle)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== --CLEAN-- @@ -39,7 +43,5 @@ resource(%d) of type (stream) string(%d) "%s" -- Call to rewinddir() -- - -Warning: rewinddir(): supplied resource is not a valid Directory resource in %s on line %d -bool(false) +rewinddir(): supplied resource is not a valid Directory resource ===DONE=== diff --git a/ext/standard/tests/dir/rewinddir_variation3.phpt b/ext/standard/tests/dir/rewinddir_variation3.phpt index a1ec7f80d4..920e493c07 100644 --- a/ext/standard/tests/dir/rewinddir_variation3.phpt +++ b/ext/standard/tests/dir/rewinddir_variation3.phpt @@ -18,7 +18,12 @@ echo "\n-- Open a file using fopen --\n"; var_dump($fp = fopen(__FILE__, 'r')); $result1 = fread($fp, 5); -var_dump(rewinddir($fp)); + +try { + var_dump(rewinddir($fp)); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} $result2 = fread($fp, 5); echo "\n-- Check if rewinddir() has repositioned the file pointer --\n"; @@ -34,9 +39,7 @@ if ($result1 === $result2) { -- Open a file using fopen -- resource(%d) of type (stream) - -Warning: rewinddir(): %d is not a valid Directory resource in %s on line %d -bool(false) +%d is not a valid Directory resource -- Check if rewinddir() has repositioned the file pointer -- rewinddir() does not work on file pointers diff --git a/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt deleted file mode 100644 index 5505b3db6d..0000000000 --- a/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt +++ /dev/null @@ -1,244 +0,0 @@ ---TEST-- -Test scandir() function : usage variations - diff data types as $context arg ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die("skip Valid only on Windows"); -} -?> ---FILE-- -<?php -/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]]) - * Description: List files & directories inside the specified path - * Source code: ext/standard/dir.c - */ - -/* - * Pass different data types as $context argument to test how scandir() behaves - */ - -echo "*** Testing scandir() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$dir = __DIR__ . '/私はガラスを食べられますscandir_variation3'; -mkdir($dir); -$sorting_order = SCANDIR_SORT_ASCENDING; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $context argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of scandir() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( scandir($dir, $sorting_order, $input) ); - $iterator++; -}; - -fclose($fp); -?> -===DONE=== ---CLEAN-- -<?php -$dir = __DIR__ . '/私はガラスを食べられますscandir_variation3'; -rmdir($dir); -?> ---EXPECTF-- -*** Testing scandir() : usage variations *** - --- Iteration 1 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: scandir() expects parameter 3 to be resource, array given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: scandir() expects parameter 3 to be resource, object given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: scandir(): supplied resource is not a valid Stream-Context resource in %s on line %d -array(2) { - [0]=> - string(1) "." - [1]=> - string(2) ".." -} -===DONE=== diff --git a/ext/standard/tests/directory/DirectoryClass_basic_001.phpt b/ext/standard/tests/directory/DirectoryClass_basic_001.phpt index 73aac5b43c..5594207812 100644 --- a/ext/standard/tests/directory/DirectoryClass_basic_001.phpt +++ b/ext/standard/tests/directory/DirectoryClass_basic_001.phpt @@ -15,7 +15,12 @@ echo $rc; echo "Cannot instantiate a valid Directory directly:\n"; $d = new Directory(getcwd()); var_dump($d); -var_dump($d->read()); + +try { + var_dump($d->read()); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} ?> --EXPECTF-- @@ -60,6 +65,4 @@ Class [ <internal%s> class Directory ] { Cannot instantiate a valid Directory directly: object(Directory)#%d (0) { } - -Warning: Directory::read(): Unable to find my handle property in %s on line 15 -bool(false) +Unable to find my handle property diff --git a/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt index cba61d3fbf..2949bd3381 100644 --- a/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt +++ b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt @@ -10,22 +10,41 @@ mkdir($d); echo "\n--> Try all methods with bad handle:\n"; $d = new Directory($d); $d->handle = "Havoc!"; -var_dump($d->read()); -var_dump($d->rewind()); -var_dump($d->close()); +try { + var_dump($d->read()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump($d->rewind()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump($d->close()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n--> Try all methods with no handle:\n"; $d = new Directory($d); unset($d->handle); -var_dump($d->read()); -var_dump($d->rewind()); -var_dump($d->close()); -echo "\n--> Try all methods with wrong number of args:\n"; -$d = new Directory($d); -var_dump($d->read(1,2)); -var_dump($d->rewind(1,2)); -var_dump($d->close(1,2)); +try { + var_dump($d->read()); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} +try { + var_dump($d->rewind()); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} +try { + var_dump($d->close()); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} ?> --CLEAN-- @@ -34,36 +53,14 @@ $d = getcwd().PATH_SEPARATOR."私はガラスを食べられます"; rmdir($d); ?> ---EXPECTF-- +--EXPECT-- --> Try all methods with bad handle: - -Warning: Directory::read(): supplied argument is not a valid Directory resource in %s on line %d -bool(false) - -Warning: Directory::rewind(): supplied argument is not a valid Directory resource in %s on line %d -bool(false) - -Warning: Directory::close(): supplied argument is not a valid Directory resource in %s on line %d -bool(false) +Directory::read(): supplied argument is not a valid Directory resource +Directory::rewind(): supplied argument is not a valid Directory resource +Directory::close(): supplied argument is not a valid Directory resource --> Try all methods with no handle: +Unable to find my handle property +Unable to find my handle property +Unable to find my handle property -Warning: Directory::read(): Unable to find my handle property in %s on line %d -bool(false) - -Warning: Directory::rewind(): Unable to find my handle property in %s on line %d -bool(false) - -Warning: Directory::close(): Unable to find my handle property in %s on line %d -bool(false) - ---> Try all methods with wrong number of args: - -Warning: Directory::read() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::rewind() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::close() expects at most 1 parameter, 2 given in %s on line %d -NULL diff --git a/ext/standard/tests/directory/DirectoryClass_error_001.phpt b/ext/standard/tests/directory/DirectoryClass_error_001.phpt index 5b2771eef6..1a8bbf3c1d 100644 --- a/ext/standard/tests/directory/DirectoryClass_error_001.phpt +++ b/ext/standard/tests/directory/DirectoryClass_error_001.phpt @@ -6,54 +6,50 @@ Directory class behaviour. echo "\n--> Try all methods with bad handle:\n"; $d = new Directory(getcwd()); $d->handle = "Havoc!"; -var_dump($d->read()); -var_dump($d->rewind()); -var_dump($d->close()); +try { + var_dump($d->read()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump($d->rewind()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump($d->close()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n--> Try all methods with no handle:\n"; $d = new Directory(getcwd()); unset($d->handle); -var_dump($d->read()); -var_dump($d->rewind()); -var_dump($d->close()); -echo "\n--> Try all methods with wrong number of args:\n"; -$d = new Directory(getcwd()); -var_dump($d->read(1,2)); -var_dump($d->rewind(1,2)); -var_dump($d->close(1,2)); +try { + var_dump($d->read()); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} +try { + var_dump($d->rewind()); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} +try { + var_dump($d->close()); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} ?> ---EXPECTF-- +--EXPECT-- --> Try all methods with bad handle: - -Warning: Directory::read(): supplied argument is not a valid Directory resource in %s on line %d -bool(false) - -Warning: Directory::rewind(): supplied argument is not a valid Directory resource in %s on line %d -bool(false) - -Warning: Directory::close(): supplied argument is not a valid Directory resource in %s on line %d -bool(false) +Directory::read(): supplied argument is not a valid Directory resource +Directory::rewind(): supplied argument is not a valid Directory resource +Directory::close(): supplied argument is not a valid Directory resource --> Try all methods with no handle: - -Warning: Directory::read(): Unable to find my handle property in %s on line %d -bool(false) - -Warning: Directory::rewind(): Unable to find my handle property in %s on line %d -bool(false) - -Warning: Directory::close(): Unable to find my handle property in %s on line %d -bool(false) - ---> Try all methods with wrong number of args: - -Warning: Directory::read() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::rewind() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::close() expects at most 1 parameter, 2 given in %s on line %d -NULL +Unable to find my handle property +Unable to find my handle property +Unable to find my handle property diff --git a/ext/standard/tests/file/005_error.phpt b/ext/standard/tests/file/005_error.phpt index e3ce551b3d..bc2bf3f978 100644 --- a/ext/standard/tests/file/005_error.phpt +++ b/ext/standard/tests/file/005_error.phpt @@ -29,31 +29,6 @@ var_dump( filemtime("/no/such/file/or/dir") ); var_dump( filectime("/no/such/file/or/dir") ); var_dump( touch("/no/such/file/or/dir", 10) ); -/* Only one invalid argument */ -var_dump( fileatime(__FILE__, "string") ); -var_dump( filemtime(__FILE__, 100) ); -var_dump( filectime(__FILE__, TRUE) ); -var_dump( touch(__FILE__, 10, 100, 123) ); - -echo "\n-- Testing No.of arguments less than expected --"; -var_dump( fileatime() ); -var_dump( filemtime() ); -var_dump( filectime() ); -var_dump( touch() ); - -echo "\n-- Testing No.of arguments greater than expected --"; -/* Both invalid arguments */ -var_dump( fileatime("/no/such/file/or/dir", "string") ); -var_dump( filemtime("/no/such/file/or/dir", 100) ); -var_dump( filectime("/no/such/file/or/dir", TRUE) ); -var_dump( touch("/no/such/file/or/dir", 10, 100, 123) ); - -/* Only one invalid argument */ -var_dump( fileatime(__FILE__, "string") ); -var_dump( filemtime(__FILE__, 100) ); -var_dump( filectime(__FILE__, TRUE) ); -var_dump( touch(__FILE__, 10, 100, 123) ); - echo "\nDone"; ?> --EXPECTF-- @@ -72,54 +47,4 @@ bool(false) Warning: touch(): Unable to create file /no/such/file/or/dir because No such file or directory in %s on line %d bool(false) -Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - --- Testing No.of arguments less than expected -- -Warning: fileatime() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: touch() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing No.of arguments greater than expected -- -Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - -Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/file/006_error.phpt b/ext/standard/tests/file/006_error.phpt index 0e95f8056e..82e623350a 100644 --- a/ext/standard/tests/file/006_error.phpt +++ b/ext/standard/tests/file/006_error.phpt @@ -46,19 +46,6 @@ var_dump( chmod("/no/such/file/dir", 0777) ); var_dump( fileperms("/no/such/file/dir") ); echo "\n"; -/* With args less than expected */ -$fp = fopen(__DIR__."/006_error.tmp", "w"); -fclose($fp); -var_dump( chmod(__DIR__."/006_error.tmp") ); -var_dump( chmod("nofile") ); -var_dump( chmod() ); -var_dump( fileperms() ); - -/* With args greater than expected */ -var_dump( chmod(__DIR__."/006_error.tmp", 0755, TRUE) ); -var_dump( fileperms(__DIR__."/006_error.tmp", 0777) ); -var_dump( fileperms("nofile", 0777) ); - echo "\n*** Done ***\n"; ?> --CLEAN-- @@ -83,25 +70,4 @@ Warning: fileperms(): stat failed for /no/such/file/dir in %s on line %d bool(false) -Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: chmod() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: fileperms() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/006_variation2.phpt b/ext/standard/tests/file/006_variation2.phpt index cba524882f..6ae459df0c 100644 --- a/ext/standard/tests/file/006_variation2.phpt +++ b/ext/standard/tests/file/006_variation2.phpt @@ -68,15 +68,23 @@ $perms_array = array( $count = 1; foreach($perms_array as $permission) { echo "-- Iteration $count --\n"; - var_dump( chmod($file_name, $permission) ); - printf("%o", fileperms($file_name) ); - echo "\n"; - clearstatcache(); - - var_dump( chmod($dir_name, $permission) ); - printf("%o", fileperms($dir_name) ); - echo "\n"; - clearstatcache(); + try { + var_dump( chmod($file_name, $permission) ); + printf("%o", fileperms($file_name) ); + echo "\n"; + clearstatcache(); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + try { + var_dump( chmod($dir_name, $permission) ); + printf("%o", fileperms($dir_name) ); + echo "\n"; + clearstatcache(); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } echo "*** Done ***\n"; @@ -148,39 +156,15 @@ bool(true) bool(true) 43567 -- Iteration 12 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given -- Iteration 13 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given -- Iteration 14 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given -- Iteration 15 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given *** Done *** diff --git a/ext/standard/tests/file/007_basic.phpt b/ext/standard/tests/file/007_basic.phpt index fd2e5575a9..fa25431580 100644 --- a/ext/standard/tests/file/007_basic.phpt +++ b/ext/standard/tests/file/007_basic.phpt @@ -51,9 +51,17 @@ for( $i=0; $i<count($modes); $i++ ) { // check fclose() var_dump( fclose($handle) ); var_dump( $handle ); - // confirm the closure, using ftell() and feof(), expect, false - var_dump( ftell($handle) ); - var_dump( feof($handle) ); + // confirm the closure, using ftell() and feof() + try { + var_dump( ftell($handle) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( feof($handle) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } // remove the temp file @@ -78,9 +86,17 @@ for( $i=0; $i<count($x_modes); $i++ ) { // check fclose() var_dump( fclose($handle) ); var_dump( $handle ); - // confirm the closure, using ftell() and feof(), expect, false - var_dump( ftell($handle) ); - var_dump( feof($handle) ); + // confirm the closure, using ftell() and feof() + try { + var_dump( ftell($handle) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( feof($handle) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } var_dump( $handle ); // remove the file @@ -97,12 +113,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'wb' -- resource(%d) of type (stream) @@ -110,12 +122,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'wt' -- resource(%d) of type (stream) @@ -123,12 +131,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'w+' -- resource(%d) of type (stream) @@ -136,12 +140,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'w+b' -- resource(%d) of type (stream) @@ -149,12 +149,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'w+t' -- resource(%d) of type (stream) @@ -162,12 +158,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'r' -- resource(%d) of type (stream) @@ -175,12 +167,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'rb' -- resource(%d) of type (stream) @@ -188,12 +176,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'rt' -- resource(%d) of type (stream) @@ -201,12 +185,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'r+' -- resource(%d) of type (stream) @@ -214,12 +194,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'r+b' -- resource(%d) of type (stream) @@ -227,12 +203,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'r+t' -- resource(%d) of type (stream) @@ -240,12 +212,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'a' -- resource(%d) of type (stream) @@ -253,12 +221,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'ab' -- resource(%d) of type (stream) @@ -266,12 +230,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'at' -- resource(%d) of type (stream) @@ -279,12 +239,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'a+' -- resource(%d) of type (stream) @@ -292,12 +248,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'a+t' -- resource(%d) of type (stream) @@ -305,12 +257,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'a+b' -- resource(%d) of type (stream) @@ -318,12 +266,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'x' -- resource(%d) of type (stream) @@ -331,12 +275,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource resource(%d) of type (Unknown) -- Iteration with mode 'xb' -- @@ -345,12 +285,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource resource(%d) of type (Unknown) -- Iteration with mode 'xt' -- @@ -359,12 +295,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource resource(%d) of type (Unknown) -- Iteration with mode 'x+' -- @@ -373,12 +305,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource resource(%d) of type (Unknown) -- Iteration with mode 'x+b' -- @@ -387,12 +315,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource resource(%d) of type (Unknown) -- Iteration with mode 'x+t' -- @@ -401,12 +325,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource resource(%d) of type (Unknown) *** Done *** diff --git a/ext/standard/tests/file/007_error.phpt b/ext/standard/tests/file/007_error.phpt deleted file mode 100644 index 93a6a23e5f..0000000000 --- a/ext/standard/tests/file/007_error.phpt +++ /dev/null @@ -1,185 +0,0 @@ ---TEST-- -Test fopen, fclose() & feof() functions: error conditions ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* - Prototype: resource fopen(string $filename, string $mode - [, bool $use_include_path [, resource $context]] ); - Description: Opens file or URL. - - Prototype: bool fclose ( resource $handle ); - Description: Closes an open file pointer - - Prototype: bool feof ( resource $handle ) - Description: Returns TRUE if the file pointer is at EOF or an error occurs - (including socket timeout); otherwise returns FALSE. -*/ - -echo "*** Testing error conditions for fopen(), fclsoe() & feof() ***\n"; -/* Arguments less than minimum no.of args */ - -// fopen () -var_dump(fopen(__FILE__)); // one valid argument -var_dump(fopen()); // zero argument - -// fclose() -$fp = fopen(__FILE__, "r"); -fclose($fp); -var_dump( fclose($fp) ); // closed handle -var_dump( fclose(__FILE__) ); // invalid handle -var_dump( fclose() ); // zero argument - -//feof() -var_dump( feof($fp) ); // closed handle -var_dump( feof(__FILE__) ); // invalid handle -var_dump( feof() ); //zero argument - -/* Arguments greater than maximum no.of ags */ -var_dump(fopen(__FILE__, "r", TRUE, "www.example.com", 100)); - -$fp = fopen(__FILE__, "r"); -var_dump( fclose($fp, "handle") ); - -var_dump( feof($fp, "handle")); -fclose($fp); - -/* test invalid arguments : non-resources */ -echo "-- Testing fopen(), fclose() & feof() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, - NULL, - "" -); - -/* loop to test fclose with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fopen($invalid_args[$loop_counter - 1], "r") ); - var_dump( fclose($invalid_args[$loop_counter - 1]) ); - var_dump( feof($invalid_args[$loop_counter - 1]) ); -} - -?> ---EXPECTF-- -*** Testing error conditions for fopen(), fclsoe() & feof() *** - -Warning: fopen() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: fopen() expects at least 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: fclose(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: fclose() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: feof() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: fopen() expects at most 4 parameters, 5 given in %s on line %d -bool(false) - -Warning: fclose() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: feof() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) --- Testing fopen(), fclose() & feof() with invalid arguments -- --- Iteration 1 -- - -Warning: fopen(string): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fopen(10): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, int given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fopen(10.5): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, float given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fopen(1): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fopen() expects parameter 1 to be a valid path, array given in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fopen() expects parameter 1 to be a valid path, object given in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, object given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: fopen(): Filename cannot be empty in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, null given in %s on line %d -bool(false) --- Iteration 8 -- - -Warning: fopen(): Filename cannot be empty in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, string given in %s on line %d -bool(false) diff --git a/ext/standard/tests/file/basename-win32.phpt b/ext/standard/tests/file/basename-win32.phpt index 996b060cea..703861dec7 100644 --- a/ext/standard/tests/file/basename-win32.phpt +++ b/ext/standard/tests/file/basename-win32.phpt @@ -115,23 +115,6 @@ check_basename( $file_paths ); echo "\n*** Testing possible variations in path and suffix ***\n"; check_basename( $file_path_variations ); -echo "\n*** Testing error conditions ***\n"; -// zero arguments -var_dump( basename() ); - -// more than expected no. of arguments -var_dump( basename("\\blah\\tmp\\bar.zip", ".zip", ".zip") ); - -// passing invalid type arguments -$object = new stdclass; -var_dump( basename( array("string\\bar") ) ); -var_dump( basename( array("string\\bar"), "bar" ) ); -var_dump( basename( "bar", array("string\\bar") ) ); -var_dump( basename( $object, "bar" ) ); -var_dump( basename( $object ) ); -var_dump( basename( $object, $object ) ); -var_dump( basename( "bar", $object ) ); - echo "Done\n"; ?> --EXPECTF-- @@ -309,33 +292,4 @@ string(0) "" --Iteration 32-- string(0) "" - -*** Testing error conditions *** - -Warning: basename() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: basename() expects at most 2 parameters, 3 given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: basename() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: basename() expects parameter 2 to be string, object given in %s on line %d -NULL Done diff --git a/ext/standard/tests/file/basename.phpt b/ext/standard/tests/file/basename.phpt Binary files differindex a9b4389b5a..8352f4da4b 100644 --- a/ext/standard/tests/file/basename.phpt +++ b/ext/standard/tests/file/basename.phpt diff --git a/ext/standard/tests/file/bug39863.phpt b/ext/standard/tests/file/bug39863.phpt index 5460203e05..174e349b15 100644 --- a/ext/standard/tests/file/bug39863.phpt +++ b/ext/standard/tests/file/bug39863.phpt @@ -7,16 +7,11 @@ Andrew van der Stock, vanderaj @ owasp.org $filename = __FILE__ . chr(0). ".ridiculous"; -if (file_exists($filename)) { - echo "FAIL\n"; -} -else { - echo "PASS\n"; +try { + var_dump(file_exists($filename)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; } ?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -Warning: file_exists() expects parameter 1 to be a valid path, string given in %s on line %d -PASS -===DONE=== +--EXPECT-- +file_exists() expects parameter 1 to be a valid path, string given diff --git a/ext/standard/tests/file/bug41693.phpt b/ext/standard/tests/file/bug41693.phpt deleted file mode 100644 index ea074fa4fd..0000000000 --- a/ext/standard/tests/file/bug41693.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Bug #41693 (scandir() allows empty directory names) ---FILE-- -<?php - -var_dump(scandir('')); - -echo "Done\n"; -?> ---EXPECTF-- -Warning: scandir(): Directory name cannot be empty in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/file/bug72035.phpt b/ext/standard/tests/file/bug72035.phpt index 704d746efc..57feddbb09 100644 --- a/ext/standard/tests/file/bug72035.phpt +++ b/ext/standard/tests/file/bug72035.phpt @@ -3,7 +3,6 @@ Bug #72035 php-cgi.exe fails to run scripts relative to drive root --SKIPIF-- <?php if(substr(PHP_OS, 0, 3) != 'WIN' ) die('skip windows only test'); -if(php_sapi_name() != "cli") die('skip CLI only test'); $cgi = realpath(dirname(PHP_BINARY)) . DIRECTORY_SEPARATOR . "php-cgi.exe"; if (!file_exists($cgi)) die('skip CGI binary not found'); diff --git a/ext/standard/tests/file/chmod_error.phpt b/ext/standard/tests/file/chmod_error.phpt index 3b234c741f..b7999aa03d 100644 --- a/ext/standard/tests/file/chmod_error.phpt +++ b/ext/standard/tests/file/chmod_error.phpt @@ -10,19 +10,6 @@ Test chmod() function : error conditions echo "*** Testing chmod() : error conditions ***\n"; - -//Test chmod with one more than the expected number of arguments -echo "\n-- Testing chmod() function with more than expected no. of arguments --\n"; -$filename = 'string_val'; -$mode = 10; -$extra_arg = 10; -var_dump( chmod($filename, $mode, $extra_arg) ); - -// Testing chmod with one less than the expected number of arguments -echo "\n-- Testing chmod() function with less than expected no. of arguments --\n"; -$filename = 'string_val'; -var_dump( chmod($filename) ); - // testing chmod with a non-existing file $filename = "___nonExisitingFile___"; var_dump(chmod($filename, 0777)); @@ -32,16 +19,6 @@ var_dump(chmod($filename, 0777)); --EXPECTF-- *** Testing chmod() : error conditions *** --- Testing chmod() function with more than expected no. of arguments -- - -Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d -NULL - --- Testing chmod() function with less than expected no. of arguments -- - -Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Warning: chmod(): No such file or directory in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/file/copy_error.phpt b/ext/standard/tests/file/copy_error.phpt index 2d6395167b..36eb58fc2a 100644 --- a/ext/standard/tests/file/copy_error.phpt +++ b/ext/standard/tests/file/copy_error.phpt @@ -11,13 +11,6 @@ echo "*** Testing copy() function: error conditions --\n"; /* Invalid args */ var_dump( copy("/no/file", "file") ); -/* No.of args less than expected */ -var_dump( copy() ); -var_dump( copy(__FILE__) ); - -/* No.of args less than expected */ -var_dump( copy(__FILE__, "file1", "file1") ); - echo "*** Done ***\n"; ?> --EXPECTF-- @@ -25,13 +18,4 @@ echo "*** Done ***\n"; Warning: copy(/no/file): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: copy() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: copy() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: copy() expects parameter 3 to be resource, string given in %s on line %d -NULL *** Done *** diff --git a/ext/standard/tests/file/copy_variation4.phpt b/ext/standard/tests/file/copy_variation4.phpt Binary files differindex b082c082b5..01385cb893 100644 --- a/ext/standard/tests/file/copy_variation4.phpt +++ b/ext/standard/tests/file/copy_variation4.phpt diff --git a/ext/standard/tests/file/disk.phpt b/ext/standard/tests/file/disk.phpt index a048af6ccb..fe415535ba 100644 --- a/ext/standard/tests/file/disk.phpt +++ b/ext/standard/tests/file/disk.phpt @@ -11,9 +11,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { --FILE-- <?php -var_dump(disk_free_space()); -var_dump(disk_total_space()); - var_dump(disk_free_space(-1)); var_dump(disk_total_space(-1)); @@ -26,12 +23,6 @@ var_dump(disk_total_space("/some/path/here")); echo "Done\n"; ?> --EXPECTF-- -Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - Warning: disk_free_space(): No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_free_space_error-win32.phpt b/ext/standard/tests/file/disk_free_space_error-win32.phpt index 43e71719c0..e7439d3f34 100644 --- a/ext/standard/tests/file/disk_free_space_error-win32.phpt +++ b/ext/standard/tests/file/disk_free_space_error-win32.phpt @@ -16,12 +16,6 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) echo "*** Testing error conditions ***\n"; $file_path = __DIR__; -var_dump( disk_free_space() ); // Zero Arguments -var_dump( diskfreespace() ); - -var_dump( disk_free_space( $file_path, "extra argument") ); // More than valid number of arguments -var_dump( diskfreespace( $file_path, "extra argument") ); - var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory var_dump( diskfreespace( $file_path."/dir1" )); @@ -43,18 +37,6 @@ unlink($file_path."/disk_free_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_free_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_free_space(): The system cannot find the path specified. in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_free_space_error.phpt b/ext/standard/tests/file/disk_free_space_error.phpt index aca17b2331..ea8d84aa36 100644 --- a/ext/standard/tests/file/disk_free_space_error.phpt +++ b/ext/standard/tests/file/disk_free_space_error.phpt @@ -16,12 +16,6 @@ if(substr(PHP_OS, 0, 3) == 'WIN') echo "*** Testing error conditions ***\n"; $file_path = __DIR__; -var_dump( disk_free_space() ); // Zero Arguments -var_dump( diskfreespace() ); - -var_dump( disk_free_space( $file_path, "extra argument") ); // More than valid number of arguments -var_dump( diskfreespace( $file_path, "extra argument") ); - var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory var_dump( diskfreespace( $file_path."/dir1" )); @@ -43,18 +37,6 @@ unlink($file_path."/disk_free_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_free_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_free_space(): No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_free_space_variation.phpt b/ext/standard/tests/file/disk_free_space_variation.phpt index 1008d9ecbb..6693b56994 100644 --- a/ext/standard/tests/file/disk_free_space_variation.phpt +++ b/ext/standard/tests/file/disk_free_space_variation.phpt @@ -48,8 +48,16 @@ $count = 1; /* loop through to test each element the above array */ foreach($dirs_arr as $dir1) { echo "\n-- Iteration $count --\n"; - var_dump( disk_free_space( $dir1 ) ); - var_dump( diskfreespace( $dir1 ) ); + try { + var_dump( disk_free_space( $dir1 ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( diskfreespace( $dir1 ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } @@ -102,35 +110,19 @@ float(%d) float(%d) -- Iteration 9 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given -- Iteration 10 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given -- Iteration 11 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given -- Iteration 12 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given --- Done --- diff --git a/ext/standard/tests/file/disk_total_space_error-win32.phpt b/ext/standard/tests/file/disk_total_space_error-win32.phpt index c3a2854eff..5896ad213b 100644 --- a/ext/standard/tests/file/disk_total_space_error-win32.phpt +++ b/ext/standard/tests/file/disk_total_space_error-win32.phpt @@ -16,10 +16,6 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) echo "*** Testing error conditions ***\n"; $file_path = __DIR__; -var_dump( disk_total_space() ); // Zero Arguments - -var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments - var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory @@ -38,12 +34,6 @@ unlink($file_path."/disk_total_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_total_space(): The system cannot find the path specified. in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_total_space_error.phpt b/ext/standard/tests/file/disk_total_space_error.phpt index 125d093ccd..6c2c3bf833 100644 --- a/ext/standard/tests/file/disk_total_space_error.phpt +++ b/ext/standard/tests/file/disk_total_space_error.phpt @@ -16,10 +16,6 @@ if(substr(PHP_OS, 0, 3) == 'WIN') echo "*** Testing error conditions ***\n"; $file_path = __DIR__; -var_dump( disk_total_space() ); // Zero Arguments - -var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments - var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory @@ -38,12 +34,6 @@ unlink($file_path."/disk_total_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_total_space(): No such file or directory in %s on line %d bool(false) float(%d) diff --git a/ext/standard/tests/file/disk_total_space_variation.phpt b/ext/standard/tests/file/disk_total_space_variation.phpt index 3ba3771aac..326fd9ea25 100644 --- a/ext/standard/tests/file/disk_total_space_variation.phpt +++ b/ext/standard/tests/file/disk_total_space_variation.phpt @@ -49,7 +49,11 @@ $count = 1; /* loop through to test each element the above array */ foreach($dirs_arr as $dir1) { echo "\n-- Iteration $count --\n"; - var_dump( disk_total_space( $dir1 ) ); + try { + var_dump( disk_total_space( $dir1 ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } @@ -96,25 +100,17 @@ float(%d) float(%d) -- Iteration 9 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given -- Iteration 10 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given -- Iteration 11 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given -- Iteration 12 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given *** Testing with Binary Input *** -float(%d) +float(%s) --- Done --- diff --git a/ext/standard/tests/file/fclose_variation1.phpt b/ext/standard/tests/file/fclose_variation1.phpt index ba3631e50d..8d3e1a1805 100644 --- a/ext/standard/tests/file/fclose_variation1.phpt +++ b/ext/standard/tests/file/fclose_variation1.phpt @@ -7,9 +7,13 @@ function separate_zval(&$var) { } $s2 = $s; separate_zval($s2); fclose($s); -echo fread($s2, strlen("<?php")); +try { + echo fread($s2, strlen("<?php")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\nDone.\n"; ---EXPECTF-- -Warning: fread(): supplied resource is not a valid stream resource in %s on line %d +--EXPECT-- +fread(): supplied resource is not a valid stream resource Done. diff --git a/ext/standard/tests/file/feof_basic.phpt b/ext/standard/tests/file/feof_basic.phpt index 2fc2e4b855..0711a3468d 100644 --- a/ext/standard/tests/file/feof_basic.phpt +++ b/ext/standard/tests/file/feof_basic.phpt @@ -64,13 +64,17 @@ var_dump(feof($h)); echo "*** closing file, testing eof ***\n"; fclose($h); -feof($h); +try { + feof($h); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} unlink($tmpFile1); unlink($tmpFile2); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing feof() : basic functionality *** *** testing reading complete file using feof to stop *** @@ -96,6 +100,5 @@ bool(false) *** testing feof after a seek passed the end *** bool(false) *** closing file, testing eof *** - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d +feof(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/fgetc_variation2.phpt b/ext/standard/tests/file/fgetc_variation2.phpt index d444209af4..d67e56e56a 100644 --- a/ext/standard/tests/file/fgetc_variation2.phpt +++ b/ext/standard/tests/file/fgetc_variation2.phpt @@ -24,29 +24,16 @@ $file_handle = fopen(__FILE__, "r"); fclose($file_handle); // read from closed file -var_dump( fgetc($file_handle) ); - -echo "-- Testing fgetc() with unset handle --\n"; -// open the file for reading -$file_handle = fopen(__FILE__, "r"); -// unset the file handle -unset($file_handle); - -//fgetc using unset handle -var_dump( fgetc($file_handle) ); +try { + var_dump( fgetc($file_handle) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing fgetc() : usage variations *** -- Testing fgetc() with closed handle -- - -Warning: fgetc(): supplied resource is not a valid stream resource in %s on line %d -bool(false) --- Testing fgetc() with unset handle -- - -Notice: Undefined variable: file_handle in %s on line %d - -Warning: fgetc() expects parameter 1 to be resource, null given in %s on line %d -bool(false) +fgetc(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/fgets_error.phpt b/ext/standard/tests/file/fgets_error.phpt index 919343aa87..eed35b3001 100644 --- a/ext/standard/tests/file/fgets_error.phpt +++ b/ext/standard/tests/file/fgets_error.phpt @@ -8,14 +8,8 @@ Test fgets() function : error conditions */ echo "*** Testing error conditions ***\n"; -// zero argument -echo "-- Testing fgets() with zero argument --\n"; -var_dump( fgets() ); -// more than expected no. of args -echo "-- Testing fgets() with more than expected number of arguments --\n"; $fp = fopen(__FILE__, "r"); -var_dump( fgets($fp, 10, $fp) ); // invalid length argument echo "-- Testing fgets() with invalid length arguments --\n"; @@ -26,45 +20,10 @@ var_dump( fgets($fp, $len) ); $len = 1; var_dump( fgets($fp, $len) ); // return length - 1 always, expect false - -// test invalid arguments : non-resources -echo "-- Testing fgets() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fgets() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fgets($invalid_args[$loop_counter - 1], 10) ); -} - -// fgets() on a file handle which is already closed -echo "-- Testing fgets() with closed/unset file handle --"; -fclose($fp); -var_dump(fgets($fp,10)); - -// fgets() on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( fgets(@$file_handle,10)); - echo "Done\n"; ?> --EXPECTF-- *** Testing error conditions *** --- Testing fgets() with zero argument -- - -Warning: fgets() expects at least 1 parameter, 0 given in %s on line %d -bool(false) --- Testing fgets() with more than expected number of arguments -- - -Warning: fgets() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -- Testing fgets() with invalid length arguments -- Warning: fgets(): Length parameter must be greater than 0 in %s on line %d @@ -73,35 +32,4 @@ bool(false) Warning: fgets(): Length parameter must be greater than 0 in %s on line %d bool(false) bool(false) --- Testing fgets() with invalid arguments -- --- Iteration 1 -- - -Warning: fgets() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fgets() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fgets() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fgets() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fgets() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fgets() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Testing fgets() with closed/unset file handle -- -Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fgets_variation2.phpt b/ext/standard/tests/file/fgets_variation2.phpt index 0bbcf22039..2626139dcb 100644 --- a/ext/standard/tests/file/fgets_variation2.phpt +++ b/ext/standard/tests/file/fgets_variation2.phpt @@ -24,39 +24,22 @@ $file_handle = fopen(__FILE__, "r"); fclose($file_handle); // read from closed file -var_dump( fgets($file_handle) ); // default length -var_dump( fgets($file_handle, 10) ); // with specific length - -echo "-- Testing fgets() with unset handle --\n"; -// open the file for reading -$file_handle = fopen(__FILE__, "r"); -// unset the file handle -unset($file_handle); - -//fgets using unset handle -var_dump( fgets($file_handle) ); // default length -var_dump( fgets($file_handle, 10) ); // with specific length +try { + var_dump( fgets($file_handle) ); // default length +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( fgets($file_handle, 10) ); // with specific length +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing fgets() : usage variations *** -- Testing fgets() with closed handle -- - -Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d -bool(false) --- Testing fgets() with unset handle -- - -Notice: Undefined variable: file_handle in %s on line %d - -Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Notice: Undefined variable: file_handle in %s on line %d - -Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d -bool(false) +fgets(): supplied resource is not a valid stream resource +fgets(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/fgetss.phpt b/ext/standard/tests/file/fgetss.phpt deleted file mode 100644 index 7ca6169762..0000000000 --- a/ext/standard/tests/file/fgetss.phpt +++ /dev/null @@ -1,144 +0,0 @@ ---TEST-- -fgetss() tests ---FILE-- -<?php - -$filename = __DIR__."/fgetss.html"; - -$array = array( - "askasdfasdf<b>aaaaaa\n</b>dddddd", - "asdqw<i onClick=\"hello();\">\naaaa<>qqqq", - "aaa<script>function foo() {}</script>qqq", - "asdasd<a\n asdjeje", - "", - "some text \n<b>blah</i>", - "some another text <> hoho </>" - ); - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp)); - var_dump(fgetss($fp)); -} - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp, 10)); - var_dump(fgetss($fp, 10)); -} - -var_dump(fgetss($fp, -10)); -var_dump(fgetss($fp, 0)); -fclose($fp); -var_dump(fgetss($fp, 0)); - -@unlink($filename); - -echo "Done\n"; -?> ---EXPECTF-- -Deprecated: Function fgetss() is deprecated in %s on line %d -string(18) "askasdfasdfaaaaaa -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "dddddd" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "asdqw -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(8) "aaaaqqqq" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(23) "aaafunction foo() {}qqq" - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "asdasd" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(0) "" - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(11) "some text -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(4) "blah" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(24) "some another text hoho " - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "askasdfas" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "dfaaaa" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(5) "asdqw" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(0) "" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(3) "aaa" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(7) "functio" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "asdasd" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(0) "" - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "some text" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(2) " -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "some anot" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "her text " - -Deprecated: Function fgetss() is deprecated in %s on line %d - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d - -Warning: fgetss(): supplied resource is not a valid stream resource in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss1.phpt b/ext/standard/tests/file/fgetss1.phpt deleted file mode 100644 index 55b6adbe6b..0000000000 --- a/ext/standard/tests/file/fgetss1.phpt +++ /dev/null @@ -1,73 +0,0 @@ ---TEST-- -more fgetss() tests ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -$filename = __DIR__."/fgetss1.html"; - -$array = array( - "askasdfasdf<b>aaaaaa\n</b>dddddd", - "asdqw<i onClick=\"hello();\">\naaaa<>qqqq", - "aaa<script>function foo() {}</script>qqq", - "asdasd<a\n asdjeje", - "", - "some text \n<b>blah</i>", - "some another text <> hoho </>" - ); - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp, 1000, "<i>,<b>,<a>")); - var_dump(fgetss($fp)); -} - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp, 10)); - var_dump(fgetss($fp, 10, "<script>,<a>")); -} - -echo "Done\n"; -?> ---CLEAN-- -<?php -$filename = __DIR__."/fgetss1.html"; -unlink($filename); -?> ---EXPECT-- -string(21) "askasdfasdf<b>aaaaaa -" -string(6) "dddddd" -string(28) "asdqw<i onClick="hello();"> -" -string(8) "aaaaqqqq" -string(23) "aaafunction foo() {}qqq" -bool(false) -string(6) "asdasd" -string(0) "" -bool(false) -bool(false) -string(11) "some text -" -string(4) "blah" -string(24) "some another text hoho " -bool(false) -string(9) "askasdfas" -string(6) "dfaaaa" -string(5) "asdqw" -string(0) "" -string(3) "aaa" -string(9) "t>functio" -string(6) "asdasd" -string(0) "" -bool(false) -bool(false) -string(9) "some text" -string(2) " -" -string(9) "some anot" -string(9) "her text " -Done diff --git a/ext/standard/tests/file/fgetss_basic1.phpt b/ext/standard/tests/file/fgetss_basic1.phpt deleted file mode 100644 index 80d1b74f3c..0000000000 --- a/ext/standard/tests/file/fgetss_basic1.phpt +++ /dev/null @@ -1,137 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read modes only ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* test fgetss with all read modes */ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : Basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; - -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} -/* try reading the file opened in different modes of reading */ -$file_modes = array("r","rb", "rt","r+", "r+b", "r+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $filename = __DIR__."/fgetss_basic1.tmp"; - create_file ($filename); //create an empty file - file_put_contents($filename, $string_with_tags); - $file_handle = fopen($filename, $file_modes[$mode_counter]); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - rewind($file_handle); - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : Basic operations *** - --- Testing fgetss() with file opened using r mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using rb mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using rt mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using r+ mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using r+b mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using r+t mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt b/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt deleted file mode 100644 index 68fd7059d0..0000000000 --- a/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt +++ /dev/null @@ -1,218 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only on Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} -$filename = __DIR__."/fgetss_basic2私はガラスを食べられます.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : basic operations *** - --- Testing fgetss() with file opened using w+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_basic2-win32.phpt b/ext/standard/tests/file/fgetss_basic2-win32.phpt deleted file mode 100644 index 9e9ab50788..0000000000 --- a/ext/standard/tests/file/fgetss_basic2-win32.phpt +++ /dev/null @@ -1,218 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only on Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} -$filename = __DIR__."/fgetss_basic2.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : basic operations *** - --- Testing fgetss() with file opened using w+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_basic2.phpt b/ext/standard/tests/file/fgetss_basic2.phpt deleted file mode 100644 index 887a752435..0000000000 --- a/ext/standard/tests/file/fgetss_basic2.phpt +++ /dev/null @@ -1,216 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; - -$filename = __DIR__."/fgetss_basic2.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : basic operations *** - --- Testing fgetss() with file opened using w+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+t mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+t mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+t mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_error.phpt b/ext/standard/tests/file/fgetss_error.phpt deleted file mode 100644 index 13a5399406..0000000000 --- a/ext/standard/tests/file/fgetss_error.phpt +++ /dev/null @@ -1,108 +0,0 @@ ---TEST-- -Test fgetss() function : error conditions ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -echo "*** Testing error conditions ***\n"; -// zero argument -echo "-- Testing fgetss() with zero argument --\n"; -var_dump( fgetss() ); - -// more than expected no. of args -echo "-- Testing fgetss() with more than expected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( fgetss($fp, 100, '<p><a>', $fp) ); - -// invalid length argument -echo "-- Testing fgetss() with invalid length arguments --\n"; -$len = 0; -$allowable_tags = '<p><a>'; -var_dump( fgetss($fp, $len, $allowable_tags) ); -$len = -10; -var_dump( fgetss($fp, $len, $allowable_tags) ); -$len = 1; -var_dump( fgetss($fp, $len, $allowable_tags) ); // return length - 1 always, expect false - -// test invalid arguments : non-resources -echo "-- Testing fgetss() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fgetss() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fgetss($invalid_args[$loop_counter - 1], 10, $allowable_tags) ); -} -// fgetss() on a file handle which is already closed -echo "-- Testing fgetss() with closed/unset file handle --"; -fclose($fp); -var_dump(fgetss($fp,10,$allowable_tags)); - -// fgetss() on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( fgetss(@$file_handle,10)); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing error conditions *** --- Testing fgetss() with zero argument -- - -Warning: fgetss() expects at least 1 parameter, 0 given in %s on line %d -bool(false) --- Testing fgetss() with more than expected number of arguments -- - -Warning: fgetss() expects at most 3 parameters, 4 given in %s on line %d -bool(false) --- Testing fgetss() with invalid length arguments -- - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) -bool(false) --- Testing fgetss() with invalid arguments -- --- Iteration 1 -- - -Warning: fgetss() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fgetss() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fgetss() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fgetss() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fgetss() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fgetss() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Testing fgetss() with closed/unset file handle -- -Warning: fgetss(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fgetss() expects parameter 1 to be resource, null given in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_variation1-win32.phpt b/ext/standard/tests/file/fgetss_variation1-win32.phpt deleted file mode 100644 index 72e19c293f..0000000000 --- a/ext/standard/tests/file/fgetss_variation1-win32.phpt +++ /dev/null @@ -1,192 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - write only modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only on Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgets on files which are opened in non readable modes - w, wb, wt, - a, ab, at, - x, xb, xt -*/ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} - -$filename = __DIR__."/fgetss_variation1.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w","wb", "wt","a", "ab", "at","x","xb","xt"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 , expected : no character should be read --\n"; - var_dump( fgetss($file_handle) ); // expected : no character should be read - var_dump( ftell($file_handle) ); //ensure that file pointer position is not changed - var_dump( feof($file_handle) ); // check if end of file pointer is set - - // close the file - fclose($file_handle); - - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wt mode -- -int(453) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using a mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using ab mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using at mode -- -int(453) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using x mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xt mode -- -int(453) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_variation1.phpt b/ext/standard/tests/file/fgetss_variation1.phpt deleted file mode 100644 index e1a202388c..0000000000 --- a/ext/standard/tests/file/fgetss_variation1.phpt +++ /dev/null @@ -1,188 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - write only modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgets on files which are opened in non readable modes - w, wb, wt, - a, ab, at, - x, xb, xt -*/ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = __DIR__."/fgetss_variation1.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w","wb", "wt","a", "ab", "at","x","xb","xt"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 , expected : no character should be read --\n"; - var_dump( fgetss($file_handle) ); // expected : no character should be read - var_dump( ftell($file_handle) ); //ensure that file pointer position is not changed - var_dump( feof($file_handle) ); // check if end of file pointer is set - - // close the file - fclose($file_handle); - - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wt mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using a mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using ab mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using at mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using x mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xt mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- - -Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d -bool(false) -int(0) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_variation2.phpt b/ext/standard/tests/file/fgetss_variation2.phpt deleted file mode 100644 index 7c581793c2..0000000000 --- a/ext/standard/tests/file/fgetss_variation2.phpt +++ /dev/null @@ -1,436 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read modes ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -// include the common file related test functions -include ("file.inc"); - -/*Test fgetss() with all read modes , reading line by line with allowable tags: <test>, <html>, <?> */ - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this is the text containing \r character -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = __DIR__."/fgetss_variation2.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("r","rb", "rt","r+", "r+b", "r+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - create_file ($filename); //create an empty file - file_put_contents($filename, $string_with_tags); - $file_handle = fopen($filename, $file_modes[$mode_counter]); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* rewind the file and read the file line by line with allowable tags */ - echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n"; - rewind($file_handle); - $line = 1; - while( !feof($file_handle) ) { - echo "-- Line $line --\n"; $line++; - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // check the file pointer position - var_dump( feof($file_handle) ); // check if eof reached - } - - // close the file - fclose($file_handle); - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using r mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using rb mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using rt mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using r+ mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using r+b mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using r+t mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation3-win32.phpt b/ext/standard/tests/file/fgetss_variation3-win32.phpt deleted file mode 100644 index f53d76ce27..0000000000 --- a/ext/standard/tests/file/fgetss_variation3-win32.phpt +++ /dev/null @@ -1,573 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t - reading line by line with allowable tags: <test>, <html>, <?> -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} - -$filename = __DIR__."/fgetss_variation3.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - rewind($file_handle); - var_dump( ftell($file_handle) ); - var_dump( filesize($filename) ); - var_dump( feof($file_handle) ); - - /* rewind the file and read the file line by line with allowable tags */ - echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n"; - $line = 1; - while( !feof($file_handle) ) { - echo "-- Line $line --\n"; $line++; - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // check the file pointer position - var_dump( feof($file_handle) ); // check if eof reached - } - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(0) -int(453) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(0) -int(453) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(0) -int(453) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation3.phpt b/ext/standard/tests/file/fgetss_variation3.phpt deleted file mode 100644 index d4120f7fc9..0000000000 --- a/ext/standard/tests/file/fgetss_variation3.phpt +++ /dev/null @@ -1,569 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t - reading line by line with allowable tags: <test>, <html>, <?> -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = __DIR__."/fgetss_variation3.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - rewind($file_handle); - var_dump( ftell($file_handle) ); - var_dump( filesize($filename) ); - var_dump( feof($file_handle) ); - - /* rewind the file and read the file line by line with allowable tags */ - echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n"; - $line = 1; - while( !feof($file_handle) ) { - echo "-- Line $line --\n"; $line++; - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // check the file pointer position - var_dump( feof($file_handle) ); // check if eof reached - } - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation4.phpt b/ext/standard/tests/file/fgetss_variation4.phpt deleted file mode 100644 index 585f277e72..0000000000 --- a/ext/standard/tests/file/fgetss_variation4.phpt +++ /dev/null @@ -1,170 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read modes, file pointer at EOF ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) == "WIN") - die("skip not for Windows"); -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this is the text containing \r character -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = __DIR__."/fgetss_variation4.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("r","rb", "rt","r+", "r+b", "r+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - create_file ($filename); //create an empty file - file_put_contents($filename, $string_with_tags); - $file_handle = fopen($filename, $file_modes[$mode_counter]); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - echo "-- Reading when file pointer points to EOF --\n"; - var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end - var_dump( ftell($file_handle) ); //ensure file pointer at end - var_dump( fgetss($file_handle) ); // try to read - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // now file is at the end try reading with length and allowable tags,expecting false - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // close the file - fclose($file_handle); - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using r mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using rb mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using rt mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using r+ mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using r+b mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using r+t mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation5-win32.phpt b/ext/standard/tests/file/fgetss_variation5-win32.phpt deleted file mode 100644 index 035186fd09..0000000000 --- a/ext/standard/tests/file/fgetss_variation5-win32.phpt +++ /dev/null @@ -1,222 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes, file pointer at EOF ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} - -$filename = __DIR__."/fgetss_variation5.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - echo "-- Reading when file pointer points to EOF --\n"; - var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end - var_dump( ftell($file_handle) ); //ensure file pointer at end - var_dump( fgetss($file_handle) ); // try to read - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // now file is at the end try reading with length and allowable tags,expecting false - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(453) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(453) -bool(false) -int(453) -bool(true) -bool(false) -int(453) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(453) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(453) -bool(false) -int(453) -bool(true) -bool(false) -int(453) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(453) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(453) -bool(false) -int(453) -bool(true) -bool(false) -int(453) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation5.phpt b/ext/standard/tests/file/fgetss_variation5.phpt deleted file mode 100644 index 928fdeadf5..0000000000 --- a/ext/standard/tests/file/fgetss_variation5.phpt +++ /dev/null @@ -1,219 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes, file pointer at EOF ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = __DIR__."/fgetss_variation5.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - echo "-- Reading when file pointer points to EOF --\n"; - var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end - var_dump( ftell($file_handle) ); //ensure file pointer at end - var_dump( fgetss($file_handle) ); // try to read - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // now file is at the end try reading with length and allowable tags,expecting false - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) -Done diff --git a/ext/standard/tests/file/file_error.phpt b/ext/standard/tests/file/file_error.phpt index d932966ee5..cd714cca0b 100644 --- a/ext/standard/tests/file/file_error.phpt +++ b/ext/standard/tests/file/file_error.phpt @@ -8,14 +8,10 @@ Test file() function : error conditions Returns the file in an array */ $file_path = __DIR__; -echo "\n*** Testing error conditions ***"; +echo "\n*** Testing error conditions ***\n"; $file_handle = fopen($file_path."/file.tmp", "w"); -var_dump( file() ); // Zero No. of args $filename = $file_path."/file.tmp"; -var_dump( file($filename, $filename, $filename, $filename) ); // more than expected number of arguments - -var_dump( file($filename, "INCORRECT_FLAG", NULL) ); // Incorrect flag var_dump( file($filename, 10, NULL) ); // Incorrect flag var_dump( file("temp.tmp") ); // non existing filename @@ -30,14 +26,6 @@ unlink($file_path."/file.tmp"); ?> --EXPECTF-- *** Testing error conditions *** -Warning: file() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: file() expects at most 3 parameters, 4 given in %s on line %d -NULL - -Warning: file() expects parameter 2 to be int, string given in %s on line %d -NULL array(0) { } diff --git a/ext/standard/tests/file/file_get_contents_error.phpt b/ext/standard/tests/file/file_get_contents_error.phpt index d4c6f16529..9757b3be2a 100644 --- a/ext/standard/tests/file/file_get_contents_error.phpt +++ b/ext/standard/tests/file/file_get_contents_error.phpt @@ -17,14 +17,8 @@ include($file_path."/file.inc"); echo "\n-- Testing with Non-existing file --\n"; print( file_get_contents("/no/such/file/or/dir") ); -echo "\n-- Testing No.of arguments less than expected --\n"; -print( file_get_contents() ); - -echo "\n-- Testing No.of arguments greater than expected --\n"; - create_files($file_path, 1, "text", 0755, 100, "w", "file", 1, "byte"); $file_handle = fopen($file_path."/file_put_contents_error.tmp", "w"); -print( file_get_contents($file_path."/file1.tmp", false, $file_handle, 1, 2, "extra_argument") ); echo "\n-- Testing for invalid negative maxlen values --"; var_dump( file_get_contents($file_path."/file1.tmp", FALSE, $file_handle, 0, -5) ); @@ -52,14 +46,6 @@ if(file_exists($file_path."/file_put_contents1.tmp")) { Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d --- Testing No.of arguments less than expected -- - -Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d - --- Testing No.of arguments greater than expected -- - -Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d - -- Testing for invalid negative maxlen values -- Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d bool(false) diff --git a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt index f34e6ef418..a50317e8db 100644 --- a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt +++ b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt @@ -18,15 +18,7 @@ $file_path = __DIR__; echo "\n-- Testing with Non-existing file --\n"; print( file_get_contents("/no/such/file/or/dir") ); -echo "\n-- Testing No.of arguments less than expected --\n"; -print( file_get_contents() ); -print( file_put_contents() ); -print( file_put_contents($file_path."/".__FILE__) ); - $file_handle = fopen($file_path."/file_put_contents.tmp", "w"); -echo "\n-- Testing No.of arguments greater than expected --\n"; -print( file_put_contents("abc.tmp", 12345, 1, $file_handle, "extra_argument") ); -print( file_get_contents("abc.tmp", false, $file_handle, 1, 2, "extra_argument") ); echo "\n-- Testing for invalid negative maxlen values --"; file_put_contents($file_path."/file_put_contents1.tmp", "Garbage data in the file"); @@ -50,20 +42,6 @@ unlink($file_path."/file_put_contents1.tmp"); Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d --- Testing No.of arguments less than expected -- - -Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d - -Warning: file_put_contents() expects at least 2 parameters, 0 given in %s on line %d - -Warning: file_put_contents() expects at least 2 parameters, 1 given in %s on line %d - --- Testing No.of arguments greater than expected -- - -Warning: file_put_contents() expects at most 4 parameters, 5 given in %s on line %d - -Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d - -- Testing for invalid negative maxlen values -- Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d bool(false) diff --git a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt index 4928404098..25060ea0cf 100644 --- a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt @@ -38,7 +38,11 @@ $names_arr = array( foreach($names_arr as $key =>$value) { echo "\n-- Filename: $key --\n"; - var_dump(file_get_contents($value)); + try { + var_dump(file_get_contents($value)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } ?> @@ -77,14 +81,10 @@ Warning: file_get_contents( ): failed to open stream: Permission denied in %s on bool(false) -- Filename: \0 -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, string given -- Filename: array() -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/file_get_contents_variation8.phpt b/ext/standard/tests/file/file_get_contents_variation8.phpt index 97a3495d54..f826ad60c2 100644 --- a/ext/standard/tests/file/file_get_contents_variation8.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8.phpt @@ -37,7 +37,11 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - var_dump(file_get_contents($names_arr[$i])); + try { + var_dump(file_get_contents($names_arr[$i])); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } echo "\n*** Done ***\n"; @@ -69,13 +73,9 @@ bool(false) Warning: file_get_contents( ): failed to open stream: No such file or directory in %s on line %d bool(false) -- Iteration 6 -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, array given -- Iteration 8 -- Warning: file_get_contents(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/file_put_contents.phpt b/ext/standard/tests/file/file_put_contents.phpt index be2a6ca0ac..f9dc6d1b8e 100644 --- a/ext/standard/tests/file/file_put_contents.phpt +++ b/ext/standard/tests/file/file_put_contents.phpt @@ -11,22 +11,27 @@ $file = __DIR__."/file_put_contents.txt"; $context = stream_context_create(); -var_dump(file_put_contents($file, $context)); +try { + var_dump(file_put_contents($file, $context)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(file_put_contents($file, new stdClass)); var_dump(file_put_contents($file, new foo)); $fp = fopen($file, "r"); -var_dump(file_put_contents($file, "string", 0, $fp)); +try { + var_dump(file_put_contents($file, "string", 0, $fp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} @unlink($file); echo "Done\n"; ?> ---EXPECTF-- -Warning: file_put_contents(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +--EXPECT-- +file_put_contents(): supplied resource is not a valid stream resource bool(false) int(15) - -Warning: file_put_contents(): supplied resource is not a valid Stream-Context resource in %s on line %d -int(6) +file_put_contents(): supplied resource is not a valid Stream-Context resource Done diff --git a/ext/standard/tests/file/file_put_contents_variation2.phpt b/ext/standard/tests/file/file_put_contents_variation2.phpt index ae56486d5f..5e18ce1948 100644 --- a/ext/standard/tests/file/file_put_contents_variation2.phpt +++ b/ext/standard/tests/file/file_put_contents_variation2.phpt @@ -13,8 +13,8 @@ Dave Kelsey <d_kelsey@uk.ibm.com> echo "*** Testing file_put_contents() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt index 095980b536..4c03581c48 100644 --- a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt @@ -35,14 +35,18 @@ $names_arr = array( ); foreach($names_arr as $key =>$value) { - echo "\n-- Filename: $key --\n"; - $res = file_put_contents($value, "Some data"); - if ($res !== false && $res != null) { - echo "$res bytes written to: $value\n"; - unlink($value); - } else { - echo "Failed to write data to: $key\n"; - } + echo "\n-- Filename: $key --\n"; + try { + $res = file_put_contents($value, "Some data"); + if ($res !== false && $res != null) { + echo "$res bytes written to: $value\n"; + unlink($value); + } else { + echo "Failed to write data to: $key\n"; + } + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> @@ -77,14 +81,10 @@ Warning: file_put_contents( ): failed to open stream: Permission denied in %s on Failed to write data to: " " -- Filename: \0 -- - -Warning: file_put_contents() expects parameter 1 to be a valid path, string given in %s on line %d -Failed to write data to: \0 +file_put_contents() expects parameter 1 to be a valid path, string given -- Filename: array() -- - -Warning: file_put_contents() expects parameter 1 to be a valid path, array given in %s on line %d -Failed to write data to: array() +file_put_contents() expects parameter 1 to be a valid path, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/file_put_contents_variation8.phpt b/ext/standard/tests/file/file_put_contents_variation8.phpt Binary files differindex f0161dca57..8d2c148598 100644 --- a/ext/standard/tests/file/file_put_contents_variation8.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8.phpt diff --git a/ext/standard/tests/file/filegroup_error.phpt b/ext/standard/tests/file/filegroup_error.phpt index e32711cd5b..e602f3441f 100644 --- a/ext/standard/tests/file/filegroup_error.phpt +++ b/ext/standard/tests/file/filegroup_error.phpt @@ -15,10 +15,6 @@ var_dump( filegroup("/no/such/file/dir") ); var_dump( filegroup("string") ); var_dump( filegroup(100) ); -/* Invalid no.of arguments */ -var_dump( filegroup() ); // args < expected -var_dump( filegroup("/no/such/file", "root") ); // args > expected - echo "\n*** Done ***\n"; ?> --EXPECTF-- @@ -33,10 +29,4 @@ bool(false) Warning: filegroup(): stat failed for 100 in %s on line %d bool(false) -Warning: filegroup() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filegroup() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/filegroup_variation2.phpt b/ext/standard/tests/file/filegroup_variation2.phpt index 71def66e29..ee232e4214 100644 --- a/ext/standard/tests/file/filegroup_variation2.phpt +++ b/ext/standard/tests/file/filegroup_variation2.phpt @@ -11,7 +11,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com> /* Testing filegroup() with invalid arguments -int, float, bool, NULL, resource */ $file_path = __DIR__; -$file_handle = fopen($file_path."/filegroup_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -22,7 +21,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -34,7 +32,6 @@ foreach( $filenames as $filename ) { var_dump( filegroup($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -58,9 +55,6 @@ bool(false) bool(false) bool(false) -Warning: filegroup() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: filegroup(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/filegroup_variation3.phpt b/ext/standard/tests/file/filegroup_variation3.phpt index a43a54da0d..274f12bb70 100644 --- a/ext/standard/tests/file/filegroup_variation3.phpt +++ b/ext/standard/tests/file/filegroup_variation3.phpt @@ -39,7 +39,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( filegroup( $file_path."/".$file ) ); + try { + var_dump( filegroup( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -74,12 +78,8 @@ bool(false) Warning: filegroup(): stat failed for %s/filegroup_variation3/filegroup*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +filegroup() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +filegroup() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/fileinode_error.phpt b/ext/standard/tests/file/fileinode_error.phpt index 462ab62367..d080467f04 100644 --- a/ext/standard/tests/file/fileinode_error.phpt +++ b/ext/standard/tests/file/fileinode_error.phpt @@ -16,12 +16,6 @@ var_dump( fileinode("/no/such/file/dir") ); var_dump( fileinode("string") ); var_dump( fileinode(100) ); -/* No.of arguments less than expected */ -var_dump( fileinode() ); - -/* No.of arguments greater than expected */ -var_dump( fileinode(__FILE__, "string") ); - echo "\n*** Done ***"; --EXPECTF-- *** Testing error conditions of fileinode() *** @@ -34,10 +28,4 @@ bool(false) Warning: fileinode(): stat failed for 100 in %s on line 14 bool(false) -Warning: fileinode() expects exactly 1 parameter, 0 given in %s on line 17 -NULL - -Warning: fileinode() expects exactly 1 parameter, 2 given in %s on line 20 -NULL - *** Done *** diff --git a/ext/standard/tests/file/fileinode_variation2.phpt b/ext/standard/tests/file/fileinode_variation2.phpt index 3ccfc76476..f86a0b89a6 100644 --- a/ext/standard/tests/file/fileinode_variation2.phpt +++ b/ext/standard/tests/file/fileinode_variation2.phpt @@ -12,7 +12,6 @@ Description: Returns the inode number of the file, or FALSE in case of an error. /* Testing fileinode() with invalid arguments -int, float, bool, NULL, resource */ $file_path = __DIR__; -$file_handle = fopen($file_path."/fileinode_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -23,7 +22,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -35,7 +33,6 @@ foreach( $filenames as $filename ) { var_dump( fileinode($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -59,9 +56,6 @@ bool(false) bool(false) bool(false) -Warning: fileinode() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: fileinode(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/fileinode_variation3.phpt b/ext/standard/tests/file/fileinode_variation3.phpt index 72dfcbdc55..16f67b0676 100644 --- a/ext/standard/tests/file/fileinode_variation3.phpt +++ b/ext/standard/tests/file/fileinode_variation3.phpt @@ -40,7 +40,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( fileinode( $file_path."/".$file ) ); + try { + var_dump( fileinode( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -75,12 +79,8 @@ bool(false) Warning: fileinode(): stat failed for %s/fileinode_variation3/fileinode*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileinode() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileinode() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/fileowner_error.phpt b/ext/standard/tests/file/fileowner_error.phpt index 967a541cc0..807c09f0f0 100644 --- a/ext/standard/tests/file/fileowner_error.phpt +++ b/ext/standard/tests/file/fileowner_error.phpt @@ -15,10 +15,6 @@ var_dump( fileowner("/no/such/file/dir") ); var_dump( fileowner("string") ); var_dump( fileowner(100) ); -/* Invalid no.of arguments */ -var_dump( fileowner() ); // args < expected -var_dump( fileowner("/no/such/file", "root") ); // args > expected - echo "\n*** Done ***\n"; ?> --EXPECTF-- @@ -33,10 +29,4 @@ bool(false) Warning: fileowner(): stat failed for 100 in %s on line %d bool(false) -Warning: fileowner() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: fileowner() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/fileowner_variation2.phpt b/ext/standard/tests/file/fileowner_variation2.phpt index 8a943e549e..b6d5afaee8 100644 --- a/ext/standard/tests/file/fileowner_variation2.phpt +++ b/ext/standard/tests/file/fileowner_variation2.phpt @@ -12,7 +12,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com> /* Testing fileowner() with invalid arguments -int, float, bool, NULL, resource */ $file_path = __DIR__; -$file_handle = fopen($file_path."/fileowner_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -23,7 +22,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -35,7 +33,6 @@ foreach( $filenames as $filename ) { var_dump( fileowner($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -59,9 +56,6 @@ bool(false) bool(false) bool(false) -Warning: fileowner() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: fileowner(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/fileowner_variation3.phpt b/ext/standard/tests/file/fileowner_variation3.phpt index e5d8852776..01d2da2445 100644 --- a/ext/standard/tests/file/fileowner_variation3.phpt +++ b/ext/standard/tests/file/fileowner_variation3.phpt @@ -40,7 +40,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( fileowner( $file_path."/".$file ) ); + try { + var_dump( fileowner( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -75,12 +79,8 @@ bool(false) Warning: fileowner(): stat failed for %s/fileowner_variation3/fileowner*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: fileowner() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileowner() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: fileowner() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileowner() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/fileperms_variation2.phpt b/ext/standard/tests/file/fileperms_variation2.phpt index c8d62fd5bd..e626eab361 100644 --- a/ext/standard/tests/file/fileperms_variation2.phpt +++ b/ext/standard/tests/file/fileperms_variation2.phpt @@ -11,7 +11,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com> /* Testing fileperms() with invalid arguments -int, float, bool, NULL, resource */ $file_path = __DIR__; -$file_handle = fopen($file_path."/fileperms_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -22,7 +21,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -34,7 +32,6 @@ foreach( $filenames as $filename ) { var_dump( fileperms($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -58,9 +55,6 @@ bool(false) bool(false) bool(false) -Warning: fileperms() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: fileperms(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/fileperms_variation3.phpt b/ext/standard/tests/file/fileperms_variation3.phpt index 6a4aacdc6d..1588ee67fe 100644 --- a/ext/standard/tests/file/fileperms_variation3.phpt +++ b/ext/standard/tests/file/fileperms_variation3.phpt @@ -39,7 +39,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( fileperms( $file_path."/".$file ) ); + try { + var_dump( fileperms( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -74,12 +78,8 @@ bool(false) Warning: fileperms(): stat failed for %s/fileperms_variation3/fileperms*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: fileperms() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileperms() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: fileperms() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileperms() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/filesize_error.phpt b/ext/standard/tests/file/filesize_error.phpt index 9f721ff921..5ad8ee99ca 100644 --- a/ext/standard/tests/file/filesize_error.phpt +++ b/ext/standard/tests/file/filesize_error.phpt @@ -14,13 +14,6 @@ echo "*** Testing filesize(): error conditions ***"; var_dump( filesize("/no/such/file") ); var_dump( filesize("/no/such/dir") ); -/* No.of arguments less than expected */ -var_dump( filesize() ); - -/* No.of arguments greater than expected */ -var_dump( filesize(__FILE__, 2000) ); -echo "\n"; - echo "*** Done ***\n"; ?> --EXPECTF-- @@ -30,11 +23,4 @@ bool(false) Warning: filesize(): stat failed for /no/such/dir in %s on line %d bool(false) - -Warning: filesize() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filesize() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/filetype_error.phpt b/ext/standard/tests/file/filetype_error.phpt index b49a5286c6..a34671d9b0 100644 --- a/ext/standard/tests/file/filetype_error.phpt +++ b/ext/standard/tests/file/filetype_error.phpt @@ -16,12 +16,6 @@ print( filetype("/no/such/file/dir") ); print( filetype("string") ); print( filetype(100) ); -/* No.of args less than expected */ -print( filetype() ); - -/* No.of args greater than expected */ -print( filetype("file", "file") ); - echo "\n*** Done ***\n"; ?> --EXPECTF-- @@ -32,8 +26,4 @@ Warning: filetype(): Lstat failed for string in %s on line %d Warning: filetype(): Lstat failed for 100 in %s on line %d -Warning: filetype() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: filetype() expects exactly 1 parameter, 2 given in %s on line %d - *** Done *** diff --git a/ext/standard/tests/file/flock.phpt b/ext/standard/tests/file/flock.phpt index 43f9112887..48cba22729 100644 --- a/ext/standard/tests/file/flock.phpt +++ b/ext/standard/tests/file/flock.phpt @@ -5,13 +5,14 @@ flock() tests $file = __DIR__."/flock.dat"; -var_dump(flock()); -var_dump(flock("", "", $var)); - $fp = fopen($file, "w"); fclose($fp); -var_dump(flock($fp, LOCK_SH|LOCK_NB)); +try { + var_dump(flock($fp, LOCK_SH|LOCK_NB)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} $fp = fopen($file, "w"); @@ -41,14 +42,7 @@ $file = __DIR__."/flock.dat"; unlink($file); ?> --EXPECTF-- -Warning: flock() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: flock() expects parameter 1 to be resource, string given in %s on line %d -NULL - -Warning: flock(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +flock(): supplied resource is not a valid stream resource bool(true) bool(true) bool(true) diff --git a/ext/standard/tests/file/flock_error.phpt b/ext/standard/tests/file/flock_error.phpt index 26a8b3d01f..470c6a536f 100644 --- a/ext/standard/tests/file/flock_error.phpt +++ b/ext/standard/tests/file/flock_error.phpt @@ -29,7 +29,11 @@ $operations = array( $i = 0; foreach($operations as $operation) { echo "\n--- Iteration $i ---"; - var_dump(flock($fp, $operation)); + try { + var_dump(flock($fp, $operation)); + } catch (TypeError $e) { + echo "\n", $e->getMessage(), "\n"; + } $i++; } @@ -37,16 +41,11 @@ foreach($operations as $operation) { /* Invalid arguments */ $fp = fopen($file, "w"); fclose($fp); -var_dump(flock($fp, LOCK_SH|LOCK_NB)); - -var_dump(flock("", "", $var)); - -/* No.of args leass than expected */ -var_dump(flock()); -var_dump(flock($fp)); - -/* No.of args greater than expected */ -var_dump(flock($fp, "", $var, "")); +try { + var_dump(flock($fp, LOCK_SH|LOCK_NB)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n*** Done ***\n"; ?> @@ -75,38 +74,19 @@ Warning: flock(): Illegal operation argument in %s on line %d bool(false) --- Iteration 4 --- -Warning: flock() expects parameter 2 to be int, array given in %s on line %d -NULL +flock() expects parameter 2 to be int, array given --- Iteration 5 --- -Warning: flock() expects parameter 2 to be int, array given in %s on line %d -NULL +flock() expects parameter 2 to be int, array given --- Iteration 6 --- -Warning: flock() expects parameter 2 to be int, string given in %s on line %d -NULL +flock() expects parameter 2 to be int, string given --- Iteration 7 --- -Warning: flock() expects parameter 2 to be int, string given in %s on line %d -NULL +flock() expects parameter 2 to be int, string given --- Iteration 8 --- -Warning: flock() expects parameter 2 to be int, string given in %s on line %d -NULL - -Warning: flock(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: flock() expects parameter 1 to be resource, string given in %s on line %d -NULL - -Warning: flock() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: flock() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: flock() expects at most 3 parameters, 4 given in %s on line %d -NULL +flock() expects parameter 2 to be int, string given +flock(): supplied resource is not a valid stream resource *** Done *** diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt index 919e80eec0..4318a844e8 100644 --- a/ext/standard/tests/file/fnmatch_variation.phpt +++ b/ext/standard/tests/file/fnmatch_variation.phpt @@ -66,7 +66,11 @@ $pattern_arr = array( for( $i = 0; $i<count($pattern_arr); $i++ ) { echo "-- Iteration $i --\n"; - var_dump( fnmatch($pattern_arr[$i], $file_name) ); + try { + var_dump( fnmatch($pattern_arr[$i], $file_name) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } unlink($file_name); @@ -78,7 +82,11 @@ function match( $pattern, $string ) { for( $i = 0; $i<count($pattern); $i++ ) { echo "-- Iteration $i --\n"; for( $j = 0; $j<count($string); $j++ ) { - var_dump( fnmatch($pattern[$i], $string[$j]) ); + try { + var_dump( fnmatch($pattern[$i], $string[$j]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } } } @@ -134,7 +142,7 @@ match($null_arr, $null_arr); echo "\n*** Done ***\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing fnmatch() with file and various patterns *** -- Iteration 0 -- bool(true) @@ -183,13 +191,9 @@ bool(false) -- Iteration 22 -- bool(false) -- Iteration 23 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 24 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 25 -- bool(false) -- Iteration 26 -- @@ -263,84 +267,44 @@ bool(true) --- With Strings --- -- Iteration 0 -- bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) -- Iteration 1 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 2 -- bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) -- Iteration 3 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 4 -- bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) bool(false) -- Iteration 5 -- bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) @@ -441,64 +405,42 @@ bool(true) bool(true) bool(true) bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(false) -- Iteration 1 -- bool(true) bool(true) bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(false) -- Iteration 2 -- bool(true) bool(true) bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(false) -- Iteration 3 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 4 -- bool(false) bool(false) bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) bool(false) -- Iteration 5 -- bool(false) bool(false) bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) diff --git a/ext/standard/tests/file/fread_error.phpt b/ext/standard/tests/file/fread_error.phpt index 1c4068cd97..f51f24c754 100644 --- a/ext/standard/tests/file/fread_error.phpt +++ b/ext/standard/tests/file/fread_error.phpt @@ -14,14 +14,6 @@ echo "*** Testing error conditions ***\n"; $filename = __FILE__; $file_handle = fopen($filename, "r"); -// zero argument -echo "-- Testing fread() with zero argument --\n"; -var_dump( fread() ); - -// more than expected no. of args -echo "-- Testing fread() with more than expected number of arguments --\n"; -var_dump( fread($file_handle, 10, $file_handle) ); - // invalid length argument echo "-- Testing fread() with invalid length arguments --\n"; $len = 0; @@ -29,44 +21,9 @@ var_dump( fread($file_handle, $len) ); $len = -10; var_dump( fread($file_handle, $len) ); -// test invalid arguments : non-resources -echo "-- Testing fread() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fread() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fread($invalid_args[$loop_counter - 1], 10) ); -} - -// fwrite() on a file handle which is already closed -echo "-- Testing fwrite() with closed/unset file handle --\n"; -fclose($file_handle); -var_dump( fread($file_handle,$file_content_type) ); - -// fwrite on a file handle which is unset -$fp = fopen($filename, "r"); -unset($fp); //unset file handle -var_dump( fread(@$fp,10) ); -var_dump( fclose(@$fp) ); - echo "Done\n"; --EXPECTF-- *** Testing error conditions *** --- Testing fread() with zero argument -- - -Warning: fread() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) --- Testing fread() with more than expected number of arguments -- - -Warning: fread() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) -- Testing fread() with invalid length arguments -- Warning: fread(): Length parameter must be greater than 0 in %s on line %d @@ -74,41 +31,4 @@ bool(false) Warning: fread(): Length parameter must be greater than 0 in %s on line %d bool(false) --- Testing fread() with invalid arguments -- --- Iteration 1 -- - -Warning: fread() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fread() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fread() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fread() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fread() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fread() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Testing fwrite() with closed/unset file handle -- - -Notice: Undefined variable: file_content_type in %s on line %d - -Warning: fread(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fread() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fscanf.phpt b/ext/standard/tests/file/fscanf.phpt index 7a5a70070e..343138d002 100644 --- a/ext/standard/tests/file/fscanf.phpt +++ b/ext/standard/tests/file/fscanf.phpt @@ -5,10 +5,6 @@ fscanf() tests $filename = __DIR__."/fscanf.dat"; -var_dump(fscanf()); -var_dump(fscanf(array())); -var_dump(fscanf(array(), array())); - file_put_contents($filename, "data"); $fp = fopen($filename, "rt"); @@ -64,14 +60,6 @@ $filename = __DIR__."/fscanf.dat"; unlink($filename); ?> --EXPECTF-- -Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: fscanf() expects parameter 1 to be resource, array given in %s on line %d -NULL int(0) NULL int(1) diff --git a/ext/standard/tests/file/fscanf_error.phpt b/ext/standard/tests/file/fscanf_error.phpt index ea6a91e33d..1df1a699cb 100644 --- a/ext/standard/tests/file/fscanf_error.phpt +++ b/ext/standard/tests/file/fscanf_error.phpt @@ -17,18 +17,12 @@ if ($file_handle == false) fwrite($file_handle, "hello world"); fclose($file_handle); -// zero argument -var_dump( fscanf() ); - -// single argument -$file_handle = fopen($filename, 'r'); -if ($file_handle == false) - exit("Error:failed to open file $filename"); -var_dump( fscanf($file_handle) ); -fclose($file_handle); - // invalid file handle -var_dump( fscanf($file_handle, "%s") ); +try { + var_dump( fscanf($file_handle, "%s") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // number of formats in format strings not matching the no of variables $file_handle = fopen($filename, 'r'); @@ -38,7 +32,7 @@ var_dump( fscanf($file_handle, "%d%s%f", $int_var, $string_var) ); fclose($file_handle); // different invalid format strings -$invalid_formats = array( $undefined_var, undefined_constant, +$invalid_formats = array( $undefined_var, "%", "%h", "%.", "%d%m" ); @@ -62,24 +56,12 @@ unlink($filename); ?> --EXPECTF-- *** Testing fscanf() for error conditions *** - -Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: fscanf(): supplied resource is not a valid File-Handle resource in %s on line %d -bool(false) +fscanf(): supplied resource is not a valid File-Handle resource Warning: fscanf(): Different numbers of variable names and field specifiers in %s on line %d int(-1) Notice: Undefined variable: undefined_var in %s on line %d - -Warning: Use of undefined constant undefined_constant - assumed 'undefined_constant' (this will throw an Error in a future version of PHP) in %s on line %d -array(0) { -} array(0) { } diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt index 9c1b3a822d..cd58c30f20 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt @@ -14,86 +14,21 @@ Test fseek(), ftell() & rewind() functions : error conditions - fseek() */ echo "*** Testing fseek() : error conditions ***\n"; -// zero argument -echo "-- Testing fseek() with zero argument --\n"; -var_dump( fseek() ); - -// unexpected no. of args -echo "-- Testing fseek() with unexpected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( fseek($fp) ); -var_dump( fseek($fp, 10, $fp,10) ); - -// test invalid arguments : non-resources -echo "-- Testing fseek() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass -); -/* loop to test fseek() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fseek($invalid_args[$loop_counter - 1], 10) ); -} // fseek() on a file handle which is already closed -echo "-- Testing fseek() with closed/unset file handle --"; +echo "-- Testing fseek() with closed/unset file handle --\n"; +$fp = fopen(__FILE__, "r"); fclose($fp); -var_dump(fseek($fp,10)); - -// fseek() on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( fseek(@$file_handle,10)); +try { + var_dump(fseek($fp,10)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing fseek() : error conditions *** --- Testing fseek() with zero argument -- - -Warning: fseek() expects at least 2 parameters, 0 given in %s on line %d -bool(false) --- Testing fseek() with unexpected number of arguments -- - -Warning: fseek() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: fseek() expects at most 3 parameters, 4 given in %s on line %d -bool(false) --- Testing fseek() with invalid arguments -- --- Iteration 1 -- - -Warning: fseek() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fseek() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fseek() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fseek() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fseek() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fseek() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing fseek() with closed/unset file handle -- -Warning: fseek(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fseek() expects parameter 1 to be resource, null given in %s on line %d -bool(false) +fseek(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt index 8835046f6c..45f1298951 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt @@ -14,82 +14,21 @@ Test fseek(), ftell() & rewind() functions : error conditions - ftell() */ echo "*** Testing ftell() : error conditions ***\n"; -// zero argument -echo "-- Testing ftell() with zero argument --\n"; -var_dump( ftell() ); - -// more than expected no. of args -echo "-- Testing ftell() with more than expected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( ftell($fp, 10) ); - -// test invalid arguments : non-resources -echo "-- Testing ftell() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test ftell with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( ftell($invalid_args[$loop_counter - 1]) ); -} // ftell on a file handle which is already closed -echo "-- Testing ftell with closed/unset file handle --"; +echo "-- Testing ftell with closed/unset file handle --\n"; +$fp = fopen(__FILE__, "r"); fclose($fp); -var_dump(ftell($fp)); - -// ftell on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( ftell(@$file_handle) ); +try { + var_dump(ftell($fp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing ftell() : error conditions *** --- Testing ftell() with zero argument -- - -Warning: ftell() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) --- Testing ftell() with more than expected number of arguments -- - -Warning: ftell() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) --- Testing ftell() with invalid arguments -- --- Iteration 1 -- - -Warning: ftell() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: ftell() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: ftell() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: ftell() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: ftell() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: ftell() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing ftell with closed/unset file handle -- -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: ftell() expects parameter 1 to be resource, null given in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt index 0b94bcffc7..e698bca463 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt @@ -14,82 +14,21 @@ Test fseek(), ftell() & rewind() functions : error conditions - rewind() */ echo "*** Testing rewind() : error conditions ***\n"; -// zero argument -echo "-- Testing rewind() with zero argument --\n"; -var_dump( rewind() ); - -// more than expected no. of args -echo "-- Testing rewind() with more than expected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( rewind($fp, 10) ); - -// test invalid arguments : non-resources -echo "-- Testing rewind() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test rewind with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( rewind($invalid_args[$loop_counter - 1]) ); -} // rewind on a file handle which is already closed -echo "-- Testing rewind() with closed/unset file handle --"; +echo "-- Testing rewind() with closed/unset file handle --\n"; +$fp = fopen(__FILE__, "r"); fclose($fp); -var_dump(rewind($fp)); - -// rewind on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( rewind(@$file_handle) ); +try { + var_dump(rewind($fp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing rewind() : error conditions *** --- Testing rewind() with zero argument -- - -Warning: rewind() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) --- Testing rewind() with more than expected number of arguments -- - -Warning: rewind() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) --- Testing rewind() with invalid arguments -- --- Iteration 1 -- - -Warning: rewind() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: rewind() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: rewind() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: rewind() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: rewind() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: rewind() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing rewind() with closed/unset file handle -- -Warning: rewind(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: rewind() expects parameter 1 to be resource, null given in %s on line %d -bool(false) +rewind(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/fstat.phpt b/ext/standard/tests/file/fstat.phpt index 415124046e..b48b06cfe5 100644 --- a/ext/standard/tests/file/fstat.phpt +++ b/ext/standard/tests/file/fstat.phpt @@ -8,7 +8,11 @@ $filename = __DIR__."/fstat.dat"; $fp = fopen($filename, "w"); var_dump(fstat($fp)); fclose($fp); -var_dump(fstat($fp)); +try { + var_dump(fstat($fp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} @unlink($filename); echo "Done\n"; @@ -68,7 +72,5 @@ array(26) { ["blocks"]=> int(%i) } - -Warning: fstat(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +fstat(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/ftruncate_error.phpt b/ext/standard/tests/file/ftruncate_error.phpt index 61ba1fc509..83569c47d8 100644 --- a/ext/standard/tests/file/ftruncate_error.phpt +++ b/ext/standard/tests/file/ftruncate_error.phpt @@ -15,51 +15,16 @@ fwrite($file_handle, "Testing ftruncate error conditions \n"); fflush($file_handle); echo "\n Initial file size = ".filesize($filename)."\n"; -echo "-- Testing ftruncate() with less than expected number of arguments --\n"; - -// zero arguments -var_dump( ftruncate() ); - -// arguments less than expected numbers -var_dump( ftruncate( $file_handle ) ); -// check the first size -var_dump( filesize($filename) ); - -echo "-- Testing ftruncate() with more than expected number of arguments --\n"; -// more than expected number of arguments -var_dump( ftruncate($file_handle, 10, 20) ); -// check the first size -var_dump( filesize($filename) ); - -// test invalid arguments : non-resources -echo "-- Testing ftruncate() with invalid file pointer --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test ftruncate() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( ftruncate($invalid_args[$loop_counter - 1], 10) ); -} - // ftruncate() on a file handle which is already closed/unset echo "-- Testing ftruncate() with closed/unset file handle --\n"; // ftruncate on close file handle fclose($file_handle); -var_dump( ftruncate($file_handle,10) ); -// check the first size -var_dump( filesize($filename) ); - -// ftruncate on a file handle which is unset -$fp = fopen($filename, "w"); -unset($fp); //unset file handle -var_dump( ftruncate(@$fp,10)); +try { + var_dump( ftruncate($file_handle,10) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // check the first size var_dump( filesize($filename) ); @@ -70,55 +35,11 @@ echo "Done\n"; $filename = __DIR__."/ftruncate_error.tmp"; unlink( $filename ); ?> ---EXPECTF-- +--EXPECT-- *** Testing ftruncate() : error conditions *** Initial file size = 36 --- Testing ftruncate() with less than expected number of arguments -- - -Warning: ftruncate() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: ftruncate() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) -int(36) --- Testing ftruncate() with more than expected number of arguments -- - -Warning: ftruncate() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) -int(36) --- Testing ftruncate() with invalid file pointer -- --- Iteration 1 -- - -Warning: ftruncate() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: ftruncate() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: ftruncate() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: ftruncate() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: ftruncate() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: ftruncate() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing ftruncate() with closed/unset file handle -- - -Warning: ftruncate(): supplied resource is not a valid stream resource in %s on line %d -bool(false) -int(36) - -Warning: ftruncate() expects parameter 1 to be resource, null given in %s on line %d -bool(false) +ftruncate(): supplied resource is not a valid stream resource int(36) Done diff --git a/ext/standard/tests/file/fwrite.phpt b/ext/standard/tests/file/fwrite.phpt index 7cdb270ae3..f2005d7e68 100644 --- a/ext/standard/tests/file/fwrite.phpt +++ b/ext/standard/tests/file/fwrite.phpt @@ -6,8 +6,7 @@ fwrite() tests $filename = __DIR__."/fwrite.dat"; $fp = fopen($filename, "w"); -var_dump(fwrite($fp)); -var_dump(fwrite($fp, array())); +var_dump(fwrite($fp, "")); fclose($fp); $fp = fopen($filename, "r"); @@ -20,35 +19,18 @@ fclose($fp); var_dump(fwrite($fp, "data", -1)); -var_dump(fwrite(array(), "data", -1)); -var_dump(fwrite(array(), "data")); -var_dump(fwrite(array())); - var_dump(file_get_contents($filename)); @unlink($filename); echo "Done\n"; ?> --EXPECTF-- -Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: fwrite() expects parameter 2 to be string, array given in %s on line %d -bool(false) +int(0) Notice: fwrite(): write of 4 bytes failed with errno=9 Bad file descriptor in %s on line %d bool(false) int(0) int(4) int(0) - -Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d -bool(false) string(4) "data" Done diff --git a/ext/standard/tests/file/fwrite_error.phpt b/ext/standard/tests/file/fwrite_error.phpt index a54550a6c8..236c4601b0 100644 --- a/ext/standard/tests/file/fwrite_error.phpt +++ b/ext/standard/tests/file/fwrite_error.phpt @@ -16,18 +16,8 @@ include ("file.inc"); echo "*** Testing fwrite() : error conditions ***\n"; $filename = __DIR__."/fwrite_error.tmp"; - -echo "-- Testing fwrite() with less than expected number of arguments --\n"; -// zero argument -var_dump( fwrite() ); -// less than expected, 1 arg $file_handle = fopen ( $filename, "w"); -var_dump( fwrite($file_handle) ); - -// more than expected no. of args -echo "-- Testing fwrite() with more than expected number of arguments --\n"; $data = "data"; -var_dump( fwrite($file_handle, $data, strlen($data), 10) ); // invalid length argument echo "-- Testing fwrite() with invalid length arguments --\n"; @@ -36,31 +26,14 @@ var_dump( fwrite($file_handle, $data, $len) ); $len = -10; var_dump( fwrite($file_handle, $data, $len) ); -// test invalid arguments : non-resources -echo "-- Testing fwrite() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fwrite() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fwrite($invalid_args[$loop_counter - 1], 10) ); -} - // fwrite() on a file handle which is already closed echo "-- Testing fwrite() with closed/unset file handle --\n"; fclose($file_handle); -var_dump(fwrite($file_handle,"data")); - -// fwrite on a file handle which is unset -$fp = fopen($filename, "w"); -unset($fp); //unset file handle -var_dump( fwrite(@$fp,"data")); +try { + var_dump(fwrite($file_handle,"data")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -69,52 +42,11 @@ echo "Done\n"; $filename = __DIR__."/fwrite_error.tmp"; unlink( $filename ); ?> ---EXPECTF-- +--EXPECT-- *** Testing fwrite() : error conditions *** --- Testing fwrite() with less than expected number of arguments -- - -Warning: fwrite() expects at least 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d -bool(false) --- Testing fwrite() with more than expected number of arguments -- - -Warning: fwrite() expects at most 3 parameters, 4 given in %s on line %d -bool(false) -- Testing fwrite() with invalid length arguments -- int(0) int(0) --- Testing fwrite() with invalid arguments -- --- Iteration 1 -- - -Warning: fwrite() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fwrite() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fwrite() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fwrite() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fwrite() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing fwrite() with closed/unset file handle -- - -Warning: fwrite(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fwrite() expects parameter 1 to be resource, null given in %s on line %d -bool(false) +fwrite(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/get_current_user.phpt b/ext/standard/tests/file/get_current_user.phpt index f23d2fabef..04938e3d6b 100644 --- a/ext/standard/tests/file/get_current_user.phpt +++ b/ext/standard/tests/file/get_current_user.phpt @@ -3,13 +3,10 @@ get_current_user() tests --FILE-- <?php -var_dump(get_current_user("blah")); var_dump(get_current_user()); echo "Done\n"; ?> --EXPECTF-- -Warning: get_current_user() expects exactly 0 parameters, 1 given in %s on line %d -NULL string(%d) %s Done diff --git a/ext/standard/tests/file/glob_variation-win32-mb.phpt b/ext/standard/tests/file/glob_variation-win32-mb.phpt index fd068b01ad..2ced6fd355 100644 --- a/ext/standard/tests/file/glob_variation-win32-mb.phpt +++ b/ext/standard/tests/file/glob_variation-win32-mb.phpt @@ -46,12 +46,16 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "\n-- Iteration $counter --\n"; - var_dump( glob($pattern) ); // default arguments - var_dump( glob($pattern, GLOB_MARK) ); - var_dump( glob($pattern, GLOB_NOSORT) ); - var_dump( glob($pattern, GLOB_NOCHECK) ); - var_dump( glob($pattern, GLOB_NOESCAPE) ); - var_dump( glob($pattern, GLOB_ERR) ); + try { + var_dump( glob($pattern) ); // default arguments + var_dump( glob($pattern, GLOB_MARK) ); + var_dump( glob($pattern, GLOB_NOSORT) ); + var_dump( glob($pattern, GLOB_NOCHECK) ); + var_dump( glob($pattern, GLOB_NOESCAPE) ); + var_dump( glob($pattern, GLOB_ERR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -73,7 +77,11 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; - var_dump( glob($pattern, GLOB_ONLYDIR) ); + try { + var_dump( glob($pattern, GLOB_ONLYDIR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -326,24 +334,7 @@ array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { @@ -446,9 +437,7 @@ array(1) { array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %sglob_variation-win32-mb.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/glob_variation-win32.phpt b/ext/standard/tests/file/glob_variation-win32.phpt index 9a1528bb1f..32d56e8762 100644 --- a/ext/standard/tests/file/glob_variation-win32.phpt +++ b/ext/standard/tests/file/glob_variation-win32.phpt @@ -45,12 +45,16 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "\n-- Iteration $counter --\n"; - var_dump( glob($pattern) ); // default arguments - var_dump( glob($pattern, GLOB_MARK) ); - var_dump( glob($pattern, GLOB_NOSORT) ); - var_dump( glob($pattern, GLOB_NOCHECK) ); - var_dump( glob($pattern, GLOB_NOESCAPE) ); - var_dump( glob($pattern, GLOB_ERR) ); + try { + var_dump( glob($pattern) ); // default arguments + var_dump( glob($pattern, GLOB_MARK) ); + var_dump( glob($pattern, GLOB_NOSORT) ); + var_dump( glob($pattern, GLOB_NOCHECK) ); + var_dump( glob($pattern, GLOB_NOESCAPE) ); + var_dump( glob($pattern, GLOB_ERR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -72,7 +76,11 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; - var_dump( glob($pattern, GLOB_ONLYDIR) ); + try { + var_dump( glob($pattern, GLOB_ONLYDIR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -325,24 +333,7 @@ array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { @@ -445,9 +436,7 @@ array(1) { array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %sglob_variation-win32.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/glob_variation.phpt b/ext/standard/tests/file/glob_variation.phpt index 056cf62bec..eb5aff0cf4 100644 --- a/ext/standard/tests/file/glob_variation.phpt +++ b/ext/standard/tests/file/glob_variation.phpt @@ -48,12 +48,16 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "\n-- Iteration $counter --\n"; - var_dump( glob($pattern) ); // default arguments - var_dump( glob($pattern, GLOB_MARK) ); - var_dump( glob($pattern, GLOB_NOSORT) ); - var_dump( glob($pattern, GLOB_NOCHECK) ); - var_dump( glob($pattern, GLOB_NOESCAPE) ); - var_dump( glob($pattern, GLOB_ERR) ); + try { + var_dump( glob($pattern) ); // default arguments + var_dump( glob($pattern, GLOB_MARK) ); + var_dump( glob($pattern, GLOB_NOSORT) ); + var_dump( glob($pattern, GLOB_NOCHECK) ); + var_dump( glob($pattern, GLOB_NOESCAPE) ); + var_dump( glob($pattern, GLOB_ERR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -75,7 +79,11 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; - var_dump( glob($pattern, GLOB_ONLYDIR) ); + try { + var_dump( glob($pattern, GLOB_ONLYDIR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -328,24 +336,7 @@ array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { @@ -448,9 +439,7 @@ array(1) { array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/is_dir_variation3.phpt b/ext/standard/tests/file/is_dir_variation3.phpt index 86c40da0eb..060739ff3d 100644 --- a/ext/standard/tests/file/is_dir_variation3.phpt +++ b/ext/standard/tests/file/is_dir_variation3.phpt @@ -9,8 +9,6 @@ Test is_dir() function: usage variations - invalid arguments /* Passing invalid arguments to is_dir() */ -$dir_handle = opendir( __DIR__ ); - echo "*** Testing is_dir() with Invalid arguments: expected bool(false) ***\n"; $dirnames = array( /* Invalid dirnames */ @@ -19,7 +17,6 @@ $dirnames = array( FALSE, NULL, " ", - $dir_handle, /* scalars */ 0, @@ -30,7 +27,6 @@ $dirnames = array( foreach($dirnames as $dirname) { var_dump( is_dir($dirname) ); } -closedir($dir_handle); echo "\n*** Done ***"; ?> @@ -41,9 +37,6 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_dir() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL bool(false) bool(false) diff --git a/ext/standard/tests/file/is_dir_variation4.phpt b/ext/standard/tests/file/is_dir_variation4.phpt index 543533f8ed..8d4838524e 100644 --- a/ext/standard/tests/file/is_dir_variation4.phpt +++ b/ext/standard/tests/file/is_dir_variation4.phpt @@ -38,7 +38,11 @@ $count = 1; /* loop through to test each element the above array */ foreach($dirs_arr as $dir) { echo "\n-- Iteration $count --\n"; - var_dump( is_dir($file_path."/".$dir ) ); + try { + var_dump( is_dir($file_path."/".$dir ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } @@ -77,13 +81,9 @@ bool(true) bool(false) -- Iteration 9 -- - -Warning: is_dir() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_dir() expects parameter 1 to be a valid path, string given -- Iteration 10 -- - -Warning: is_dir() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_dir() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/is_executable_error.phpt b/ext/standard/tests/file/is_executable_error.phpt index 99c218b514..ad90d64435 100644 --- a/ext/standard/tests/file/is_executable_error.phpt +++ b/ext/standard/tests/file/is_executable_error.phpt @@ -6,24 +6,11 @@ Test is_executable() function: error conditions Description: Tells whether the filename is executable */ -echo "*** Testing is_executable(): error conditions ***\n"; -var_dump( is_executable() ); // args < expected no of arguments - -var_dump( is_executable(1, 2) ); // args > expected no. of arguments - echo "\n*** Testing is_exceutable() on non-existent directory ***\n"; var_dump( is_executable(__DIR__."/is_executable") ); echo "Done\n"; --EXPECTF-- -*** Testing is_executable(): error conditions *** - -Warning: is_executable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_executable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing is_exceutable() on non-existent directory *** bool(false) Done diff --git a/ext/standard/tests/file/is_executable_variation1.phpt b/ext/standard/tests/file/is_executable_variation1.phpt index 1e8d8f5faf..5c8193b44d 100644 --- a/ext/standard/tests/file/is_executable_variation1.phpt +++ b/ext/standard/tests/file/is_executable_variation1.phpt @@ -51,7 +51,11 @@ $counter = 1; is an executable file */ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; - var_dump( is_executable($file) ); + try { + var_dump( is_executable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; clearstatcache(); } @@ -76,13 +80,9 @@ bool(false) -- Iteration 5 -- bool(false) -- Iteration 6 -- - -Warning: is_executable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_executable() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: is_executable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_executable() expects parameter 1 to be a valid path, string given -- Iteration 8 -- bool(false) -- Iteration 9 -- diff --git a/ext/standard/tests/file/is_executable_variation3.phpt b/ext/standard/tests/file/is_executable_variation3.phpt index 5051504be9..64c018c9b1 100644 --- a/ext/standard/tests/file/is_executable_variation3.phpt +++ b/ext/standard/tests/file/is_executable_variation3.phpt @@ -38,7 +38,6 @@ $invalid_files = array( FALSE, NULL, " ", - @array(), @$file_handle ); /* loop through to test each element in the above array @@ -61,8 +60,5 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_executable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL bool(false) Done diff --git a/ext/standard/tests/file/is_file_variation3.phpt b/ext/standard/tests/file/is_file_variation3.phpt index 0a06ad5015..884f292b26 100644 --- a/ext/standard/tests/file/is_file_variation3.phpt +++ b/ext/standard/tests/file/is_file_variation3.phpt @@ -7,7 +7,7 @@ Test is_file() function: usage variations - invalid filenames Returns TRUE if the filename exists and is a regular file */ -/* Testing is_file() with invalid arguments -int, float, bool, NULL, resource */ +/* Testing is_file() with invalid arguments -int, float, bool, NULL */ function flatten($variable) { \ob_start(); @@ -29,10 +29,7 @@ foreach([ /* scalars */ 1234, - 0, - - /* resource */ - fopen(__FILE__, "r") + 0 ] as $filename ) { printf( "%s: %d\n", @@ -49,4 +46,3 @@ bool(false): 0 NULL: 0 int(1234): 0 int(0): 0 -resource(%d) of type (stream): 0 diff --git a/ext/standard/tests/file/is_file_variation4.phpt b/ext/standard/tests/file/is_file_variation4.phpt index 39a640e7eb..e67180c086 100644 --- a/ext/standard/tests/file/is_file_variation4.phpt +++ b/ext/standard/tests/file/is_file_variation4.phpt @@ -38,7 +38,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( is_file( $file_path."/".$file ) ); + try { + var_dump( is_file( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -67,12 +71,8 @@ bool(false) - Iteration 6 - bool(false) - Iteration 7 - - -Warning: is_file() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_file() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: is_file() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_file() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/is_readable_error.phpt b/ext/standard/tests/file/is_readable_error.phpt index ad6c2b8c62..1520eb4d20 100644 --- a/ext/standard/tests/file/is_readable_error.phpt +++ b/ext/standard/tests/file/is_readable_error.phpt @@ -6,24 +6,12 @@ Test is_readable() function: error conditions Description: Tells whether the filename is readable */ -echo "*** Testing is_readable(): error conditions ***\n"; -var_dump( is_readable() ); // args < expected -var_dump( is_readable(1, 2) ); // args > expected - echo "\n*** Testing is_readable() on non-existent file ***\n"; var_dump( is_readable(__DIR__."/is_readable.tmp") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing is_readable(): error conditions *** - -Warning: is_readable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_readable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing is_readable() on non-existent file *** bool(false) Done diff --git a/ext/standard/tests/file/is_readable_variation1.phpt b/ext/standard/tests/file/is_readable_variation1.phpt index 66dc2b81f5..f2a8a1b532 100644 --- a/ext/standard/tests/file/is_readable_variation1.phpt +++ b/ext/standard/tests/file/is_readable_variation1.phpt @@ -60,7 +60,11 @@ $counter = 1; is a writable file */ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; - var_dump( is_readable($file) ); + try { + var_dump( is_readable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; clearstatcache(); } @@ -87,17 +91,11 @@ bool(false) -- Iteration 6 -- bool(false) -- Iteration 7 -- - -Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_readable() expects parameter 1 to be a valid path, string given -- Iteration 8 -- - -Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_readable() expects parameter 1 to be a valid path, string given -- Iteration 9 -- - -Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_readable() expects parameter 1 to be a valid path, string given -- Iteration 10 -- bool(true) -- Iteration 11 -- diff --git a/ext/standard/tests/file/is_readable_variation3.phpt b/ext/standard/tests/file/is_readable_variation3.phpt index 5aec51b780..e2450a845d 100644 --- a/ext/standard/tests/file/is_readable_variation3.phpt +++ b/ext/standard/tests/file/is_readable_variation3.phpt @@ -37,7 +37,6 @@ $misc_files = array( FALSE, NULL, " ", - @array(), @$file_handle ); /* loop through to test each element in the above array @@ -60,8 +59,5 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_readable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL bool(false) Done diff --git a/ext/standard/tests/file/is_uploaded_file_basic.phpt b/ext/standard/tests/file/is_uploaded_file_basic.phpt index 1721935549..d053244a79 100644 --- a/ext/standard/tests/file/is_uploaded_file_basic.phpt +++ b/ext/standard/tests/file/is_uploaded_file_basic.phpt @@ -29,19 +29,9 @@ var_dump(is_uploaded_file('random_filename.txt')); // not an uploaded file var_dump(is_uploaded_file('__FILE__')); -// Error cases -var_dump(is_uploaded_file()); -var_dump(is_uploaded_file('a', 'b')); - ?> --EXPECTF-- bool(true) bool(false) bool(false) bool(false) - -Warning: is_uploaded_file() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_uploaded_file() expects exactly 1 parameter, 2 given in %s on line %d -NULL diff --git a/ext/standard/tests/file/is_writable_error.phpt b/ext/standard/tests/file/is_writable_error.phpt index a9633f2284..e2a38412cd 100644 --- a/ext/standard/tests/file/is_writable_error.phpt +++ b/ext/standard/tests/file/is_writable_error.phpt @@ -8,14 +8,6 @@ Test is_writable() and its alias is_writeable() function: error conditions is_writeable() is an alias of is_writable() */ -echo "*** Testing is_writable(): error conditions ***\n"; -var_dump( is_writable() ); // args < expected -var_dump( is_writeable() ); - -echo "\n*** Testing is_writeable(): error conditions ***\n"; -var_dump( is_writable(1, 2) ); // args > expected -var_dump( is_writeable(1, 2) ); - echo "\n*** Testing is_writable() on non-existent file ***\n"; var_dump( is_writable(__DIR__."/is_writable") ); var_dump( is_writeable(__DIR__."/is_writable") ); @@ -23,22 +15,6 @@ var_dump( is_writeable(__DIR__."/is_writable") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing is_writable(): error conditions *** - -Warning: is_writable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_writeable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -*** Testing is_writeable(): error conditions *** - -Warning: is_writable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: is_writeable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing is_writable() on non-existent file *** bool(false) bool(false) diff --git a/ext/standard/tests/file/is_writable_variation1.phpt b/ext/standard/tests/file/is_writable_variation1.phpt index 31187b66d0..15f1290588 100644 --- a/ext/standard/tests/file/is_writable_variation1.phpt +++ b/ext/standard/tests/file/is_writable_variation1.phpt @@ -62,8 +62,16 @@ $counter = 1; is a writable file */ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; - var_dump( is_writable($file) ); - var_dump( is_writeable($file) ); + try { + var_dump( is_writable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( is_writeable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; clearstatcache(); } @@ -96,26 +104,14 @@ bool(false) bool(false) bool(false) -- Iteration 7 -- - -Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_writable() expects parameter 1 to be a valid path, string given +is_writeable() expects parameter 1 to be a valid path, string given -- Iteration 8 -- - -Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_writable() expects parameter 1 to be a valid path, string given +is_writeable() expects parameter 1 to be a valid path, string given -- Iteration 9 -- - -Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_writable() expects parameter 1 to be a valid path, string given +is_writeable() expects parameter 1 to be a valid path, string given -- Iteration 10 -- bool(true) bool(true) diff --git a/ext/standard/tests/file/is_writable_variation3.phpt b/ext/standard/tests/file/is_writable_variation3.phpt index f682bd3292..c8909b0932 100644 --- a/ext/standard/tests/file/is_writable_variation3.phpt +++ b/ext/standard/tests/file/is_writable_variation3.phpt @@ -35,7 +35,6 @@ $misc_files = array( FALSE, NULL, " ", - @array(), @$file_handle ); /* loop through to test each element in the above array @@ -66,12 +65,6 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_writable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL bool(false) bool(false) Done diff --git a/ext/standard/tests/file/lchown_error.phpt b/ext/standard/tests/file/lchown_error.phpt index dc574bf421..819fc6ab43 100644 --- a/ext/standard/tests/file/lchown_error.phpt +++ b/ext/standard/tests/file/lchown_error.phpt @@ -29,20 +29,9 @@ $filename = __DIR__ . DIRECTORY_SEPARATOR . 'lchown.txt'; touch( $filename ); $uid = posix_getuid(); - -// Less than expected arguments -var_dump( lchown( $filename ) ); - -// More than expected arguments -var_dump( lchown( $filename, $uid, 'foobar' ) ); - // Non-existent filename var_dump( lchown( 'foobar_lchown.txt', $uid ) ); -// Wrong argument types -var_dump( lchown( new StdClass(), $uid ) ); -var_dump( lchown( array(), $uid ) ); - // Bad user var_dump( lchown( $filename, -5 ) ); @@ -58,21 +47,9 @@ unlink($filename); --EXPECTF-- *** Testing lchown() : error functionality *** -Warning: lchown() expects exactly 2 parameters, 1 given in %s on line %d -bool(true) - -Warning: lchown() expects exactly 2 parameters, 3 given in %s on line %d -bool(true) - Warning: lchown(): No such file or directory in %s on line %d bool(false) -Warning: lchown() expects parameter 1 to be a valid path, object given in %s on line %d -bool(true) - -Warning: lchown() expects parameter 1 to be a valid path, array given in %s on line %d -bool(true) - Warning: lchown(): %r(Operation not permitted|Invalid argument)%r in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/file/lstat_stat_error.phpt b/ext/standard/tests/file/lstat_stat_error.phpt index 543e296ec2..06926df2a2 100644 --- a/ext/standard/tests/file/lstat_stat_error.phpt +++ b/ext/standard/tests/file/lstat_stat_error.phpt @@ -17,54 +17,28 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { echo "*** Testing lstat() for error conditions ***\n"; $file_path = __DIR__; -var_dump( lstat() ); // args < expected -var_dump( lstat(__FILE__, 2) ); // args > expected var_dump( lstat("$file_path/temp.tmp") ); // non existing file var_dump( lstat(22) ); // scalar argument -$arr = array(__FILE__); -var_dump( lstat($arr) ); // array argument echo "\n*** Testing stat() for error conditions ***\n"; -var_dump( stat() ); // args < expected -var_dump( stat(__FILE__, 2) ); // file, args > expected -var_dump( stat(__DIR__, 2) ); //dir, args > expected var_dump( stat("$file_path/temp.tmp") ); // non existing file var_dump( stat("$file_path/temp/") ); // non existing dir var_dump( stat(22) ); // scalar argument -var_dump( stat($arr) ); // array argument echo "Done\n"; ?> --EXPECTF-- *** Testing lstat() for error conditions *** -Warning: lstat() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: lstat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: lstat(): Lstat failed for %s in %s on line %d bool(false) Warning: lstat(): Lstat failed for 22 in %s on line %d bool(false) -Warning: lstat() expects parameter 1 to be a valid path, array given in %s on line %d -NULL - *** Testing stat() for error conditions *** -Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: stat(): stat failed for %s in %s on line %d bool(false) @@ -73,7 +47,4 @@ bool(false) Warning: stat(): stat failed for 22 in %s on line %d bool(false) - -Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d -NULL Done diff --git a/ext/standard/tests/file/mkdir_rmdir_error.phpt b/ext/standard/tests/file/mkdir_rmdir_error.phpt index 17f908c3f6..be0b434c2c 100644 --- a/ext/standard/tests/file/mkdir_rmdir_error.phpt +++ b/ext/standard/tests/file/mkdir_rmdir_error.phpt @@ -9,48 +9,12 @@ Test mkdir() and rmdir() functions : error conditions Description: Removes directory */ -echo "*** Testing mkdir(): error conditions ***\n"; -var_dump( mkdir() ); // args < expected -var_dump( mkdir(1, 2, 3, 4, 5) ); // args > expected -var_dump( mkdir("testdir", 0777, false, $context, "test") ); // args > expected - -echo "\n*** Testing rmdir(): error conditions ***\n"; -var_dump( rmdir() ); // args < expected -var_dump( rmdir(1, 2, 3) ); // args > expected -var_dump( rmdir("testdir", $context, "test") ); // args > expected - echo "\n*** Testing rmdir() on non-existent directory ***\n"; var_dump( rmdir("temp") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing mkdir(): error conditions *** - -Warning: mkdir() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d -bool(false) - -Notice: Undefined variable: context in %s on line %d - -Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d -bool(false) - -*** Testing rmdir(): error conditions *** - -Warning: rmdir() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - -Notice: Undefined variable: context in %s on line %d - -Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - *** Testing rmdir() on non-existent directory *** Warning: rmdir(temp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt index b6a7395337..d760a69c25 100644 --- a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt +++ b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt @@ -35,8 +35,16 @@ var_dump( mkdir("$file_path/mkdir_variation2/test/", 0777, true) ); var_dump( rmdir("$file_path/mkdir_variation2/") ); echo "\n*** Testing mkdir() and rmdir() for binary safe functionality ***\n"; -var_dump( mkdir("$file_path/temp".chr(0)."/") ); -var_dump( rmdir("$file_path/temp".chr(0)."/") ); +try { + var_dump( mkdir("$file_path/temp".chr(0)."/") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( rmdir("$file_path/temp".chr(0)."/") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n*** Testing mkdir() with miscelleneous input ***\n"; /* changing mode of mkdir to prevent creating sub-directory under it */ @@ -64,12 +72,8 @@ Warning: rmdir(%s/mkdir_variation2/): %s on line %d bool(false) *** Testing mkdir() and rmdir() for binary safe functionality *** - -Warning: mkdir() expects parameter 1 to be a valid path, string given in %s on line %d -bool(false) - -Warning: rmdir() expects parameter 1 to be a valid path, string given in %s on line %d -bool(false) +mkdir() expects parameter 1 to be a valid path, string given +rmdir() expects parameter 1 to be a valid path, string given *** Testing mkdir() with miscelleneous input *** bool(true) diff --git a/ext/standard/tests/file/move_uploaded_file_basic.phpt b/ext/standard/tests/file/move_uploaded_file_basic.phpt index c6cfdd3203..7af8748fe2 100644 --- a/ext/standard/tests/file/move_uploaded_file_basic.phpt +++ b/ext/standard/tests/file/move_uploaded_file_basic.phpt @@ -49,11 +49,6 @@ fclose($fd); var_dump(move_uploaded_file($_FILES['file2']['tmp_name'], $destination4)); unlink($destination4); -echo "Wrong parameters\n"; -var_dump(move_uploaded_file()); -var_dump(move_uploaded_file(1, 2, 3)); - - ?> --EXPECTF-- Valid move @@ -66,10 +61,3 @@ Non-uploaded source file bool(false) Valid move to existing file bool(true) -Wrong parameters - -Warning: move_uploaded_file() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: move_uploaded_file() expects exactly 2 parameters, 3 given in %s on line %d -NULL diff --git a/ext/standard/tests/file/parse_ini_file_error.phpt b/ext/standard/tests/file/parse_ini_file_error.phpt index 29e022fb13..5c812d7b9a 100644 --- a/ext/standard/tests/file/parse_ini_file_error.phpt +++ b/ext/standard/tests/file/parse_ini_file_error.phpt @@ -10,10 +10,6 @@ Test parse_ini_file() function : error conditions echo "*** Testing parse_ini_file() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing parse_ini_file() function with Zero arguments --\n"; -var_dump( parse_ini_file() ); - //Test parse_ini_file with one more than the expected number of arguments echo "\n-- Testing parse_ini_file() function with more than expected no. of arguments --\n"; $filename = 'string_val'; @@ -30,11 +26,6 @@ echo "Done"; --EXPECTF-- *** Testing parse_ini_file() : error conditions *** --- Testing parse_ini_file() function with Zero arguments -- - -Warning: parse_ini_file() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -- Testing parse_ini_file() function with more than expected no. of arguments -- Warning: parse_ini_file(%s): failed to open stream: No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/parse_ini_file_variation3.phpt b/ext/standard/tests/file/parse_ini_file_variation3.phpt index 96d44433f7..acdb4d83eb 100644 --- a/ext/standard/tests/file/parse_ini_file_variation3.phpt +++ b/ext/standard/tests/file/parse_ini_file_variation3.phpt @@ -43,7 +43,6 @@ log_errors_max_len = 1024 ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On -track_errors = Off docref_root = "/phpmanual/" docref_ext = .html @@ -77,7 +76,7 @@ foreach($newdirs as $newdir) { --EXPECTF-- *** Testing parse_ini_file() : variation *** New include path is : %sparse_ini_file_variation3.dir1%sparse_ini_file_variation3.dir2%sparse_ini_file_variation3.dir3%S -array(11) { +array(10) { ["error_reporting"]=> string(5) "32767" ["display_errors"]=> @@ -94,8 +93,6 @@ array(11) { string(0) "" ["report_memleaks"]=> string(1) "1" - ["track_errors"]=> - string(0) "" ["docref_root"]=> string(11) "/phpmanual/" ["docref_ext"]=> diff --git a/ext/standard/tests/file/pathinfo_variaton.phpt b/ext/standard/tests/file/pathinfo_variaton.phpt index 421f378e01..6f4492e375 100644 --- a/ext/standard/tests/file/pathinfo_variaton.phpt +++ b/ext/standard/tests/file/pathinfo_variaton.phpt @@ -43,9 +43,6 @@ $paths = array ( "./array(1, 2)", "array( array(), null)", - /* pathname as object */ - $obj, - /* pathname as spaces */ " ", ' ', @@ -199,22 +196,6 @@ string(21) "array( array(), null)" string(0) "" string(21) "array( array(), null)" -- Iteration 9 -- - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL --- Iteration 10 -- array(3) { ["dirname"]=> string(1) "." @@ -227,7 +208,7 @@ string(1) "." string(1) " " string(0) "" string(1) " " --- Iteration 11 -- +-- Iteration 10 -- array(3) { ["dirname"]=> string(1) "." @@ -240,7 +221,7 @@ string(1) "." string(1) " " string(0) "" string(1) " " --- Iteration 12 -- +-- Iteration 11 -- array(2) { ["basename"]=> string(0) "" @@ -251,7 +232,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 13 -- +-- Iteration 12 -- array(2) { ["basename"]=> string(0) "" @@ -262,7 +243,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 14 -- +-- Iteration 13 -- array(2) { ["basename"]=> string(0) "" @@ -273,7 +254,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 15 -- +-- Iteration 14 -- array(2) { ["basename"]=> string(0) "" @@ -284,7 +265,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 16 -- +-- Iteration 15 -- array(2) { ["basename"]=> string(0) "" @@ -295,7 +276,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 17 -- +-- Iteration 16 -- array(4) { ["dirname"]=> string(1) "." @@ -310,7 +291,7 @@ string(1) "." string(11) "www.foo.com" string(3) "com" string(7) "www.foo" --- Iteration 18 -- +-- Iteration 17 -- array(4) { ["dirname"]=> string(17) "/var/html/testdir" @@ -325,7 +306,7 @@ string(17) "/var/html/testdir" string(12) "example.html" string(4) "html" string(7) "example" --- Iteration 19 -- +-- Iteration 18 -- array(3) { ["dirname"]=> string(12) "/testdir/foo" @@ -338,7 +319,7 @@ string(12) "/testdir/foo" string(4) "test" string(0) "" string(4) "test" --- Iteration 20 -- +-- Iteration 19 -- array(4) { ["dirname"]=> string(4) "/foo" @@ -353,7 +334,7 @@ string(4) "/foo" string(12) "symlink.link" string(4) "link" string(7) "symlink" --- Iteration 21 -- +-- Iteration 20 -- array(3) { ["dirname"]=> string(1) "." @@ -366,7 +347,7 @@ string(1) "." string(5) "12345" string(0) "" string(5) "12345" --- Iteration 22 -- +-- Iteration 21 -- array(4) { ["dirname"]=> string(1) "." @@ -381,7 +362,7 @@ string(1) "." string(15) "www.example.com" string(3) "com" string(11) "www.example" --- Iteration 23 -- +-- Iteration 22 -- array(3) { ["dirname"]=> string(12) "/testdir/foo" @@ -394,7 +375,7 @@ string(12) "/testdir/foo" string(4) "test" string(0) "" string(4) "test" --- Iteration 24 -- +-- Iteration 23 -- array(4) { ["dirname"]=> string(6) "../foo" @@ -409,7 +390,7 @@ string(6) "../foo" string(9) "test.link" string(4) "link" string(4) "test" --- Iteration 25 -- +-- Iteration 24 -- array(4) { ["dirname"]=> string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/test5/test6" @@ -424,7 +405,7 @@ string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/tes string(8) "test.tmp" string(3) "tmp" string(4) "test" --- Iteration 26 -- +-- Iteration 25 -- array(4) { ["dirname"]=> string(1) "." diff --git a/ext/standard/tests/file/popen_pclose_error.phpt b/ext/standard/tests/file/popen_pclose_error.phpt index b0e86be65c..eebe6a7a00 100644 --- a/ext/standard/tests/file/popen_pclose_error.phpt +++ b/ext/standard/tests/file/popen_pclose_error.phpt @@ -16,14 +16,9 @@ if (strtoupper( substr(PHP_OS, 0, 3) ) == 'SUN') */ $file_path = __DIR__; echo "*** Testing for error conditions ***\n"; -var_dump( popen() ); // Zero Arguments -var_dump( popen("abc.txt") ); // Single Argument var_dump( popen("abc.txt", "rw") ); // Invalid mode Argument -var_dump( pclose() ); $file_handle = fopen($file_path."/popen.tmp", "w"); -var_dump( pclose($file_handle, $file_handle) ); fclose($file_handle); -var_dump( pclose(1) ); echo "\n--- Done ---"; ?> --CLEAN-- @@ -34,22 +29,7 @@ unlink($file_path."/popen.tmp"); --EXPECTF-- *** Testing for error conditions *** -Warning: popen() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Warning: popen(abc.txt,rw): %s on line %d bool(false) -Warning: pclose() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: pclose() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: pclose() expects parameter 1 to be resource, int given in %s on line %d -bool(false) - --- Done --- diff --git a/ext/standard/tests/file/readfile_error.phpt b/ext/standard/tests/file/readfile_error.phpt index 0dc1f7b82f..9e5c6e5702 100644 --- a/ext/standard/tests/file/readfile_error.phpt +++ b/ext/standard/tests/file/readfile_error.phpt @@ -9,17 +9,12 @@ Test readfile() function: error conditions $context = stream_context_create(); echo "*** Test readfile(): error conditions ***\n"; -echo "-- Testing readfile() with unexpected no. of arguments --\n"; -var_dump( readfile() ); // args < expected -var_dump( readfile(__FILE__, true, $context, 4) ); // args > expected echo "\n-- Testing readfile() with invalid arguments --\n"; // invalid arguments var_dump( readfile(NULL) ); // NULL as $filename var_dump( readfile('') ); // empty string as $filename var_dump( readfile(false) ); // boolean false as $filename -var_dump( readfile(__FILE__, false, '') ); // empty string as $context -var_dump( readfile(__FILE__, true, false) ); // boolean false as $context echo "\n-- Testing readfile() with non-existent file --\n"; $non_existent_file = __DIR__."/non_existent_file.tmp"; @@ -29,13 +24,6 @@ echo "Done\n"; ?> --EXPECTF-- *** Test readfile(): error conditions *** --- Testing readfile() with unexpected no. of arguments -- - -Warning: readfile() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: readfile() expects at most 3 parameters, 4 given in %s on line %d -bool(false) -- Testing readfile() with invalid arguments -- @@ -48,12 +36,6 @@ bool(false) Warning: readfile(): Filename cannot be empty in %s on line %d bool(false) -Warning: readfile() expects parameter 3 to be resource, string given in %s on line %d -bool(false) - -Warning: readfile() expects parameter 3 to be resource, bool given in %s on line %d -bool(false) - -- Testing readfile() with non-existent file -- Warning: readfile(%s/non_existent_file.tmp): failed to open stream: %s in %s on line %d diff --git a/ext/standard/tests/file/readfile_variation10-win32.phpt b/ext/standard/tests/file/readfile_variation10-win32.phpt index a240a826b9..04fdafca79 100644 --- a/ext/standard/tests/file/readfile_variation10-win32.phpt +++ b/ext/standard/tests/file/readfile_variation10-win32.phpt @@ -36,8 +36,12 @@ $names_arr = array( ); foreach($names_arr as $key => $value) { - echo "\n-- Filename: $key --\n"; - readfile($value); + echo "\n-- Filename: $key --\n"; + try { + readfile($value); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> @@ -70,12 +74,10 @@ Warning: readfile(): Filename cannot be empty in %s on line %d Warning: readfile( ): failed to open stream: Permission denied in %s on line %d -- Filename: \0 -- - -Warning: readfile() expects parameter 1 to be a valid path, string given in %s on line %d +readfile() expects parameter 1 to be a valid path, string given -- Filename: array() -- - -Warning: readfile() expects parameter 1 to be a valid path, array given in %s on line %d +readfile() expects parameter 1 to be a valid path, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/readfile_variation10.phpt b/ext/standard/tests/file/readfile_variation10.phpt Binary files differindex 59b92ad365..5a0070c04f 100644 --- a/ext/standard/tests/file/readfile_variation10.phpt +++ b/ext/standard/tests/file/readfile_variation10.phpt diff --git a/ext/standard/tests/file/readlink_realpath_error.phpt b/ext/standard/tests/file/readlink_realpath_error.phpt index e2afb8bb36..07880d1007 100644 --- a/ext/standard/tests/file/readlink_realpath_error.phpt +++ b/ext/standard/tests/file/readlink_realpath_error.phpt @@ -15,10 +15,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { Description: Returns canonicalized absolute pathname */ -echo "*** Testing readlink(): error conditions ***\n"; -var_dump( readlink() ); // args < expected -var_dump( readlink(__FILE__, 2) ); // args > expected - echo "\n*** Testing readlink() on a non-existent link ***\n"; var_dump( readlink(__DIR__."/readlink_error.tmp") ); @@ -28,24 +24,12 @@ var_dump( readlink(__FILE__) ); echo "\n*** Testing readlink() on existing directory ***\n"; var_dump( readlink(__DIR__) ); -echo "*** Testing realpath(): error conditions ***\n"; -var_dump( realpath() ); // args < expected -var_dump( realpath(1, 2) ); // args > expected - echo "\n*** Testing realpath() on a non-existent file ***\n"; var_dump( realpath(__DIR__."/realpath_error.tmp") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing readlink(): error conditions *** - -Warning: readlink() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: readlink() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing readlink() on a non-existent link *** Warning: readlink(): No such file or directory in %s on line %d @@ -60,13 +44,6 @@ bool(false) Warning: readlink(): Invalid argument in %s on line %d bool(false) -*** Testing realpath(): error conditions *** - -Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d -NULL *** Testing realpath() on a non-existent file *** %s diff --git a/ext/standard/tests/file/readlink_variation1.phpt b/ext/standard/tests/file/readlink_variation1.phpt index a54a246dc3..2971c1e146 100644 --- a/ext/standard/tests/file/readlink_variation1.phpt +++ b/ext/standard/tests/file/readlink_variation1.phpt @@ -10,7 +10,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com> /* Testing readlink() with invalid arguments -int, float, bool, NULL, resource */ $file_path = __DIR__; -$file_handle = fopen($file_path."/readlink_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -20,7 +19,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -32,7 +30,6 @@ foreach( $filenames as $filename ) { var_dump( readlink($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -59,9 +56,6 @@ bool(false) Warning: readlink(): %s in %s on line %d bool(false) -Warning: readlink() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: readlink(): %s in %s on line %d bool(false) diff --git a/ext/standard/tests/file/realpath_error-win32.phpt b/ext/standard/tests/file/realpath_error-win32.phpt deleted file mode 100644 index 2fd221e45a..0000000000 --- a/ext/standard/tests/file/realpath_error-win32.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Test realpath() function: error conditions ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip only on Windows'); -} -?> ---FILE-- -<?php -/* Prototype: string realpath ( string $path ); - Description: Returns canonicalized absolute pathname -*/ - -echo "*** Testing realpath() for error conditions ***\n"; -var_dump( realpath() ); // args < expected -var_dump( realpath(1, 2) ); // args > expected - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing realpath() for error conditions *** - -Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/file/rename_variation13-win32.phpt b/ext/standard/tests/file/rename_variation13-win32.phpt Binary files differindex d8db734e38..c0299c27ab 100644 --- a/ext/standard/tests/file/rename_variation13-win32.phpt +++ b/ext/standard/tests/file/rename_variation13-win32.phpt diff --git a/ext/standard/tests/file/rename_variation13.phpt b/ext/standard/tests/file/rename_variation13.phpt index 1cadd8a438..209c950170 100644 --- a/ext/standard/tests/file/rename_variation13.phpt +++ b/ext/standard/tests/file/rename_variation13.phpt @@ -30,8 +30,6 @@ $names_arr = array( NULL, "", " ", - "\0", - array(), /* prefix with path separator of a non existing directory*/ "/no/such/file/dir", @@ -97,24 +95,6 @@ bool(true) Warning: rename( ,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d bool(false) --- testing '%s' -- - -Warning: rename() %s in %s on line %d -bool(false) - -Warning: file_exists() expects parameter 1 to be a valid path, string given in %s on line %d - -Warning: rename() expects parameter 1 to be a valid path, string given in %s on line %d -bool(false) --- testing 'Array' -- - -Warning: rename() expects parameter 2 to be a valid path, array given in %s on line %d -bool(false) - -Warning: file_exists() expects parameter 1 to be a valid path, array given in %s on line %d - -Warning: rename() expects parameter 1 to be a valid path, array given in %s on line %d -bool(false) -- testing '/no/such/file/dir' -- Warning: rename(%s/renameVar13/afile.tmp,/no/such/file/dir): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/stat_error-win32.phpt b/ext/standard/tests/file/stat_error-win32.phpt index 735a17cb26..3d4e367739 100644 --- a/ext/standard/tests/file/stat_error-win32.phpt +++ b/ext/standard/tests/file/stat_error-win32.phpt @@ -17,29 +17,16 @@ $file_path = __DIR__; $arr = array(__FILE__); echo "\n*** Testing stat() for error conditions ***\n"; -var_dump( stat() ); // args < expected -var_dump( stat(__FILE__, 2) ); // file, args > expected -var_dump( stat(__DIR__, 2) ); //dir, args > expected var_dump( stat("$file_path/temp.tmp") ); // non existing file var_dump( stat("$file_path/temp/") ); // non existing dir var_dump( stat(22) ); // scalar argument -var_dump( stat($arr) ); // array argument echo "Done\n"; ?> --EXPECTF-- *** Testing stat() for error conditions *** -Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: stat(): stat failed for %s in %s on line %d bool(false) @@ -48,7 +35,4 @@ bool(false) Warning: stat(): stat failed for 22 in %s on line %d bool(false) - -Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d -NULL Done diff --git a/ext/standard/tests/file/stream_002.phpt b/ext/standard/tests/file/stream_002.phpt index b18dd85b31..84f3b78f06 100644 --- a/ext/standard/tests/file/stream_002.phpt +++ b/ext/standard/tests/file/stream_002.phpt @@ -15,8 +15,6 @@ var_dump(stream_socket_client(".", $a, $b)); var_dump($a, $b); var_dump(stream_socket_client(1, $a, $b)); var_dump($a, $b); -var_dump(stream_socket_client(array(), $a, $b)); -var_dump($a, $b); echo "Done\n"; ?> @@ -45,9 +43,4 @@ Warning: stream_socket_client(): unable to connect to 1 (Failed to parse address bool(false) int(0) string(27) "Failed to parse address "1"" - -Warning: stream_socket_client() expects parameter 1 to be string, array given in %s on line %d -bool(false) -int(0) -string(27) "Failed to parse address "1"" Done diff --git a/ext/standard/tests/file/stream_rfc2397_002.phpt b/ext/standard/tests/file/stream_rfc2397_002.phpt index 1dce5adf6c..6c58d0d7ad 100644 --- a/ext/standard/tests/file/stream_rfc2397_002.phpt +++ b/ext/standard/tests/file/stream_rfc2397_002.phpt @@ -24,9 +24,11 @@ $streams = array( foreach($streams as $stream) { $stream = fopen($stream, 'r'); - $meta = @stream_get_meta_data($stream); - var_dump($meta); - var_dump(isset($meta['foo']) ? $meta['foo'] : null); + if ($stream) { + $meta = stream_get_meta_data($stream); + var_dump($meta); + var_dump(isset($meta['foo']) ? $meta['foo'] : null); + } } ?> @@ -52,8 +54,6 @@ array(7) { NULL Warning: fopen(data://): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d -NULL -NULL array(7) { ["base64"]=> bool(true) @@ -73,16 +73,10 @@ array(7) { NULL Warning: fopen(data://;base64): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d -NULL -NULL Warning: fopen(data://foo,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d -NULL -NULL Warning: fopen(data://foo=bar,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d -NULL -NULL array(8) { ["mediatype"]=> string(10) "text/plain" @@ -104,8 +98,6 @@ array(8) { NULL Warning: fopen(data://text/plain;foo,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d -NULL -NULL array(9) { ["mediatype"]=> string(10) "text/plain" @@ -129,8 +121,6 @@ array(9) { string(3) "bar" Warning: fopen(data://text/plain;foo=bar;bla,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d -NULL -NULL array(9) { ["mediatype"]=> string(10) "text/plain" @@ -154,8 +144,6 @@ array(9) { string(3) "bar" Warning: fopen(data://text/plain;foo=bar;bar=baz): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d -NULL -NULL array(10) { ["mediatype"]=> string(10) "text/plain" diff --git a/ext/standard/tests/file/stream_rfc2397_006.phpt b/ext/standard/tests/file/stream_rfc2397_006.phpt index f6616a0c88..18d1c1b280 100644 --- a/ext/standard/tests/file/stream_rfc2397_006.phpt +++ b/ext/standard/tests/file/stream_rfc2397_006.phpt @@ -14,18 +14,19 @@ $streams = array( foreach($streams as $stream) { - var_dump(file_get_contents($stream)); + try { + var_dump(file_get_contents($stream)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } ?> ===DONE=== <?php exit(0); ?> --EXPECTF-- -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d -NULL - -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, string given +file_get_contents() expects parameter 1 to be a valid path, string given Warning: file_get_contents(data:;base64,#Zm9vYmFyIGZvb2Jhcg==): failed to open stream: rfc2397: unable to decode in %sstream_rfc2397_006.php on line %d bool(false) diff --git a/ext/standard/tests/file/stream_supports_lock.phpt b/ext/standard/tests/file/stream_supports_lock.phpt index 38a84dd7c2..0d2f04b72d 100644 --- a/ext/standard/tests/file/stream_supports_lock.phpt +++ b/ext/standard/tests/file/stream_supports_lock.phpt @@ -26,7 +26,11 @@ fclose($fp); $sock = stream_context_create(); var_dump($sock); -var_dump(stream_supports_lock($sock)); +try { + var_dump(stream_supports_lock($sock)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -40,7 +44,5 @@ bool(false) resource(%d) of type (stream) bool(false) resource(%d) of type (stream-context) - -Warning: stream_supports_lock(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +stream_supports_lock(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt index ddee40ecdd..6ee0f8aca7 100644 --- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt +++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt @@ -33,11 +33,6 @@ fclose($fp); $linkname = __DIR__."/symlink_link_linkinfo_is_link_link_error1.tmp"; echo "*** Testing symlink() for error conditions ***\n"; -//zero arguments -var_dump( symlink() ); - -//more than expected -var_dump( symlink($filename, $linkname, true) ); //invalid arguments var_dump( symlink(NULL, $linkname) ); // NULL as filename @@ -48,11 +43,6 @@ var_dump( symlink($filename, '') ); // '' as linkname var_dump( symlink($filename, false) ); // false as linkname echo "\n*** Testing linkinfo() for error conditions ***\n"; -//zero arguments -var_dump( linkinfo() ); - -//more than expected -var_dump( linkinfo($linkname, true) ); //invalid arguments var_dump( linkinfo(NULL) ); // NULL as linkname @@ -69,12 +59,6 @@ unlink(__DIR__."/symlink_link_linkinfo_is_link_error1.tmp"); --EXPECTF-- *** Testing symlink() for error conditions *** -Warning: symlink() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: symlink() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: symlink(): %s in %s on line %d bool(false) @@ -95,12 +79,6 @@ bool(false) *** Testing linkinfo() for error conditions *** -Warning: linkinfo() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: linkinfo() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: linkinfo(): %s in %s on line %d int(-1) diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt index 7e22741aa8..287ac4eb5f 100644 --- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt +++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt @@ -30,11 +30,6 @@ fclose($fp); $linkname = __DIR__."/symlink_link_linkinfo_is_link_link_error2.tmp"; echo "*** Testing link() for error conditions ***\n"; -//zero arguments -var_dump( link() ); - -//more than expected -var_dump( link($filename, $linkname, false) ); //invalid arguments var_dump( link(NULL, $linkname) ); // NULL as filename @@ -46,11 +41,6 @@ var_dump( link($filename, '') ); // '' as linkname var_dump( link($filename, false) ); // false as linkname echo "\n*** Testing is_link() for error conditions ***\n"; -//zero arguments -var_dump( is_link() ); - -//more than expected -var_dump( is_link($linkname, "/") ); //invalid arguments var_dump( is_link(NULL) ); // NULL as linkname @@ -68,12 +58,6 @@ unlink(__DIR__."/symlink_link_linkinfo_is_link_error2.tmp"); --EXPECTF-- *** Testing link() for error conditions *** -Warning: link() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: link() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: link(): No such file or directory in %s on line %d bool(false) @@ -96,12 +80,6 @@ Warning: link(): No such file or directory in %s on line %d bool(false) *** Testing is_link() for error conditions *** - -Warning: is_link() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_link() expects exactly 1 parameter, 2 given in %s on line %d -NULL bool(false) bool(false) bool(false) diff --git a/ext/standard/tests/file/tempnam_variation3-win32.phpt b/ext/standard/tests/file/tempnam_variation3-win32.phpt index c79aabfb62..ac22017a65 100644 --- a/ext/standard/tests/file/tempnam_variation3-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt @@ -59,7 +59,12 @@ $res_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam($file_path, $names_arr[$i]); + try { + $file_name = tempnam($file_path, $names_arr[$i]); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } /* creating the files in existing dir */ if (file_exists($file_name) && !$res_arr[$i]) { @@ -104,14 +109,9 @@ Notice: tempnam(): file created in the system's temporary directory in %stempnam Failed, not created in the correct directory %s vs %s 0 -- Iteration 6 -- - -Warning: tempnam() expects parameter 2 to be a valid path, string given in %stempnam_variation3-win32.php on line 54 -Failed, not created in the correct directory %s vs %sext\standard\tests\file\tempnamVar3 -0 +tempnam() expects parameter 2 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 2 to be a valid path, array given in %s\ext\standard\tests\file\tempnam_variation3-win32.php on line %d -OK +tempnam() expects parameter 2 to be a valid path, array given -- Iteration 8 -- OK -- Iteration 9 -- diff --git a/ext/standard/tests/file/tempnam_variation3.phpt b/ext/standard/tests/file/tempnam_variation3.phpt index 856667fa49..0a267c509e 100644 --- a/ext/standard/tests/file/tempnam_variation3.phpt +++ b/ext/standard/tests/file/tempnam_variation3.phpt @@ -37,7 +37,12 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam("$file_path", $names_arr[$i]); + try { + $file_name = tempnam("$file_path", $names_arr[$i]); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } /* creating the files in existing dir */ if( file_exists($file_name) ) { @@ -100,17 +105,9 @@ File name is => %s/%s File permissions are => 100600 File created in => directory specified -- Iteration 6 -- - -Warning: tempnam() expects parameter 2 to be a valid path, string given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 2 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 2 to be a valid path, array given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 2 to be a valid path, array given -- Iteration 8 -- File name is => %s/dir%s File permissions are => 100600 diff --git a/ext/standard/tests/file/tempnam_variation7-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt index 5bacb5e876..f4b3cf016c 100644 --- a/ext/standard/tests/file/tempnam_variation7-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt @@ -34,7 +34,12 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + try { + $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } if( file_exists($file_name) ){ @@ -95,17 +100,9 @@ File name is => %s%et%s File permissions are => 100666 File created in => temp dir -- Iteration 6 -- - -Warning: tempnam() expects parameter 1 to be a valid path, string given in %stempnam_variation7-win32.php on line %d --- File is not created -- - -Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d +tempnam() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d --- File is not created -- - -Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d +tempnam() expects parameter 1 to be a valid path, array given -- Iteration 8 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt index 9ed84f974a..680e207718 100644 --- a/ext/standard/tests/file/tempnam_variation7.phpt +++ b/ext/standard/tests/file/tempnam_variation7.phpt @@ -35,7 +35,12 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + try { + $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } if( file_exists($file_name) ){ @@ -100,17 +105,9 @@ File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir -- Iteration 6 -- - -Warning: tempnam() expects parameter 1 to be a valid path, string given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 1 to be a valid path, array given -- Iteration 8 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d diff --git a/ext/standard/tests/file/touch.phpt b/ext/standard/tests/file/touch.phpt index e0b06d3960..0474b34af2 100644 --- a/ext/standard/tests/file/touch.phpt +++ b/ext/standard/tests/file/touch.phpt @@ -13,7 +13,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { // output to linux. This could be a php.net bug on windows or a windows querk. $filename = __DIR__."/touch.dat"; -var_dump(touch()); var_dump(touch($filename)); var_dump(filemtime($filename)); @unlink($filename); @@ -39,8 +38,6 @@ var_dump(touch("/no/such/file/or/directory")); echo "Done\n"; ?> --EXPECTF-- -Warning: touch() expects at least 1 parameter, 0 given in %s on line %d -NULL bool(true) int(%d) bool(true) diff --git a/ext/standard/tests/file/touch_error.phpt b/ext/standard/tests/file/touch_error.phpt index 0520055a90..9a4bd01e13 100644 --- a/ext/standard/tests/file/touch_error.phpt +++ b/ext/standard/tests/file/touch_error.phpt @@ -5,17 +5,9 @@ Dave Kelsey <d_kelsey@uk.ibm.com> --FILE-- <?php -var_dump(touch()); -var_dump(touch(1, 2, 3, 4)); var_dump(touch("/no/such/file/or/directory")); ?> --EXPECTF-- -Warning: touch() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - Warning: touch(): Unable to create file /no/such/file/or/directory because No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/unlink_error-win32-mb.phpt b/ext/standard/tests/file/unlink_error-win32-mb.phpt index a208e5675b..833c083b19 100644 --- a/ext/standard/tests/file/unlink_error-win32-mb.phpt +++ b/ext/standard/tests/file/unlink_error-win32-mb.phpt @@ -25,13 +25,6 @@ $context = stream_context_create(); echo "*** Testing unlink() : error conditions ***\n"; -echo "-- Testing unlink() on unexpected no. of arguments --\n"; -// arg < expected -var_dump( unlink() ); -// args > expected -var_dump( unlink($filename, $context, true) ); -var_dump( file_exists($filename) ); // expected: true - echo "\n-- Testing unlink() on invalid arguments --\n"; // invalid arguments var_dump( unlink('') ); // $filename as empty string @@ -43,9 +36,6 @@ var_dump( file_exists(NULL) ); // confirm file doesnt exist var_dump( unlink(false) ); // $filename as boolean false var_dump( file_exists(false) ); // confirm file doesnt exist -var_dump( unlink($filename, '') ); // $context as empty string -var_dump( unlink($filename, false) ); // $context as boolean false - echo "\n-- Testing unlink() on non-existent file --\n"; var_dump( unlink(__DIR__."/non_existent_file.tmp") ); @@ -68,14 +58,6 @@ rmdir(__DIR__."/私はガラスを食べられます"); ?> --EXPECTF-- *** Testing unlink() : error conditions *** --- Testing unlink() on unexpected no. of arguments -- - -Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -bool(true) -- Testing unlink() on invalid arguments -- @@ -91,12 +73,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d -bool(false) - -Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d -bool(false) - -- Testing unlink() on non-existent file -- Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/unlink_error-win32.phpt b/ext/standard/tests/file/unlink_error-win32.phpt index d62c715a94..535b3d0adf 100644 --- a/ext/standard/tests/file/unlink_error-win32.phpt +++ b/ext/standard/tests/file/unlink_error-win32.phpt @@ -23,13 +23,6 @@ $context = stream_context_create(); echo "*** Testing unlink() : error conditions ***\n"; -echo "-- Testing unlink() on unexpected no. of arguments --\n"; -// arg < expected -var_dump( unlink() ); -// args > expected -var_dump( unlink($filename, $context, true) ); -var_dump( file_exists($filename) ); // expected: true - echo "\n-- Testing unlink() on invalid arguments --\n"; // invalid arguments var_dump( unlink('') ); // $filename as empty string @@ -41,9 +34,6 @@ var_dump( file_exists(NULL) ); // confirm file doesnt exist var_dump( unlink(false) ); // $filename as boolean false var_dump( file_exists(false) ); // confirm file doesnt exist -var_dump( unlink($filename, '') ); // $context as empty string -var_dump( unlink($filename, false) ); // $context as boolean false - echo "\n-- Testing unlink() on non-existent file --\n"; var_dump( unlink(__DIR__."/non_existent_file.tmp") ); @@ -65,14 +55,6 @@ rmdir(__DIR__."/unlink_error"); ?> --EXPECTF-- *** Testing unlink() : error conditions *** --- Testing unlink() on unexpected no. of arguments -- - -Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -bool(true) -- Testing unlink() on invalid arguments -- @@ -88,12 +70,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d -bool(false) - -Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d -bool(false) - -- Testing unlink() on non-existent file -- Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/unlink_error.phpt b/ext/standard/tests/file/unlink_error.phpt index 61aac03dd3..df5b5b9755 100644 --- a/ext/standard/tests/file/unlink_error.phpt +++ b/ext/standard/tests/file/unlink_error.phpt @@ -23,13 +23,6 @@ $context = stream_context_create(); echo "*** Testing unlink() : error conditions ***\n"; -echo "-- Testing unlink() on unexpected no. of arguments --\n"; -// arg < expected -var_dump( unlink() ); -// args > expected -var_dump( unlink($filename, $context, true) ); -var_dump( file_exists($filename) ); // expected true - echo "\n-- Testing unlink() on invalid arguments --\n"; // invalid arguments var_dump( unlink('') ); // $filename as empty string @@ -41,10 +34,6 @@ var_dump( file_exists(NULL) ); // confirm file doesnt exist var_dump( unlink(false) ); // $filename as boolean false var_dump( file_exists(false) ); // confirm file doesnt exist -var_dump( unlink($filename, '') ); // $context as empty string -var_dump( unlink($filename, false) ); // $context as boolean false - - echo "\n-- Testing unlink() on non-existent file --\n"; var_dump( unlink(__DIR__."/non_existent_file.tmp") ); @@ -65,14 +54,6 @@ rmdir(__DIR__."/unlink_error"); ?> --EXPECTF-- *** Testing unlink() : error conditions *** --- Testing unlink() on unexpected no. of arguments -- - -Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -bool(true) -- Testing unlink() on invalid arguments -- @@ -88,12 +69,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d -bool(false) - -Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d -bool(false) - -- Testing unlink() on non-existent file -- Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/userstreams_002.phpt b/ext/standard/tests/file/userstreams_002.phpt index 81f463ddd2..3068c93b46 100644 --- a/ext/standard/tests/file/userstreams_002.phpt +++ b/ext/standard/tests/file/userstreams_002.phpt @@ -22,7 +22,11 @@ function test($name, $fd, $return_value) { $data['wrapper_data']->return_value = $return_value; $r = array($fd); $w = $e = null; - var_dump(stream_select($r, $w, $e, 0) !== false); + try { + var_dump(stream_select($r, $w, $e, 0) !== false); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } var_dump(stream_wrapper_register('test', 'test_wrapper')); @@ -64,14 +68,12 @@ bool(false) ------ return value not a stream resource: ------- -Warning: stream_select(): supplied argument is not a valid stream resource in %s - Warning: stream_select(): test_wrapper::stream_cast must return a stream resource in %s Warning: stream_select(): cannot represent a stream of type user-space as a select()able descriptor in %s Warning: stream_select(): No stream arrays were passed in %s -bool(false) +stream_select(): supplied argument is not a valid stream resource ------ return value is stream itself: ------- diff --git a/ext/standard/tests/filters/001.phpt b/ext/standard/tests/filters/001.phpt index fbfdda2385..53d9fc2b50 100644 --- a/ext/standard/tests/filters/001.phpt +++ b/ext/standard/tests/filters/001.phpt @@ -7,8 +7,6 @@ var_dump(stream_filter_register("", "")); var_dump(stream_filter_register("test", "")); var_dump(stream_filter_register("", "test")); var_dump(stream_filter_register("------", "nonexistentclass")); -var_dump(stream_filter_register(array(), "aa")); -var_dump(stream_filter_register("", array())); echo "Done\n"; ?> @@ -22,10 +20,4 @@ bool(false) Warning: stream_filter_register(): Filter name cannot be empty in %s on line %d bool(false) bool(true) - -Warning: stream_filter_register() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: stream_filter_register() expects parameter 2 to be string, array given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/filters/php_user_filter_01.phpt b/ext/standard/tests/filters/php_user_filter_01.phpt index ff5a51f5be..fb47177f4c 100644 --- a/ext/standard/tests/filters/php_user_filter_01.phpt +++ b/ext/standard/tests/filters/php_user_filter_01.phpt @@ -14,4 +14,4 @@ class bar extends php_user_filter { } ?> --EXPECTF-- -Warning: Declaration of bar::filter($in, $out, &$consumed) should be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d +Fatal error: Declaration of bar::filter($in, $out, &$consumed) must be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d diff --git a/ext/standard/tests/filters/php_user_filter_02.phpt b/ext/standard/tests/filters/php_user_filter_02.phpt index bdd73c01a8..fd0822153b 100644 --- a/ext/standard/tests/filters/php_user_filter_02.phpt +++ b/ext/standard/tests/filters/php_user_filter_02.phpt @@ -9,4 +9,4 @@ class foo extends php_user_filter { } ?> --EXPECTF-- -Warning: Declaration of foo::filter($in, $out, $consumed, $closing) should be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d +Fatal error: Declaration of foo::filter($in, $out, $consumed, $closing) must be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d diff --git a/ext/standard/tests/filters/php_user_filter_03.phpt b/ext/standard/tests/filters/php_user_filter_03.phpt index 867b74eb89..a89637d4cc 100644 --- a/ext/standard/tests/filters/php_user_filter_03.phpt +++ b/ext/standard/tests/filters/php_user_filter_03.phpt @@ -9,4 +9,4 @@ class foo extends php_user_filter { } ?> --EXPECTF-- -Warning: Declaration of foo::onCreate($var) should be compatible with php_user_filter::onCreate() in %s on line %d +Fatal error: Declaration of foo::onCreate($var) must be compatible with php_user_filter::onCreate() in %s on line %d diff --git a/ext/standard/tests/filters/stream_filter_remove_error.phpt b/ext/standard/tests/filters/stream_filter_remove_error.phpt index 9513319f57..07de5acf0c 100644 --- a/ext/standard/tests/filters/stream_filter_remove_error.phpt +++ b/ext/standard/tests/filters/stream_filter_remove_error.phpt @@ -20,16 +20,6 @@ $filter = stream_filter_append( $fp, "string.rot13", STREAM_FILTER_WRITE ); echo "*** Testing stream_filter_remove() : error conditions ***\n"; -echo "\n-- Testing stream_filter_remove() function with Zero arguments --\n"; -var_dump( stream_filter_remove() ); - -echo "\n-- Testing stream_filter_remove() function with more than expected no. of arguments --\n"; -$arg = 'bogus arg'; -var_dump( stream_filter_remove( $filter, $arg ) ); - -echo "\n-- Testing stream_filter_remove() function with unexisting stream filter --\n"; -var_dump( stream_filter_remove( "fakefilter" ) ); - echo "\n-- Testing stream_filter_remove() function with bad resource --\n"; var_dump( stream_filter_remove( $fp ) ); @@ -52,21 +42,6 @@ unlink( $file ); --EXPECTF-- *** Testing stream_filter_remove() : error conditions *** --- Testing stream_filter_remove() function with Zero arguments -- - -Warning: stream_filter_remove() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing stream_filter_remove() function with more than expected no. of arguments -- - -Warning: stream_filter_remove() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - --- Testing stream_filter_remove() function with unexisting stream filter -- - -Warning: stream_filter_remove() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -- Testing stream_filter_remove() function with bad resource -- Warning: stream_filter_remove(): Invalid resource given, not a stream filter in %s on line %d diff --git a/ext/standard/tests/filters/strip_tags_filter.phpt b/ext/standard/tests/filters/strip_tags_filter.phpt deleted file mode 100644 index f353e79a9a..0000000000 --- a/ext/standard/tests/filters/strip_tags_filter.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -string.strip_tags filter ---FILE-- -<?php -$fp = fopen('php://output', 'w'); -stream_filter_append($fp, 'string.strip_tags'); -fwrite($fp, "test <b>bold</b> <i>italic</i> test\n"); -fclose($fp); - -$fp = fopen('php://output', 'w'); -stream_filter_append($fp, 'string.strip_tags', STREAM_FILTER_WRITE, "<b>"); -fwrite($fp, "test <b>bold</b> <i>italic</i> test\n"); -fclose($fp); - -$fp = fopen('php://output', 'w'); -stream_filter_append($fp, 'string.strip_tags', STREAM_FILTER_WRITE, ["b"]); -fwrite($fp, "test <b>bold</b> <i>italic</i> test\n"); -fclose($fp); - -?> ---EXPECTF-- -Deprecated: stream_filter_append(): The string.strip_tags filter is deprecated in %s on line %d -test bold italic test - -Deprecated: stream_filter_append(): The string.strip_tags filter is deprecated in %s on line %d -test <b>bold</b> italic test - -Deprecated: stream_filter_append(): The string.strip_tags filter is deprecated in %s on line %d -test <b>bold</b> italic test diff --git a/ext/standard/tests/general_functions/010.phpt b/ext/standard/tests/general_functions/010.phpt index 51132c6a15..99971616d2 100644 --- a/ext/standard/tests/general_functions/010.phpt +++ b/ext/standard/tests/general_functions/010.phpt @@ -3,24 +3,19 @@ register_shutdown_function() & __call --FILE-- <?php class test { - function _foo() { - throw new Exception('test'); - } - function __call($name=null, $args=null) { - return test::_foo(); - } + function _foo() { + throw new Exception('test'); + } + function __call($name=null, $args=null) { + return test::_foo(); + } } -try { - var_dump(register_shutdown_function(array("test","__call"))); -} catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; -} +var_dump(register_shutdown_function(array("test","__call"))); echo "Done\n"; ?> --EXPECTF-- -Exception: Non-static method test::__call() cannot be called statically +Warning: register_shutdown_function(): Invalid shutdown callback 'test::__call' passed in %s on line %d +bool(false) Done - -Fatal error: Non-static method test::__call() cannot be called statically in %s on line %d diff --git a/ext/standard/tests/general_functions/bug32647.phpt b/ext/standard/tests/general_functions/bug32647.phpt index c6ff94833d..a9d84e798b 100644 --- a/ext/standard/tests/general_functions/bug32647.phpt +++ b/ext/standard/tests/general_functions/bug32647.phpt @@ -46,13 +46,8 @@ Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed Warning: register_shutdown_function(): Invalid shutdown callback 'bar' passed in %s on line %d -Deprecated: Non-static method bar::barfoo() should not be called statically in %sbug32647.php on line %d +Warning: register_shutdown_function(): Invalid shutdown callback 'bar::barfoo' passed in %sbug32647.php on line %d Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foobar' passed in %sbug32647.php on line %d foo! - -Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0 - -Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0 -bar! bar! diff --git a/ext/standard/tests/general_functions/bug41970.phpt b/ext/standard/tests/general_functions/bug41970.phpt index 6f05137afc..f43bf64380 100644 --- a/ext/standard/tests/general_functions/bug41970.phpt +++ b/ext/standard/tests/general_functions/bug41970.phpt @@ -6,22 +6,26 @@ Bug #41970 (call_user_func_*() leaks on failure) $a = array(4,3,2); var_dump(call_user_func_array("sort", array($a))); -var_dump(call_user_func_array("strlen", array($a))); +try { + var_dump(call_user_func_array("strlen", array($a))); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(call_user_func("sort", $a)); -var_dump(call_user_func("strlen", $a)); +try { + var_dump(call_user_func("strlen", $a)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> --EXPECTF-- -Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 5 +Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line %d bool(true) +strlen() expects parameter 1 to be string, array given -Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 6 -NULL - -Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 7 +Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line %d bool(true) - -Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 8 -NULL +strlen() expects parameter 1 to be string, array given Done diff --git a/ext/standard/tests/general_functions/bug47857.phpt b/ext/standard/tests/general_functions/bug47857.phpt index d19eca7248..c06673bc34 100644 --- a/ext/standard/tests/general_functions/bug47857.phpt +++ b/ext/standard/tests/general_functions/bug47857.phpt @@ -8,18 +8,20 @@ class foo { } } var_dump(is_callable(array('foo','bar'))); -foo::bar(); +try { + foo::bar(); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} var_dump(is_callable(array('Exception','getMessage'))); -Exception::getMessage(); +try { + Exception::getMessage(); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -bool(true) - -Deprecated: Non-static method foo::bar() should not be called statically in %sbug47857.php on line %d -ok +--EXPECT-- +bool(false) +Non-static method foo::bar() cannot be called statically bool(false) - -Fatal error: Uncaught Error: Non-static method Exception::getMessage() cannot be called statically in %sbug47857.php:%d -Stack trace: -#0 {main} - thrown in %sbug47857.php on line %d +Non-static method Exception::getMessage() cannot be called statically diff --git a/ext/standard/tests/general_functions/bug70018.phpt b/ext/standard/tests/general_functions/bug70018.phpt index f7aefcc03f..77df0417a6 100644 --- a/ext/standard/tests/general_functions/bug70018.phpt +++ b/ext/standard/tests/general_functions/bug70018.phpt @@ -1,11 +1,5 @@ --TEST-- Bug #70018 (exec does not strip all whitespace) ---SKIPIF-- -<?php -if ("cli" != php_sapi_name()) { - die("skip.. CLI only test"); -} -?> --FILE-- <?php $output = array(); diff --git a/ext/standard/tests/general_functions/callbacks_001.phpt b/ext/standard/tests/general_functions/callbacks_001.phpt index a58f19d932..76d0e94c82 100644 --- a/ext/standard/tests/general_functions/callbacks_001.phpt +++ b/ext/standard/tests/general_functions/callbacks_001.phpt @@ -69,7 +69,11 @@ class P extends O { $this->call(array('parent', 'who')); $this->call(array('P', 'parent::who')); $this->call(array($this, 'O::who')); - $this->call(array($this, 'B::who')); + try { + $this->call(array($this, 'B::who')); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } } @@ -103,6 +107,5 @@ O $this|O::who O $this|B::who - -Warning: call_user_func() expects parameter 1 to be a valid callback, class 'P' is not a subclass of 'B' in %s on line %d +call_user_func() expects parameter 1 to be a valid callback, class 'P' is not a subclass of 'B' ===DONE=== diff --git a/ext/standard/tests/general_functions/callbacks_002.phpt b/ext/standard/tests/general_functions/callbacks_002.phpt index 22130c524a..0d44035e0e 100644 --- a/ext/standard/tests/general_functions/callbacks_002.phpt +++ b/ext/standard/tests/general_functions/callbacks_002.phpt @@ -3,14 +3,24 @@ call_user_func(): Wrong parameters --FILE-- <?php -call_user_func(array('Foo', 'bar')); -call_user_func(array(NULL, 'bar')); -call_user_func(array('stdclass', NULL)); +try { + call_user_func(array('Foo', 'bar')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + call_user_func(array(NULL, 'bar')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + call_user_func(array('stdclass', NULL)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- -Warning: call_user_func() expects parameter 1 to be a valid callback, class 'Foo' not found in %s on line %d - -Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d - -Warning: call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method in %s on line %d +call_user_func() expects parameter 1 to be a valid callback, class 'Foo' not found +call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object +call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method diff --git a/ext/standard/tests/general_functions/error_get_last.phpt b/ext/standard/tests/general_functions/error_get_last.phpt index 71f068f104..e6cea73f4d 100644 --- a/ext/standard/tests/general_functions/error_get_last.phpt +++ b/ext/standard/tests/general_functions/error_get_last.phpt @@ -4,7 +4,11 @@ error_get_last() tests <?php var_dump(error_get_last()); -var_dump(error_get_last(true)); +try { + var_dump(error_get_last(true)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(error_get_last()); $a = $b; @@ -15,19 +19,8 @@ echo "Done\n"; ?> --EXPECTF-- NULL - -Warning: error_get_last() expects exactly 0 parameters, 1 given in %s on line %d +error_get_last() expects exactly 0 parameters, 1 given NULL -array(4) { - ["type"]=> - int(2) - ["message"]=> - string(54) "error_get_last() expects exactly 0 parameters, 1 given" - ["file"]=> - string(%i) "%s" - ["line"]=> - int(4) -} Notice: Undefined variable: b in %s on line %d array(4) { @@ -38,6 +31,6 @@ array(4) { ["file"]=> string(%i) "%s" ["line"]=> - int(7) + int(11) } Done diff --git a/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt b/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt index cbb3f6fcc4..b6bc828a87 100644 --- a/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt +++ b/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt @@ -7,4 +7,8 @@ escapeshellarg("hello\0world"); ?> ===DONE=== --EXPECTF-- -Fatal error: escapeshellarg(): Input string contains NULL bytes in %s on line %d +Fatal error: Uncaught TypeError: Input string contains NULL bytes in %s:%d +Stack trace: +#0 %s(%d): escapeshellarg('hello\x00world') +#1 {main} + thrown in %s on line %d diff --git a/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt b/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt index 0a4d7eacff..7ce31fb8dd 100644 --- a/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt +++ b/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt @@ -7,4 +7,8 @@ escapeshellcmd("hello\0world"); ?> ===DONE=== --EXPECTF-- -Fatal error: escapeshellcmd(): Input string contains NULL bytes in %s on line %d +Fatal error: Uncaught TypeError: Input string contains NULL bytes in %s:%d +Stack trace: +#0 %s(%d): escapeshellcmd('hello\x00world') +#1 {main} + thrown in %s on line %d diff --git a/ext/standard/tests/general_functions/floatval.phpt b/ext/standard/tests/general_functions/floatval.phpt index a01e01dbf1..f6f354509a 100644 --- a/ext/standard/tests/general_functions/floatval.phpt +++ b/ext/standard/tests/general_functions/floatval.phpt @@ -91,18 +91,6 @@ foreach ($not_float_types as $type ) { var_dump( doubleval($type) ); } - - - -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( floatval() ); -var_dump( doubleval() ); - -//arguments more than expected -var_dump( floatval(TRUE, FALSE) ); -var_dump( doubleval(TRUE, FALSE) ); - echo "\nDone\n"; @@ -194,18 +182,4 @@ float(1) float(0) float(0) -*** Testing error conditions *** - -Warning: floatval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: doubleval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: floatval() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: doubleval() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt index 33d4af03d2..c74e4f71fe 100644 --- a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt +++ b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt @@ -14,10 +14,14 @@ $result = get_extension_funcs("standard"); var_dump(gettype($result)); var_dump(in_array("cos", $result)); +// Unknown extension +var_dump(get_extension_funcs("foo")); + ?> ===DONE=== --EXPECT-- Simple testcase for get_extension_funcs() function string(5) "array" bool(true) +bool(false) ===DONE=== diff --git a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt b/ext/standard/tests/general_functions/get_extension_funcs_error.phpt deleted file mode 100644 index 44bd822d12..0000000000 --- a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Test get_extension_funcs() function : error conditions ---FILE-- -<?php -/* Prototype : array get_extension_funcs ( string $module_name ) - * Description: Returns an array with the names of the functions of a module. - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -echo "*** Testing get_extension_funcs() : error conditions ***\n"; - -echo "\n-- Too few arguments --\n"; -var_dump(get_extension_funcs()); - -$extra_arg = 1; -echo "\n-- Too many arguments --\n"; -var_dump(get_extension_funcs("standard", $extra_arg)); - -echo "\n-- Invalid extension name --\n"; -var_dump(get_extension_funcs("foo")); - -?> -===DONE=== ---EXPECTF-- -*** Testing get_extension_funcs() : error conditions *** - --- Too few arguments -- - -Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Too many arguments -- - -Warning: get_extension_funcs() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Invalid extension name -- -bool(false) -===DONE=== diff --git a/ext/standard/tests/general_functions/get_include_path_basic.phpt b/ext/standard/tests/general_functions/get_include_path_basic.phpt index 2017bf697a..5b45c86449 100644 --- a/ext/standard/tests/general_functions/get_include_path_basic.phpt +++ b/ext/standard/tests/general_functions/get_include_path_basic.phpt @@ -19,19 +19,10 @@ if (ini_get("include_path") == get_include_path()) { echo "FAILED\n"; } -echo "\nError cases:\n"; -var_dump(get_include_path(TRUE)); - - ?> ===DONE=== --EXPECTF-- *** Testing get_include_path() string(1) "." PASSED - -Error cases: - -Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/get_included_files.phpt b/ext/standard/tests/general_functions/get_included_files.phpt index df41ec8513..36719fa933 100644 --- a/ext/standard/tests/general_functions/get_included_files.phpt +++ b/ext/standard/tests/general_functions/get_included_files.phpt @@ -22,9 +22,6 @@ include(__DIR__."/get_included_files_inc2.inc"); echo "\n-- List included files atfter including inc2 which will include inc3 which includes inc1 --\n"; var_dump(get_included_files()); -echo "\n-- Error cases --\n"; -var_dump(get_included_files(true)); - ?> ===DONE=== --EXPECTF-- @@ -55,9 +52,4 @@ array(4) { [3]=> string(%d) "%sget_included_files_inc3.inc" } - --- Error cases -- - -Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/getrusage.phpt b/ext/standard/tests/general_functions/getrusage.phpt index 4caca88e1b..8ec131809f 100644 --- a/ext/standard/tests/general_functions/getrusage.phpt +++ b/ext/standard/tests/general_functions/getrusage.phpt @@ -8,16 +8,12 @@ getrusage() tests var_dump(gettype(getrusage())); var_dump(gettype(getrusage(1))); var_dump(gettype(getrusage(-1))); -var_dump(getrusage(array())); echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- string(5) "array" string(5) "array" string(5) "array" - -Warning: getrusage() expects parameter 1 to be int, array given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/getservbyport_variation1.phpt b/ext/standard/tests/general_functions/getservbyport_variation1.phpt index a876ac1fea..f387161bf4 100644 --- a/ext/standard/tests/general_functions/getservbyport_variation1.phpt +++ b/ext/standard/tests/general_functions/getservbyport_variation1.phpt @@ -12,29 +12,13 @@ Simone Gentili (sensorario@gmail.com) var_dump(getservbyport( -1, "tcp" )); var_dump(getservbyport( 80, "ppp" )); var_dump(getservbyport( null, null)); - var_dump(getservbyport( array(), array())); - var_dump(getservbyport( array(80), array("tcp"))); - var_dump(getservbyport( array(2, 3), array("one"=>1, "two"=>2))); var_dump(getservbyport( 2, 2)); var_dump(getservbyport( "80", "tcp")); - var_dump(getservbyport( new stdClass(), new stdClass())); ?> --EXPECTF-- bool(false) bool(false) bool(false) - -Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d -NULL bool(false) string(%d) "%s" - -Warning: getservbyport() expects parameter 1 to be int, object given in %s on line %d -NULL diff --git a/ext/standard/tests/general_functions/gettype_settype_error.phpt b/ext/standard/tests/general_functions/gettype_settype_error.phpt index 325e91e47f..e204c64d4c 100644 --- a/ext/standard/tests/general_functions/gettype_settype_error.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_error.phpt @@ -13,19 +13,7 @@ Test gettype() & settype() functions : error conditions echo "**** Testing gettype() and settype() functions ****\n"; -echo "\n*** Testing gettype(): error conditions ***\n"; -//Zero arguments -var_dump( gettype() ); -// args more than expected -var_dump( gettype( "1", "2" ) ); - echo "\n*** Testing settype(): error conditions ***\n"; -//Zero arguments -var_dump( settype() ); - -// args more than expected -$var = 10.5; -var_dump( settype( $var, $var, "int" ) ); // passing an invalid type to set var_dump( settype( $var, "unknown" ) ); @@ -35,22 +23,8 @@ echo "Done\n"; --EXPECTF-- **** Testing gettype() and settype() functions **** -*** Testing gettype(): error conditions *** - -Warning: gettype() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: gettype() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing settype(): error conditions *** -Warning: settype() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: settype() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: settype(): Invalid type in %s on line %d bool(false) Done diff --git a/ext/standard/tests/general_functions/head.phpt b/ext/standard/tests/general_functions/head.phpt index 059c56b258..f8d4c28338 100644 --- a/ext/standard/tests/general_functions/head.phpt +++ b/ext/standard/tests/general_functions/head.phpt @@ -1,11 +1,5 @@ --TEST-- header() and friends ---SKIPIF-- -<?php -if (php_sapi_name() != "cli") { - die("skip this test is for CLI"); -} -?> --FILE-- <?php diff --git a/ext/standard/tests/general_functions/include_path.phpt b/ext/standard/tests/general_functions/include_path.phpt index 23c5bc45aa..ffadbc280c 100644 --- a/ext/standard/tests/general_functions/include_path.phpt +++ b/ext/standard/tests/general_functions/include_path.phpt @@ -6,14 +6,9 @@ include_path=. <?php var_dump(get_include_path()); -var_dump(get_include_path("var")); var_dump(restore_include_path()); -var_dump(restore_include_path("")); - -var_dump(set_include_path()); -var_dump(get_include_path()); var_dump(set_include_path("var")); var_dump(get_include_path()); @@ -32,9 +27,6 @@ var_dump(get_include_path()); var_dump(restore_include_path()); var_dump(get_include_path()); -var_dump(set_include_path(array())); -var_dump(get_include_path()); - var_dump(restore_include_path()); var_dump(get_include_path()); @@ -44,21 +36,9 @@ echo "Done\n"; --EXPECTF-- string(1) "." -Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Deprecated: Function restore_include_path() is deprecated in %s on line %d -NULL - Deprecated: Function restore_include_path() is deprecated in %s on line %d - -Warning: restore_include_path() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: set_include_path() expects exactly 1 parameter, 0 given in %s on line %d NULL string(1) "." -string(1) "." string(3) "var" Deprecated: Function restore_include_path() is deprecated in %s on line %d @@ -77,10 +57,6 @@ Deprecated: Function restore_include_path() is deprecated in %s on line %d NULL string(1) "." -Warning: set_include_path() expects parameter 1 to be a valid path, array given in %s on line %d -NULL -string(1) "." - Deprecated: Function restore_include_path() is deprecated in %s on line %d NULL string(1) "." diff --git a/ext/standard/tests/general_functions/intval.phpt b/ext/standard/tests/general_functions/intval.phpt index 1650b91c6f..c56bdd7b94 100644 --- a/ext/standard/tests/general_functions/intval.phpt +++ b/ext/standard/tests/general_functions/intval.phpt @@ -146,13 +146,6 @@ foreach ($not_int_types as $type ) { var_dump( intval($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( intval() ); - -//arguments more than expected -var_dump( intval(TRUE, FALSE, TRUE) ); - echo "\n--- Done ---\n"; @@ -295,12 +288,4 @@ int(0) int(0) int(0) -*** Testing error conditions *** - -Warning: intval() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: intval() expects at most 2 parameters, 3 given in %s on line %d -NULL - --- Done --- diff --git a/ext/standard/tests/general_functions/intval_variation1.phpt b/ext/standard/tests/general_functions/intval_variation1.phpt index e76d7083d4..e44bc1db80 100644 --- a/ext/standard/tests/general_functions/intval_variation1.phpt +++ b/ext/standard/tests/general_functions/intval_variation1.phpt @@ -11,8 +11,8 @@ Test intval() function : usage variation echo "*** Testing intval() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/standard/tests/general_functions/is_array.phpt b/ext/standard/tests/general_functions/is_array.phpt index 66e5b64934..200ecbd6ac 100644 --- a/ext/standard/tests/general_functions/is_array.phpt +++ b/ext/standard/tests/general_functions/is_array.phpt @@ -98,13 +98,6 @@ foreach ($varient_arrays as $type ) { var_dump( is_array ($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_array() ); - -//arguments more than expected -var_dump( is_array ($fp, $fp) ); - echo "Done\n"; /* close resources */ fclose($fp); @@ -202,12 +195,4 @@ bool(false) bool(false) -- Iteration 29 -- bool(false) - -*** Testing error conditions *** - -Warning: is_array() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_array() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_bool.phpt b/ext/standard/tests/general_functions/is_bool.phpt index 34d5e0ef6c..7c8d693a1b 100644 --- a/ext/standard/tests/general_functions/is_bool.phpt +++ b/ext/standard/tests/general_functions/is_bool.phpt @@ -127,13 +127,6 @@ foreach ($not_bool_types as $type ) { var_dump( is_bool($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_bool() ); - -//arguments more than expected -var_dump( is_bool(TRUE, FALSE) ); - echo "Done\n"; // close resources @@ -283,12 +276,4 @@ bool(false) bool(false) -- Iteration 65 -- bool(false) - -*** Testing error conditions *** - -Warning: is_bool() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_bool() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_callable_basic2.phpt b/ext/standard/tests/general_functions/is_callable_basic2.phpt index 7657875311..7b43191aab 100644 --- a/ext/standard/tests/general_functions/is_callable_basic2.phpt +++ b/ext/standard/tests/general_functions/is_callable_basic2.phpt @@ -207,12 +207,12 @@ object_class::func bool(false) object_class::func -- Innerloop iteration 10 of Outerloop iteration 1 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 2 --- -- Innerloop iteration 1 of Outerloop iteration 2 -- @@ -288,12 +288,12 @@ no_member_class::func bool(false) no_member_class::func -- Innerloop iteration 10 of Outerloop iteration 2 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 3 --- -- Innerloop iteration 1 of Outerloop iteration 3 -- @@ -369,12 +369,12 @@ contains_object_class::func bool(true) contains_object_class::func -- Innerloop iteration 10 of Outerloop iteration 3 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 4 --- -- Innerloop iteration 1 of Outerloop iteration 4 -- @@ -450,12 +450,12 @@ contains_object_class::func bool(true) contains_object_class::func -- Innerloop iteration 10 of Outerloop iteration 4 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 5 --- -- Innerloop iteration 1 of Outerloop iteration 5 -- @@ -531,12 +531,12 @@ object_class::func bool(false) object_class::func -- Innerloop iteration 10 of Outerloop iteration 5 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 6 --- -- Innerloop iteration 1 of Outerloop iteration 6 -- @@ -612,12 +612,12 @@ no_member_class::func bool(false) no_member_class::func -- Innerloop iteration 10 of Outerloop iteration 6 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 7 --- -- Innerloop iteration 1 of Outerloop iteration 7 -- @@ -693,12 +693,12 @@ object_class::func bool(false) object_class::func -- Innerloop iteration 10 of Outerloop iteration 7 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 8 --- -- Innerloop iteration 1 of Outerloop iteration 8 -- @@ -774,11 +774,11 @@ Array bool(false) Array -- Innerloop iteration 10 of Outerloop iteration 8 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 ===DONE=== diff --git a/ext/standard/tests/general_functions/is_countable_with_variables.phpt b/ext/standard/tests/general_functions/is_countable_with_variables.phpt index 700077ef17..0cb18769d6 100644 --- a/ext/standard/tests/general_functions/is_countable_with_variables.phpt +++ b/ext/standard/tests/general_functions/is_countable_with_variables.phpt @@ -7,7 +7,6 @@ Gabriel Caruso (carusogabriel34@gmail.com) var_dump(is_countable([1, 2, 3])); var_dump(is_countable((array) 1)); var_dump(is_countable((object) ['foo', 'bar', 'baz'])); -var_dump(is_countable()); $foo = ['', []]; @@ -24,9 +23,6 @@ if (!is_countable($bar)) { bool(true) bool(true) bool(false) - -Warning: is_countable() expects exactly 1 parameter, 0 given in %s on line %d -NULL int(2) Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d diff --git a/ext/standard/tests/general_functions/is_float.phpt b/ext/standard/tests/general_functions/is_float.phpt index 6d4ada6701..76cfa80565 100644 --- a/ext/standard/tests/general_functions/is_float.phpt +++ b/ext/standard/tests/general_functions/is_float.phpt @@ -127,17 +127,6 @@ foreach ($not_floats as $value ) { var_dump( @is_real($value) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_float() ); -var_dump( is_double() ); -var_dump( is_real() ); - -//arguments more than expected -var_dump( is_float( $floats[0], $floats[1]) ); -var_dump( is_double( $floats[0], $floats[1]) ); -var_dump( is_real( $floats[0], $floats[1]) ); - echo "Done\n"; // close the resources used @@ -417,28 +406,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Deprecated: Function is_real() is deprecated in %s on line %d - -Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Deprecated: Function is_real() is deprecated in %s on line %d - -Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_float_64bit.phpt b/ext/standard/tests/general_functions/is_float_64bit.phpt index be5843a7d5..dc6df0f109 100644 --- a/ext/standard/tests/general_functions/is_float_64bit.phpt +++ b/ext/standard/tests/general_functions/is_float_64bit.phpt @@ -129,17 +129,6 @@ foreach ($not_floats as $value ) { var_dump( @is_real($value) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_float() ); -var_dump( is_double() ); -var_dump( is_real() ); - -//arguments more than expected -var_dump( is_float( $floats[0], $floats[1]) ); -var_dump( is_double( $floats[0], $floats[1]) ); -var_dump( is_real( $floats[0], $floats[1]) ); - echo "Done\n"; ?> --EXPECTF-- @@ -414,28 +403,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Deprecated: Function is_real() is deprecated in %s on line %d - -Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Deprecated: Function is_real() is deprecated in %s on line %d - -Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_int.phpt b/ext/standard/tests/general_functions/is_int.phpt index 4cfbf653be..25e6c2564e 100644 --- a/ext/standard/tests/general_functions/is_int.phpt +++ b/ext/standard/tests/general_functions/is_int.phpt @@ -132,17 +132,6 @@ foreach ($not_int_types as $type ) { var_dump( is_long($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_int() ); -var_dump( is_integer() ); -var_dump( is_long() ); - -//arguments more than expected -var_dump( is_int(TRUE, FALSE) ); -var_dump( is_integer(TRUE, FALSE) ); -var_dump( is_long(TRUE, FALSE) ); - echo "Done\n"; // close the resources @@ -442,24 +431,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_int_64bit.phpt b/ext/standard/tests/general_functions/is_int_64bit.phpt index dabc7be705..e5c6ce77e0 100644 --- a/ext/standard/tests/general_functions/is_int_64bit.phpt +++ b/ext/standard/tests/general_functions/is_int_64bit.phpt @@ -134,17 +134,6 @@ foreach ($not_int_types as $type ) { var_dump( is_long($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_int() ); -var_dump( is_integer() ); -var_dump( is_long() ); - -//arguments more than expected -var_dump( is_int(TRUE, FALSE) ); -var_dump( is_integer(TRUE, FALSE) ); -var_dump( is_long(TRUE, FALSE) ); - echo "Done\n"; ?> --EXPECTF-- @@ -439,24 +428,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_null.phpt b/ext/standard/tests/general_functions/is_null.phpt index 9082f5fcd1..4fc325c744 100644 --- a/ext/standard/tests/general_functions/is_null.phpt +++ b/ext/standard/tests/general_functions/is_null.phpt @@ -127,13 +127,6 @@ foreach ($not_null_types as $type ) { var_dump( is_null($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_null() ); - -//arguments more than expected -var_dump( is_null(NULL, null) ); - echo "Done\n"; // close the resources used @@ -285,12 +278,4 @@ bool(false) bool(false) -- Iteration 59 -- bool(false) - -*** Testing error conditions *** - -Warning: is_null() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_null() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_numeric.phpt b/ext/standard/tests/general_functions/is_numeric.phpt index c23e5e3b8c..491aa5d15b 100644 --- a/ext/standard/tests/general_functions/is_numeric.phpt +++ b/ext/standard/tests/general_functions/is_numeric.phpt @@ -145,13 +145,6 @@ foreach ($not_numerics as $type ) { var_dump( is_numeric($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_numeric() ); - -//arguments more than expected -var_dump( is_numeric("10", "20") ); - echo "Done\n"; // close the resources used @@ -373,12 +366,4 @@ bool(false) bool(false) -- Iteration 29 -- bool(false) - -*** Testing error conditions *** - -Warning: is_numeric() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/is_object.phpt b/ext/standard/tests/general_functions/is_object.phpt index 96c515bf65..dd0e7689fd 100644 --- a/ext/standard/tests/general_functions/is_object.phpt +++ b/ext/standard/tests/general_functions/is_object.phpt @@ -138,13 +138,6 @@ foreach ($not_objects as $type ) { var_dump( is_object($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_object() ); - -//arguments more than expected -var_dump( is_object($myClass_object, $myClass_object) ); - echo "Done\n"; // close the resources used @@ -216,12 +209,4 @@ bool(false) bool(false) -- Iteration 19 -- bool(false) - -*** Testing error conditions *** - -Warning: is_object() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_object() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_scalar.phpt b/ext/standard/tests/general_functions/is_scalar.phpt index 53620178c4..f7ef3f5317 100644 --- a/ext/standard/tests/general_functions/is_scalar.phpt +++ b/ext/standard/tests/general_functions/is_scalar.phpt @@ -105,14 +105,6 @@ foreach( $variation_array as $value ) { var_dump( is_scalar($value) ); } -echo "\n*** Testing error conditions ***\n"; -// Zero arguments -var_dump( is_scalar() ); - -// Arguments more than expected -var_dump( is_scalar( $scalar_variables[2], $scalar_variables[2]) ); -var_dump( is_scalar( new stdclass, new stdclass) ); - echo "Done\n"; // close the resources used @@ -226,15 +218,4 @@ bool(false) bool(false) -- Iteration 18 -- bool(false) - -*** Testing error conditions *** - -Warning: is_scalar() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/is_string.phpt b/ext/standard/tests/general_functions/is_string.phpt index ea2fb36a24..a062cc17e1 100644 --- a/ext/standard/tests/general_functions/is_string.phpt +++ b/ext/standard/tests/general_functions/is_string.phpt @@ -140,13 +140,6 @@ foreach ($not_strings as $type ) { var_dump( is_string($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_string() ); - -//arguments more than expected -var_dump( is_string("string", "test") ); - echo "Done\n"; // close the resources used @@ -292,12 +285,4 @@ bool(false) bool(false) -- Iteration 45 -- bool(false) - -*** Testing error conditions *** - -Warning: is_string() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_string() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/ob_get_flush_error.phpt b/ext/standard/tests/general_functions/ob_get_flush_error.phpt index 0664043eba..5603e3d238 100644 --- a/ext/standard/tests/general_functions/ob_get_flush_error.phpt +++ b/ext/standard/tests/general_functions/ob_get_flush_error.phpt @@ -12,10 +12,6 @@ output_buffering=0 echo "*** Testing ob_get_flush() : error conditions ***\n"; -// One extra argument -$extra_arg = 10; -var_dump( ob_get_flush( $extra_arg ) ); - // No ob_start() executed var_dump( ob_get_flush() ); @@ -24,9 +20,6 @@ var_dump( ob_get_flush() ); --EXPECTF-- *** Testing ob_get_flush() : error conditions *** -Warning: ob_get_flush() expects exactly 0 parameters, 1 given in %s on line %d -NULL - Notice: ob_get_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/general_functions/ob_get_length_basic.phpt b/ext/standard/tests/general_functions/ob_get_length_basic.phpt index b3470bec55..75e22e7741 100644 --- a/ext/standard/tests/general_functions/ob_get_length_basic.phpt +++ b/ext/standard/tests/general_functions/ob_get_length_basic.phpt @@ -31,9 +31,6 @@ dump_string_length( ' lsf' ); dump_string_length( '' ); dump_string_length( null ); -// Extra argument -var_dump( ob_get_length( 'foobar' ) ); - ?> ===DONE=== --EXPECTF-- @@ -45,7 +42,4 @@ int(1) int(15) int(0) int(0) - -Warning: ob_get_length() expects exactly 0 parameters, 1 given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/parse_ini_file.phpt b/ext/standard/tests/general_functions/parse_ini_file.phpt index 368d262a6e..201bb481fc 100644 --- a/ext/standard/tests/general_functions/parse_ini_file.phpt +++ b/ext/standard/tests/general_functions/parse_ini_file.phpt @@ -8,8 +8,6 @@ parse_ini_file() multiple calls $filename = __DIR__."/parse_ini_file.dat"; @unlink($filename); /* Make sure the file really does not exist! */ -var_dump(parse_ini_file()); -var_dump(parse_ini_file(1,1,1,1)); var_dump(parse_ini_file($filename)); var_dump(parse_ini_file($filename, true)); @@ -121,16 +119,10 @@ var_dump(parse_ini_file($filename, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: parse_ini_file() expects at least 1 parameter, 0 given in %sparse_ini_file.php on line 6 +Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line %d bool(false) -Warning: parse_ini_file() expects at most 3 parameters, 4 given in %sparse_ini_file.php on line 7 -bool(false) - -Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 8 -bool(false) - -Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 9 +Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line %d bool(false) array(1) { ["test"]=> @@ -138,11 +130,11 @@ array(1) { } Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2 - in %sparse_ini_file.php on line 20 + in %sparse_ini_file.php on line %d bool(false) Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2 - in %sparse_ini_file.php on line 26 + in %sparse_ini_file.php on line %d bool(false) array(1) { ["test"]=> diff --git a/ext/standard/tests/general_functions/parse_ini_string_002.phpt b/ext/standard/tests/general_functions/parse_ini_string_002.phpt index 106cd0c842..384398cdb2 100644 --- a/ext/standard/tests/general_functions/parse_ini_string_002.phpt +++ b/ext/standard/tests/general_functions/parse_ini_string_002.phpt @@ -3,9 +3,6 @@ parse_ini_string() multiple calls --FILE-- <?php -var_dump(parse_ini_string()); -var_dump(parse_ini_string(1,1,1,1)); - $ini = " test = "; @@ -87,11 +84,6 @@ var_dump(parse_ini_string($ini, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: parse_ini_string() expects at least 1 parameter, 0 given in %s -bool(false) - -Warning: parse_ini_string() expects at most 3 parameters, 4 given in %s -bool(false) array(1) { ["test"]=> string(0) "" diff --git a/ext/standard/tests/general_functions/php_uname_error.phpt b/ext/standard/tests/general_functions/php_uname_error.phpt index 392e1c930e..ec5b2b5839 100644 --- a/ext/standard/tests/general_functions/php_uname_error.phpt +++ b/ext/standard/tests/general_functions/php_uname_error.phpt @@ -8,49 +8,15 @@ Test php_uname() function - error conditions - pass function incorrect argument echo "*** Testing php_uname() - error test\n"; -echo "\n-- Testing php_uname() function with more than expected no. of arguments --\n"; -var_dump( php_uname('a', true) ); - echo "\n-- Testing php_uname() function with invalid mode --\n"; // am invalid mode should result in same o/p as mode 'a' var_dump( php_uname('z') == php_uname('z') ); -class barClass { -} - -$fp = fopen(__FILE__, "r"); - -echo "\n-- Testing php_uname() function with invalid argument types --\n"; -var_dump(php_uname(array())); -var_dump(php_uname(array('color' => 'red', 'item' => 'pen'))); -var_dump(php_uname(new barClass())); -var_dump(php_uname($fp)); - -fclose($fp); ?> ===DONE=== --EXPECTF-- *** Testing php_uname() - error test --- Testing php_uname() function with more than expected no. of arguments -- - -Warning: php_uname() expects at most 1 parameter, 2 given in %s on line %d -NULL - -- Testing php_uname() function with invalid mode -- bool(true) - --- Testing php_uname() function with invalid argument types -- - -Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: php_uname() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: php_uname() expects parameter 1 to be string, resource given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/phpcredits.phpt b/ext/standard/tests/general_functions/phpcredits.phpt index 044232570e..dfcddc61f3 100644 --- a/ext/standard/tests/general_functions/phpcredits.phpt +++ b/ext/standard/tests/general_functions/phpcredits.phpt @@ -4,7 +4,6 @@ phpcredits() <?php var_dump(phpcredits()); -var_dump(phpcredits(array())); echo "--\n"; var_dump(phpcredits(0)); @@ -40,9 +39,6 @@ PHP Quality Assurance Team %wWebsites and Infrastructure team%w %a bool(true) - -Warning: phpcredits() expects parameter 1 to be int, array given in %sphpcredits.php on line 4 -NULL -- PHP Credits bool(true) diff --git a/ext/standard/tests/general_functions/phpcredits2.phpt b/ext/standard/tests/general_functions/phpcredits2.phpt index 9966f23a96..6aa023e919 100644 --- a/ext/standard/tests/general_functions/phpcredits2.phpt +++ b/ext/standard/tests/general_functions/phpcredits2.phpt @@ -6,7 +6,6 @@ dummy=x <?php var_dump(phpcredits()); -var_dump(phpcredits(array())); echo "--\n"; var_dump(phpcredits(0)); @@ -18,9 +17,6 @@ var_dump(phpcredits(CREDITS_GROUP)); --EXPECTF-- <!DOCTYPE %a>%s</html> bool(true) - -Warning: phpcredits() expects parameter 1 to be int, array given in %sphpcredits2.php on line 4 -NULL -- <h1>PHP Credits</h1> bool(true) diff --git a/ext/standard/tests/general_functions/phpinfo.phpt b/ext/standard/tests/general_functions/phpinfo.phpt index a805876aab..5f4d99ffba 100644 --- a/ext/standard/tests/general_functions/phpinfo.phpt +++ b/ext/standard/tests/general_functions/phpinfo.phpt @@ -5,9 +5,6 @@ phpinfo() var_dump(phpinfo()); echo "--\n"; -var_dump(phpinfo(array())); - -echo "--\n"; var_dump(phpinfo(0)); echo "--\n"; @@ -62,10 +59,6 @@ PHP License %A bool(true) -- - -Warning: phpinfo() expects parameter 1 to be int, array given in %sphpinfo.php on line 5 -NULL --- phpinfo() bool(true) -- diff --git a/ext/standard/tests/general_functions/phpinfo2.phpt b/ext/standard/tests/general_functions/phpinfo2.phpt index f422f923d9..5a36aa9d28 100644 --- a/ext/standard/tests/general_functions/phpinfo2.phpt +++ b/ext/standard/tests/general_functions/phpinfo2.phpt @@ -7,9 +7,6 @@ dummy=x var_dump(phpinfo()); echo "--\n"; -var_dump(phpinfo(array())); - -echo "--\n"; var_dump(phpinfo(0)); echo "--\n"; @@ -20,10 +17,6 @@ var_dump(phpinfo(INFO_LICENSE)); <!DOCTYPE %s> %a</html>bool(true) -- - -Warning: phpinfo() expects parameter 1 to be int, array given in %sphpinfo2.php on line 5 -NULL --- <!DOCTYPE %s> %a</html>bool(true) -- diff --git a/ext/standard/tests/general_functions/print_r.phpt b/ext/standard/tests/general_functions/print_r.phpt index bcf5231144..cdb9f338a8 100644 --- a/ext/standard/tests/general_functions/print_r.phpt +++ b/ext/standard/tests/general_functions/print_r.phpt @@ -271,24 +271,6 @@ $misc_values = array ( /* calling check_printr() to display miscelleneous data using print_r() */ check_printr($misc_values); -/* checking print_r() on functions */ -echo "\n*** Testing print_r() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -print_r( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump( print_r() ); - -//passing more than required no. of arguments -var_dump( print_r(123, true, "abc") ); - -// check when second arg is given other than boolean TRUE -var_dump( print_r ($value, "string") ); - /* closing resource handle used */ closedir($dir_handle); @@ -1714,23 +1696,4 @@ Array -- Iteration 4 -- - -*** Testing print_r() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -2 * 3 = 6 -Deprecated: Function create_function() is deprecated in %s on line %d - - -*** Testing error conditions *** - -Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - -Notice: Undefined variable: value in %s on line %d -string(0) "" Done diff --git a/ext/standard/tests/general_functions/print_r_64bit.phpt b/ext/standard/tests/general_functions/print_r_64bit.phpt index 8584f08758..71f2b5d64c 100644 --- a/ext/standard/tests/general_functions/print_r_64bit.phpt +++ b/ext/standard/tests/general_functions/print_r_64bit.phpt @@ -275,24 +275,6 @@ $misc_values = array ( /* calling check_printr() to display miscelleneous data using print_r() */ check_printr($misc_values); -/* checking print_r() on functions */ -echo "\n*** Testing print_r() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -print_r( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump( print_r() ); - -//passing more than required no. of arguments -var_dump( print_r(123, true, "abc") ); - -// check when second arg is given other than boolean TRUE -var_dump( print_r ($value, "string") ); - /* closing resource handle used */ closedir($dir_handle); @@ -1718,23 +1700,4 @@ Array -- Iteration 4 -- - -*** Testing print_r() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -2 * 3 = 6 -Deprecated: Function create_function() is deprecated in %s on line %d - - -*** Testing error conditions *** - -Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - -Notice: Undefined variable: value in %s on line %d -string(0) "" Done diff --git a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt index 87a4545501..37f8e17af2 100644 --- a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt +++ b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt @@ -8,10 +8,6 @@ if (!defined('PHP_WINDOWS_VERSION_MAJOR')) { die('skip: Only for Windows'); } -if (PHP_SAPI != 'cli') { - die('skip: Only for CLI'); -} - if (getenv('SKIP_SLOW_TESTS')) { doe('skip: Slow test'); } diff --git a/ext/standard/tests/general_functions/proc_open-mb0.phpt b/ext/standard/tests/general_functions/proc_open-mb0.phpt index 4ff38267ad..03befdfb26 100644 --- a/ext/standard/tests/general_functions/proc_open-mb0.phpt +++ b/ext/standard/tests/general_functions/proc_open-mb0.phpt @@ -2,7 +2,6 @@ proc_open with bypass_shell subprocess parameter passing --SKIPIF-- <?php -if (php_sapi_name() != "cli") die('skip CLI only test'); if (!function_exists("proc_open")) echo "skip proc_open() is not available"; ?> --FILE-- diff --git a/ext/standard/tests/general_functions/proc_open-mb1.phpt b/ext/standard/tests/general_functions/proc_open-mb1.phpt index e7a7a4cbfc..46115c6337 100644 --- a/ext/standard/tests/general_functions/proc_open-mb1.phpt +++ b/ext/standard/tests/general_functions/proc_open-mb1.phpt @@ -2,7 +2,6 @@ proc_open without bypass_shell subprocess parameter passing --SKIPIF-- <?php -if (php_sapi_name() != "cli") die('skip CLI only test'); if (!function_exists("proc_open")) echo "skip proc_open() is not available"; ?> --FILE-- diff --git a/ext/standard/tests/general_functions/rand.phpt b/ext/standard/tests/general_functions/rand.phpt index e6639a71c7..73dec4eb75 100644 --- a/ext/standard/tests/general_functions/rand.phpt +++ b/ext/standard/tests/general_functions/rand.phpt @@ -4,60 +4,36 @@ rand() and mt_rand() tests <?php var_dump(mt_rand()); -var_dump(mt_rand(-1)); var_dump(mt_rand(-1,1)); var_dump(mt_rand(0,3)); var_dump(rand()); -var_dump(rand(-1)); var_dump(rand(-1,1)); var_dump(rand(0,3)); var_dump(srand()); var_dump(srand(-1)); -var_dump(srand(array())); var_dump(mt_srand()); var_dump(mt_srand(-1)); -var_dump(mt_srand(array())); var_dump(getrandmax()); -var_dump(getrandmax(1)); var_dump(mt_getrandmax()); -var_dump(mt_getrandmax(1)); echo "Done\n"; ?> --EXPECTF-- int(%d) - -Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line %d -NULL int(%i) int(%d) int(%d) - -Warning: rand() expects exactly 2 parameters, 1 given in %s on line %d -NULL int(%i) int(%d) NULL NULL - -Warning: srand() expects parameter 1 to be int, array given in %s on line %d -NULL -NULL NULL - -Warning: mt_srand() expects parameter 1 to be int, array given in %s on line %d NULL int(%d) - -Warning: getrandmax() expects exactly 0 parameters, 1 given in %s on line %d -NULL int(%d) - -Warning: mt_getrandmax() expects exactly 0 parameters, 1 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/sleep_error.phpt b/ext/standard/tests/general_functions/sleep_error.phpt index c4f069a3d2..3b46a35e5d 100644 --- a/ext/standard/tests/general_functions/sleep_error.phpt +++ b/ext/standard/tests/general_functions/sleep_error.phpt @@ -10,14 +10,6 @@ Test sleep() function : error conditions echo "*** Testing sleep() : error conditions ***\n"; -echo "\n-- Testing sleep() function with zero arguments --\n"; -var_dump( sleep() ); - -echo "\n-- Testing sleep() function with more than expected no. of arguments --\n"; -$seconds = 10; -$extra_arg = 10; -var_dump( sleep($seconds, $extra_arg) ); - echo "\n-- Testing sleep() function with negative interval --\n"; $seconds = -10; var_dump( sleep($seconds) ); @@ -27,16 +19,6 @@ var_dump( sleep($seconds) ); --EXPECTF-- *** Testing sleep() : error conditions *** --- Testing sleep() function with zero arguments -- - -Warning: sleep() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing sleep() function with more than expected no. of arguments -- - -Warning: sleep() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -- Testing sleep() function with negative interval -- Warning: sleep(): Number of seconds must be greater than or equal to 0 in %s on line %d diff --git a/ext/standard/tests/general_functions/strval.phpt b/ext/standard/tests/general_functions/strval.phpt index e904fdcaa0..531c64aa5a 100644 --- a/ext/standard/tests/general_functions/strval.phpt +++ b/ext/standard/tests/general_functions/strval.phpt @@ -141,13 +141,6 @@ foreach ($not_scalars as $value ) { var_dump( strval($value) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( strval() ); - -//arguments more than expected -var_dump( strval( $scalars[0], $scalars[1]) ); - echo "Done\n"; // close the resources used @@ -306,12 +299,4 @@ string(0) "" string(0) "" -- Iteration 11 -- string(0) "" - -*** Testing error conditions *** - -Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/sys_getloadavg.phpt b/ext/standard/tests/general_functions/sys_getloadavg.phpt index 5763084f70..1775978a12 100644 --- a/ext/standard/tests/general_functions/sys_getloadavg.phpt +++ b/ext/standard/tests/general_functions/sys_getloadavg.phpt @@ -7,14 +7,11 @@ if (!function_exists("sys_getloadavg")) die("skip"); --FILE-- <?php -var_dump(sys_getloadavg("")); var_dump(sys_getloadavg()); echo "Done\n"; ?> --EXPECTF-- -Warning: sys_getloadavg() expects exactly 0 parameters, %d given in %s -NULL array(3) { [0]=> float(%f) diff --git a/ext/standard/tests/general_functions/usleep_error.phpt b/ext/standard/tests/general_functions/usleep_error.phpt index 474aab7d5d..283e7f30e5 100644 --- a/ext/standard/tests/general_functions/usleep_error.phpt +++ b/ext/standard/tests/general_functions/usleep_error.phpt @@ -11,14 +11,6 @@ set_time_limit(20); echo "*** Testing usleep() : error conditions ***\n"; -echo "\n-- Testing usleep() function with zero arguments --\n"; -var_dump( usleep() ); - -echo "\n-- Testing usleep() function with more than expected no. of arguments --\n"; -$seconds = 10; -$extra_arg = 10; -var_dump( usleep($seconds, $extra_arg) ); - echo "\n-- Testing usleep() function with negative interval --\n"; $seconds = -10; var_dump( usleep($seconds) ); @@ -28,16 +20,6 @@ var_dump( usleep($seconds) ); --EXPECTF-- *** Testing usleep() : error conditions *** --- Testing usleep() function with zero arguments -- - -Warning: usleep() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing usleep() function with more than expected no. of arguments -- - -Warning: usleep() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -- Testing usleep() function with negative interval -- Warning: usleep(): Number of microseconds must be greater than or equal to 0 in %s on line %d diff --git a/ext/standard/tests/general_functions/var_dump.phpt b/ext/standard/tests/general_functions/var_dump.phpt index 4641051541..336abbdf9f 100644 --- a/ext/standard/tests/general_functions/var_dump.phpt +++ b/ext/standard/tests/general_functions/var_dump.phpt @@ -274,18 +274,6 @@ echo "\n*** Testing var_dump() on multiple arguments ***\n"; var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources, $objects, $misc_values, $variations ); -/* checking var_dump() on functions */ -echo "\n*** Testing var_dump() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -var_dump( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump(); - /* closing resource handle used */ closedir($dir_handle); @@ -1561,17 +1549,4 @@ array(6) { string(5) "/00\7" } } - -*** Testing var_dump() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -string(9) "2 * 3 = 6" - -Deprecated: Function create_function() is deprecated in %s on line %d -string(9) " - -*** Testing error conditions *** - -Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d Done diff --git a/ext/standard/tests/general_functions/var_dump_64bit.phpt b/ext/standard/tests/general_functions/var_dump_64bit.phpt index 738de410e4..cd74d585bc 100644 --- a/ext/standard/tests/general_functions/var_dump_64bit.phpt +++ b/ext/standard/tests/general_functions/var_dump_64bit.phpt @@ -274,18 +274,6 @@ echo "\n*** Testing var_dump() on multiple arguments ***\n"; var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources, $objects, $misc_values, $variations ); -/* checking var_dump() on functions */ -echo "\n*** Testing var_dump() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -var_dump( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump(); - /* closing resource handle used */ closedir($dir_handle); @@ -1561,17 +1549,4 @@ array(6) { string(5) "/00\7" } } - -*** Testing var_dump() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -string(9) "2 * 3 = 6" - -Deprecated: Function create_function() is deprecated in %s on line %d -string(9) " - -*** Testing error conditions *** - -Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d Done diff --git a/ext/standard/tests/general_functions/var_export-locale.phpt b/ext/standard/tests/general_functions/var_export-locale.phpt index 61d94f83f4..3512006624 100644 --- a/ext/standard/tests/general_functions/var_export-locale.phpt +++ b/ext/standard/tests/general_functions/var_export-locale.phpt @@ -303,14 +303,7 @@ echo "\n"; $counter++; } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_export( var_export() ); - -//arguments more than expected -var_export( var_export(TRUE, FALSE, TRUE) ); - -echo "\n\nDone"; +echo "\nDone"; ?> @@ -1138,11 +1131,4 @@ NULL string(4) "NULL" -*** Testing error conditions *** - -Warning: var_export() expects at least 1 parameter, 0 given in %s on line %d -NULL -Warning: var_export() expects at most 2 parameters, 3 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/general_functions/var_export-locale_32.phpt b/ext/standard/tests/general_functions/var_export-locale_32.phpt index af9efd9e24..311b6395cd 100644 --- a/ext/standard/tests/general_functions/var_export-locale_32.phpt +++ b/ext/standard/tests/general_functions/var_export-locale_32.phpt @@ -303,14 +303,7 @@ echo "\n"; $counter++; } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_export( var_export() ); - -//arguments more than expected -var_export( var_export(TRUE, FALSE, TRUE) ); - -echo "\n\nDone"; +echo "\nDone"; ?> @@ -1138,11 +1131,4 @@ NULL string(4) "NULL" -*** Testing error conditions *** - -Warning: var_export() expects at least 1 parameter, 0 given in %s on line %d -NULL -Warning: var_export() expects at most 2 parameters, 3 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/image/getimagesize_variation2.phpt b/ext/standard/tests/image/getimagesize_variation2.phpt index c475a9cb05..c7691634c9 100644 --- a/ext/standard/tests/image/getimagesize_variation2.phpt +++ b/ext/standard/tests/image/getimagesize_variation2.phpt @@ -8,7 +8,7 @@ Test getimagesize() function : usage variations - unexpected type for arg 2 * Alias to functions: */ -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/image/image_type_to_extension.phpt b/ext/standard/tests/image/image_type_to_extension.phpt index 8418a4b8c7..249df57943 100644 --- a/ext/standard/tests/image/image_type_to_extension.phpt +++ b/ext/standard/tests/image/image_type_to_extension.phpt @@ -29,12 +29,8 @@ image_type_to_extension() printf("Constant: %s\n\tWith dot: %s\n\tWithout dot: %s\n", $name, image_type_to_extension($constant), image_type_to_extension($constant, false)); } - var_dump(image_type_to_extension(-1, array())); - var_dump(image_type_to_extension(new stdclass)); var_dump(image_type_to_extension(1000000, NULL)); - var_dump(image_type_to_extension()); var_dump(image_type_to_extension(0)); - var_dump(image_type_to_extension(0, 0, 0)); ?> Done --EXPECTF-- @@ -89,18 +85,6 @@ Constant: IMAGETYPE_XBM Constant: IMAGETYPE_WEBP With dot: .webp Without dot: webp - -Warning: image_type_to_extension() expects parameter 2 to be bool, array given in %s on line %d -bool(false) - -Warning: image_type_to_extension() expects parameter 1 to be int, object given in %s on line %d -bool(false) bool(false) - -Warning: image_type_to_extension() expects at least 1 parameter, 0 given in %s on line %d -bool(false) -bool(false) - -Warning: image_type_to_extension() expects at most 2 parameters, 3 given in %s on line %d bool(false) Done diff --git a/ext/standard/tests/math/abs_variation.phpt b/ext/standard/tests/math/abs_variation.phpt index fd671855e1..e6838f7f72 100644 --- a/ext/standard/tests/math/abs_variation.phpt +++ b/ext/standard/tests/math/abs_variation.phpt @@ -73,14 +73,18 @@ $inputs = array( $iterator = 1; foreach($inputs as $input) { echo "\n-- Iteration $iterator --\n"; - var_dump(abs($input) ); + try { + var_dump(abs($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $iterator++; }; fclose($fp); ?> ===Done=== ---EXPECTF-- +--EXPECT-- *** Testing abs() : usage variations *** -- Iteration 1 -- @@ -102,27 +106,25 @@ int(1) int(0) -- Iteration 7 -- -int(0) +abs() expects parameter 1 to be int or float, string given -- Iteration 8 -- -int(0) +abs() expects parameter 1 to be int or float, string given -- Iteration 9 -- -bool(false) +abs() expects parameter 1 to be int or float, array given -- Iteration 10 -- -int(0) +abs() expects parameter 1 to be int or float, string given -- Iteration 11 -- -int(0) +abs() expects parameter 1 to be int or float, string given -- Iteration 12 -- -int(0) +abs() expects parameter 1 to be int or float, string given -- Iteration 13 -- - -Notice: Object of class classA could not be converted to number in %s on line %d -int(1) +abs() expects parameter 1 to be int or float, object given -- Iteration 14 -- int(0) @@ -131,5 +133,5 @@ int(0) int(0) -- Iteration 16 -- -int(%d) +abs() expects parameter 1 to be int or float, resource given ===Done=== diff --git a/ext/standard/tests/math/acos_variation.phpt b/ext/standard/tests/math/acos_variation.phpt index 5575ec5796..4fe8437fd5 100644 --- a/ext/standard/tests/math/acos_variation.phpt +++ b/ext/standard/tests/math/acos_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(NAN) float(NAN) float(NAN) float(NAN) - -Warning: acos() expects parameter 1 to be float, string given in %s on line %d -NULL float(NAN) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/acosh_variation.phpt b/ext/standard/tests/math/acosh_variation.phpt index cc89ce3e76..12200e035c 100644 --- a/ext/standard/tests/math/acosh_variation.phpt +++ b/ext/standard/tests/math/acosh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(3.828168471) float(3.828168471) float(3.847562739) float(3.847562739) - -Warning: acosh() expects parameter 1 to be float, string given in %s on line %d -NULL float(7.60090221) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/asin_variation.phpt b/ext/standard/tests/math/asin_variation.phpt index c8063849fd..c5d170e8db 100644 --- a/ext/standard/tests/math/asin_variation.phpt +++ b/ext/standard/tests/math/asin_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(NAN) float(NAN) float(NAN) float(NAN) - -Warning: asin() expects parameter 1 to be float, string given in %s on line %d -NULL float(NAN) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/asinh_variation.phpt b/ext/standard/tests/math/asinh_variation.phpt index 5e41a45900..2470f7d401 100644 --- a/ext/standard/tests/math/asinh_variation.phpt +++ b/ext/standard/tests/math/asinh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(3.829113652) float(3.829113652) float(3.848471992) float(3.848471992) - -Warning: asinh() expects parameter 1 to be float, string given in %s on line %d -NULL float(7.60090271) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/atan_variation.phpt b/ext/standard/tests/math/atan_variation.phpt index b6a9a9ec32..625b6d0b83 100644 --- a/ext/standard/tests/math/atan_variation.phpt +++ b/ext/standard/tests/math/atan_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1.527345431) float(1.527345431) float(1.528178225) float(1.528178225) - -Warning: atan() expects parameter 1 to be float, string given in %s on line %d -NULL float(1.569796327) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/atanh_variation.phpt b/ext/standard/tests/math/atanh_variation.phpt index 2b0a4b1085..f14406bb0d 100644 --- a/ext/standard/tests/math/atanh_variation.phpt +++ b/ext/standard/tests/math/atanh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(NAN) float(NAN) float(NAN) float(NAN) - -Warning: atanh() expects parameter 1 to be float, string given in %s on line %d -NULL float(NAN) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/base_convert_error.phpt b/ext/standard/tests/math/base_convert_error.phpt index 96e774b51f..5bd64a536b 100644 --- a/ext/standard/tests/math/base_convert_error.phpt +++ b/ext/standard/tests/math/base_convert_error.phpt @@ -14,14 +14,10 @@ class classA { } -echo "Incorrect number of arguments\n"; -base_convert(); -base_convert(35); -base_convert(35,2); +echo "Incorrect input\n"; base_convert(1234, 1, 10); base_convert(1234, 10, 37); -echo "Incorrect input\n"; try { base_convert(new classA(), 8, 10); } catch (Error $e) { @@ -31,16 +27,9 @@ try { ?> --EXPECTF-- *** Testing base_convert() : error conditions *** -Incorrect number of arguments - -Warning: base_convert() expects exactly 3 parameters, 0 given in %s on line %d - -Warning: base_convert() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: base_convert() expects exactly 3 parameters, 2 given in %s on line %d +Incorrect input Warning: base_convert(): Invalid `from base' (1) in %s on line %d Warning: base_convert(): Invalid `to base' (37) in %s on line %d -Incorrect input Object of class classA could not be converted to string diff --git a/ext/standard/tests/math/bindec_variation1.phpt b/ext/standard/tests/math/bindec_variation1.phpt index f59cb81bbe..a8444c5395 100644 --- a/ext/standard/tests/math/bindec_variation1.phpt +++ b/ext/standard/tests/math/bindec_variation1.phpt @@ -73,7 +73,11 @@ $inputs = array( $iterator = 1; foreach($inputs as $input) { echo "\n-- Iteration $iterator --\n"; - var_dump(bindec($input)); + try { + var_dump(bindec($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $iterator++; }; fclose($fp); @@ -148,11 +152,7 @@ int(0) int(0) -- Iteration 18 -- - -Notice: Array to string conversion in %s on line %d - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) +bindec() expects parameter 1 to be string, array given -- Iteration 19 -- @@ -176,7 +176,5 @@ int(0) int(0) -- Iteration 24 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) +bindec() expects parameter 1 to be string, resource given ===Done=== diff --git a/ext/standard/tests/math/bindec_variation1_64bit.phpt b/ext/standard/tests/math/bindec_variation1_64bit.phpt index 4f96268b37..0fdfe4b5eb 100644 --- a/ext/standard/tests/math/bindec_variation1_64bit.phpt +++ b/ext/standard/tests/math/bindec_variation1_64bit.phpt @@ -73,7 +73,11 @@ $inputs = array( $iterator = 1; foreach($inputs as $input) { echo "\n-- Iteration $iterator --\n"; - var_dump(bindec($input)); + try { + var_dump(bindec($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $iterator++; }; fclose($fp); @@ -148,11 +152,7 @@ int(0) int(0) -- Iteration 18 -- - -Notice: Array to string conversion in %s on line %d - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) +bindec() expects parameter 1 to be string, array given -- Iteration 19 -- @@ -176,7 +176,5 @@ int(0) int(0) -- Iteration 24 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) +bindec() expects parameter 1 to be string, resource given ===Done=== diff --git a/ext/standard/tests/math/ceil_variation1.phpt b/ext/standard/tests/math/ceil_variation1.phpt index 05f308a4a0..07481126fd 100644 --- a/ext/standard/tests/math/ceil_variation1.phpt +++ b/ext/standard/tests/math/ceil_variation1.phpt @@ -67,13 +67,17 @@ $inputs = array( $iterator = 1; foreach($inputs as $input) { echo "\n-- Iteration $iterator --\n"; - var_dump(ceil($input)); + try { + var_dump(ceil($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $iterator++; }; fclose($fp); ?> ===Done=== ---EXPECTF-- +--EXPECT-- *** Testing ceil() : usage variations *** -- Iteration 1 -- @@ -95,27 +99,25 @@ float(1) float(0) -- Iteration 7 -- -float(0) +ceil() expects parameter 1 to be int or float, string given -- Iteration 8 -- -float(0) +ceil() expects parameter 1 to be int or float, string given -- Iteration 9 -- -bool(false) +ceil() expects parameter 1 to be int or float, array given -- Iteration 10 -- -float(0) +ceil() expects parameter 1 to be int or float, string given -- Iteration 11 -- -float(0) +ceil() expects parameter 1 to be int or float, string given -- Iteration 12 -- -float(0) +ceil() expects parameter 1 to be int or float, string given -- Iteration 13 -- - -Notice: Object of class classA could not be converted to number in %s on line %d -float(1) +ceil() expects parameter 1 to be int or float, object given -- Iteration 14 -- float(0) @@ -124,5 +126,5 @@ float(0) float(0) -- Iteration 16 -- -float(%d) +ceil() expects parameter 1 to be int or float, resource given ===Done=== diff --git a/ext/standard/tests/math/cos_variation.phpt b/ext/standard/tests/math/cos_variation.phpt index 6323042dc7..f9d1b26246 100644 --- a/ext/standard/tests/math/cos_variation.phpt +++ b/ext/standard/tests/math/cos_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(-0.5328330203) float(-0.5328330203) float(-0.1117112391) float(-0.1117112391) - -Warning: cos() expects parameter 1 to be float, string given in %s on line %d -NULL float(0.5623790763) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/cosh_variation.phpt b/ext/standard/tests/math/cosh_variation.phpt index cd64670668..ec58c0151f 100644 --- a/ext/standard/tests/math/cosh_variation.phpt +++ b/ext/standard/tests/math/cosh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(4872401723) float(4872401723) float(7641446995) float(7641446995) - -Warning: cosh() expects parameter 1 to be float, string given in %s on line %d -NULL float(INF) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/deg2rad_variation.phpt b/ext/standard/tests/math/deg2rad_variation.phpt index d5f6920ea7..eb3c7eae0e 100644 --- a/ext/standard/tests/math/deg2rad_variation.phpt +++ b/ext/standard/tests/math/deg2rad_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(0.401425728) float(0.401425728) float(0.4092797096) float(0.4092797096) - -Warning: deg2rad() expects parameter 1 to be float, string given in %s on line %d -NULL float(17.45329252) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/floor_variation1.phpt b/ext/standard/tests/math/floor_variation1.phpt index aef4c742b9..e3406eba87 100644 --- a/ext/standard/tests/math/floor_variation1.phpt +++ b/ext/standard/tests/math/floor_variation1.phpt @@ -67,13 +67,17 @@ $inputs = array( $iterator = 1; foreach($inputs as $input) { echo "\n-- Iteration $iterator --\n"; - var_dump(floor($input)); + try { + var_dump(floor($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $iterator++; }; fclose($fp); ?> ===Done=== ---EXPECTF-- +--EXPECT-- *** Testing floor() : usage variations *** -- Iteration 1 -- @@ -95,27 +99,25 @@ float(1) float(0) -- Iteration 7 -- -float(0) +floor() expects parameter 1 to be int or float, string given -- Iteration 8 -- -float(0) +floor() expects parameter 1 to be int or float, string given -- Iteration 9 -- -bool(false) +floor() expects parameter 1 to be int or float, array given -- Iteration 10 -- -float(0) +floor() expects parameter 1 to be int or float, string given -- Iteration 11 -- -float(0) +floor() expects parameter 1 to be int or float, string given -- Iteration 12 -- -float(0) +floor() expects parameter 1 to be int or float, string given -- Iteration 13 -- - -Notice: Object of class classA could not be converted to number in %s on line %d -float(1) +floor() expects parameter 1 to be int or float, object given -- Iteration 14 -- float(0) @@ -124,5 +126,5 @@ float(0) float(0) -- Iteration 16 -- -float(%f) +floor() expects parameter 1 to be int or float, resource given ===Done=== diff --git a/ext/standard/tests/math/hexdec_variation1.phpt b/ext/standard/tests/math/hexdec_variation1.phpt index 8f066cb11d..e7748a04d0 100644 --- a/ext/standard/tests/math/hexdec_variation1.phpt +++ b/ext/standard/tests/math/hexdec_variation1.phpt @@ -77,7 +77,11 @@ $inputs = array( $iterator = 1; foreach($inputs as $input) { echo "\n-- Iteration $iterator --\n"; - var_dump(hexdec($input)); + try { + var_dump(hexdec($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $iterator++; }; fclose($fp); @@ -154,11 +158,7 @@ int(0) int(0) -- Iteration 20 -- - -Notice: Array to string conversion in %s on line %d - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(170) +hexdec() expects parameter 1 to be string, array given -- Iteration 21 -- @@ -182,7 +182,5 @@ int(0) int(0) -- Iteration 26 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(970453) +hexdec() expects parameter 1 to be string, resource given ===Done=== diff --git a/ext/standard/tests/math/hexdec_variation1_64bit.phpt b/ext/standard/tests/math/hexdec_variation1_64bit.phpt index 759997979f..31cc71b0e6 100644 --- a/ext/standard/tests/math/hexdec_variation1_64bit.phpt +++ b/ext/standard/tests/math/hexdec_variation1_64bit.phpt @@ -77,7 +77,11 @@ $inputs = array( $iterator = 1; foreach($inputs as $input) { echo "\n-- Iteration $iterator --\n"; - var_dump(hexdec($input)); + try { + var_dump(hexdec($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $iterator++; }; fclose($fp); @@ -154,11 +158,7 @@ int(0) int(0) -- Iteration 20 -- - -Notice: Array to string conversion in %s on line %d - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(170) +hexdec() expects parameter 1 to be string, array given -- Iteration 21 -- @@ -182,7 +182,5 @@ int(0) int(0) -- Iteration 26 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(970453) +hexdec() expects parameter 1 to be string, resource given ===Done=== diff --git a/ext/standard/tests/math/lcg_value_basic.phpt b/ext/standard/tests/math/lcg_value_basic.phpt index 44304f2475..7660f67c24 100644 --- a/ext/standard/tests/math/lcg_value_basic.phpt +++ b/ext/standard/tests/math/lcg_value_basic.phpt @@ -21,22 +21,6 @@ if ($i != 100) { echo "PASSED\n"; } -echo "\n lcg_value error cases..\n"; -$res = lcg_value(23); - -if (is_null($res)) { - echo "PASSED\n"; -} else { - echo "FAILED\n"; -} - -$res = lcg_value(10,false); -if (is_null($res)) { - echo "PASSED\n"; -} else { - echo "FAILED\n"; -} - echo "MATHS test script completed\n"; ?> @@ -45,12 +29,4 @@ MATHS test script started lcg_value tests... PASSED - - lcg_value error cases.. - -Warning: lcg_value() expects exactly 0 parameters, 1 given in %slcg_value_basic.php on line %d -PASSED - -Warning: lcg_value() expects exactly 0 parameters, 2 given in %slcg_value_basic.php on line %d -PASSED MATHS test script completed diff --git a/ext/standard/tests/math/log10_variation.phpt b/ext/standard/tests/math/log10_variation.phpt index 5304325952..8dbea47a84 100644 --- a/ext/standard/tests/math/log10_variation.phpt +++ b/ext/standard/tests/math/log10_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1.361727836) float(1.361727836) float(1.370142847) float(1.370142847) - -Warning: log10() expects parameter 1 to be float, string given in %s on line %d -NULL float(3) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/log_error.phpt b/ext/standard/tests/math/log_error.phpt index 48a23df3c0..7c305a4cba 100644 --- a/ext/standard/tests/math/log_error.phpt +++ b/ext/standard/tests/math/log_error.phpt @@ -4,13 +4,7 @@ Test log() - wrong params test log() precision=14 --FILE-- <?php -log(); -log(36,4,true); log(36, -4); ?> --EXPECTF-- -Warning: log() expects at least 1 parameter, 0 given in %s on line %d - -Warning: log() expects at most 2 parameters, 3 given in %s on line %d - Warning: log(): base must be greater than 0 in %s on line %d diff --git a/ext/standard/tests/math/octdec_variation1.phpt b/ext/standard/tests/math/octdec_variation1.phpt index 84be45dbb3..b59b3b71eb 100644 --- a/ext/standard/tests/math/octdec_variation1.phpt +++ b/ext/standard/tests/math/octdec_variation1.phpt @@ -73,7 +73,11 @@ $inputs = array( $iterator = 1; foreach($inputs as $input) { echo "\n-- Iteration $iterator --\n"; - var_dump(octdec($input)); + try { + var_dump(octdec($input)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $iterator++; }; fclose($fp); @@ -156,11 +160,7 @@ int(0) int(0) -- Iteration 20 -- - -Notice: Array to string conversion in %s on line %d - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(0) +octdec() expects parameter 1 to be string, array given -- Iteration 21 -- @@ -184,7 +184,5 @@ int(0) int(0) -- Iteration 26 -- - -Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d -int(5) +octdec() expects parameter 1 to be string, resource given ---Done--- diff --git a/ext/standard/tests/math/rad2deg_variation.phpt b/ext/standard/tests/math/rad2deg_variation.phpt index 596a1940a4..6ea7d0c8a4 100644 --- a/ext/standard/tests/math/rad2deg_variation.phpt +++ b/ext/standard/tests/math/rad2deg_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1317.802929) float(1317.802929) float(1343.58603) float(1343.58603) - -Warning: rad2deg() expects parameter 1 to be float, string given in %s on line %d -NULL float(57295.77951) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/sin_variation.phpt b/ext/standard/tests/math/sin_variation.phpt index 5b635dfbdc..d044a16b40 100644 --- a/ext/standard/tests/math/sin_variation.phpt +++ b/ext/standard/tests/math/sin_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(-0.8462204042) float(-0.8462204042) float(-0.9937407102) float(-0.9937407102) - -Warning: sin() expects parameter 1 to be float, string given in %s on line %d -NULL float(0.8268795405) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/sinh_variation.phpt b/ext/standard/tests/math/sinh_variation.phpt index e47e94d629..5e576f447f 100644 --- a/ext/standard/tests/math/sinh_variation.phpt +++ b/ext/standard/tests/math/sinh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(4872401723) float(4872401723) float(7641446995) float(7641446995) - -Warning: sinh() expects parameter 1 to be float, string given in %s on line %d -NULL float(INF) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/sqrt_variation.phpt b/ext/standard/tests/math/sqrt_variation.phpt index 7369b98dfd..6e2304b437 100644 --- a/ext/standard/tests/math/sqrt_variation.phpt +++ b/ext/standard/tests/math/sqrt_variation.phpt @@ -22,7 +22,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -47,9 +46,6 @@ float(4.7958315233127) float(4.7958315233127) float(4.8425200051213) float(4.8425200051213) - -Warning: sqrt() expects parameter 1 to be float, string given in %s on line %d -NULL float(31.622776601684) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/tan_variation.phpt b/ext/standard/tests/math/tan_variation.phpt index 81546bbf6f..2c9ede4738 100644 --- a/ext/standard/tests/math/tan_variation.phpt +++ b/ext/standard/tests/math/tan_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1.588153083) float(1.588153083) float(8.895619796) float(8.895619796) - -Warning: tan() expects parameter 1 to be float, string given in %s on line %d -NULL float(1.470324156) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/tanh_variation.phpt b/ext/standard/tests/math/tanh_variation.phpt index b1b477c150..907f802b8a 100644 --- a/ext/standard/tests/math/tanh_variation.phpt +++ b/ext/standard/tests/math/tanh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1) float(1) float(1) float(1) - -Warning: tanh() expects parameter 1 to be float, string given in %s on line %d -NULL float(1) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/misc/get_browser_error.phpt b/ext/standard/tests/misc/get_browser_error.phpt index c8689d8370..dea6cb27f7 100644 --- a/ext/standard/tests/misc/get_browser_error.phpt +++ b/ext/standard/tests/misc/get_browser_error.phpt @@ -30,9 +30,6 @@ echo "*** Testing get_browser() : error functionality ***\n"; /* Unknown browser uses defaults. */ var_dump( get_browser( 'foobar', true ) ); -/* More than expected arguments */ -var_dump( get_browser( 'foobar', true, 15 ) ); - /* Some wrong parameters, no HTTP_USER_AGENT set */ var_dump( get_browser( null, 'foobar' ) ); @@ -111,9 +108,6 @@ array(34) { string(1) "0" } -Warning: get_browser() expects at most 2 parameters, 3 given in %s on line %d -NULL - Warning: get_browser(): HTTP_USER_AGENT variable is not set, cannot determine user agent name in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/network/fsockopen_error.phpt b/ext/standard/tests/network/fsockopen_error.phpt index 638412b47f..ea08335f2d 100644 --- a/ext/standard/tests/network/fsockopen_error.phpt +++ b/ext/standard/tests/network/fsockopen_error.phpt @@ -11,21 +11,6 @@ Test fsockopen() function : error conditions echo "*** Testing fsockopen() : basic error conditions ***\n"; - -echo "\n-- Testing fsockopen() function with more than expected no. of arguments --\n"; -$hostname = 'string_val'; -$port = 10; -$errno = 10; -$errstr = 'string_val'; -$timeout = 10.5; -$extra_arg = 10; -var_dump( fsockopen($hostname, $port, $errno, $errstr, $timeout, $extra_arg) ); -var_dump($errstr); -var_dump($errno); - -echo "\n-- Testing fsockopen() function with less than expected no. of arguments --\n"; -var_dump( fsockopen() ); - echo "\n-- Attempting to connect to a non-existent socket --\n"; $hostname = 'tcp://127.0.0.1'; // loopback address $port = 31337; @@ -49,18 +34,6 @@ echo "Done"; --EXPECTF-- *** Testing fsockopen() : basic error conditions *** --- Testing fsockopen() function with more than expected no. of arguments -- - -Warning: fsockopen() expects at most 5 parameters, 6 given in %s on line %d -bool(false) -string(10) "string_val" -int(10) - --- Testing fsockopen() function with less than expected no. of arguments -- - -Warning: fsockopen() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -- Attempting to connect to a non-existent socket -- Warning: fsockopen(): unable to connect to tcp://127.0.0.1:31337 (%a) in %s on line %d diff --git a/ext/standard/tests/network/gethostbyaddr_error.phpt b/ext/standard/tests/network/gethostbyaddr_error.phpt index f7982d5ca4..a33a71185f 100644 --- a/ext/standard/tests/network/gethostbyaddr_error.phpt +++ b/ext/standard/tests/network/gethostbyaddr_error.phpt @@ -11,16 +11,6 @@ Test gethostbyaddr() function : error conditions echo "Testing gethostbyaddr : error conditions\n"; -// Zero arguments -echo "\n-- Testing gethostbyaddr function with Zero arguments --\n"; -var_dump( gethostbyaddr() ); - -//Test gethostbyaddr with one more than the expected number of arguments -echo "\n-- Testing gethostbyaddr function with more than expected no. of arguments --\n"; -$ip_address = 'string_val'; -$extra_arg = 10; -var_dump( gethostbyaddr($ip_address, $extra_arg) ); - echo "\n-- Testing gethostbyaddr function with invalid addresses --\n"; $ip_address = 'invalid'; @@ -37,16 +27,6 @@ echo "Done"; --EXPECTREGEX-- Testing gethostbyaddr : error conditions --- Testing gethostbyaddr function with Zero arguments -- - -Warning: gethostbyaddr\(\) expects exactly 1 parameter, 0 given in .* on line \d+ -NULL - --- Testing gethostbyaddr function with more than expected no. of arguments -- - -Warning: gethostbyaddr\(\) expects exactly 1 parameter, 2 given in .* on line \d+ -NULL - -- Testing gethostbyaddr function with invalid addresses -- Warning: gethostbyaddr\(\): Address is not (in a.b.c.d form|a valid IPv4 or IPv6 address) in .* on line \d+ diff --git a/ext/standard/tests/network/gethostname.phpt b/ext/standard/tests/network/gethostname.phpt index e7caaf48eb..57f4c498d0 100644 --- a/ext/standard/tests/network/gethostname.phpt +++ b/ext/standard/tests/network/gethostname.phpt @@ -5,10 +5,6 @@ marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao p --FILE-- <?php var_dump(gethostname()); -var_dump(gethostname("php-zend-brazil")); ?> --EXPECTF-- -%s - -Warning: gethostname() expects exactly %d parameters, %d given in %s on line %d -NULL +string(%d) "%s" diff --git a/ext/standard/tests/network/getprotobyname_error.phpt b/ext/standard/tests/network/getprotobyname_error.phpt index 7ee366ac7a..52ef3b8ee0 100644 --- a/ext/standard/tests/network/getprotobyname_error.phpt +++ b/ext/standard/tests/network/getprotobyname_error.phpt @@ -4,13 +4,8 @@ getprotobyname function errors test edgarsandi - <edgar.r.sandi@gmail.com> --FILE-- <?php - // empty protocol name - var_dump(getprotobyname()); - - // invalid protocol name - var_dump(getprotobyname('abc')); +// invalid protocol name +var_dump(getprotobyname('abc')); ?> ---EXPECTF-- -Warning: getprotobyname() expects exactly 1 parameter, 0 given in %s on line %d -NULL +--EXPECT-- bool(false) diff --git a/ext/standard/tests/network/getprotobynumber_error.phpt b/ext/standard/tests/network/getprotobynumber_error.phpt index 7df12e864a..dda2661b5a 100644 --- a/ext/standard/tests/network/getprotobynumber_error.phpt +++ b/ext/standard/tests/network/getprotobynumber_error.phpt @@ -4,13 +4,8 @@ getprotobynumber function errors test edgarsandi - <edgar.r.sandi@gmail.com> --FILE-- <?php - // empty protocol number - var_dump(getprotobynumber()); - - // invalid protocol number - var_dump(getprotobynumber(999)); +// invalid protocol number +var_dump(getprotobynumber(999)); ?> ---EXPECTF-- -Warning: getprotobynumber() expects exactly 1 parameter, 0 given in %s on line %d -NULL +--EXPECT-- bool(false) diff --git a/ext/standard/tests/network/inet.phpt b/ext/standard/tests/network/inet.phpt index a1e70a0020..81db0016b5 100644 --- a/ext/standard/tests/network/inet.phpt +++ b/ext/standard/tests/network/inet.phpt @@ -14,12 +14,10 @@ var_dump(inet_ntop($packed)); $packed = chr(255) . chr(255) . chr(255) . chr(0); var_dump(inet_ntop($packed)); -var_dump(inet_ntop()); var_dump(inet_ntop(-1)); var_dump(inet_ntop("")); var_dump(inet_ntop("blah-blah")); -var_dump(inet_pton()); var_dump(inet_pton("")); var_dump(inet_pton(-1)); var_dump(inet_pton("abra")); @@ -40,15 +38,9 @@ echo "Done\n"; --EXPECTF-- string(9) "127.0.0.1" string(13) "255.255.255.0" - -Warning: inet_ntop() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) bool(false) bool(false) bool(false) - -Warning: inet_pton() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) bool(false) bool(false) bool(false) diff --git a/ext/standard/tests/network/ip.phpt b/ext/standard/tests/network/ip.phpt index 5237c89776..831eee018a 100644 --- a/ext/standard/tests/network/ip.phpt +++ b/ext/standard/tests/network/ip.phpt @@ -21,16 +21,11 @@ foreach ($array as $ip) { var_dump(long2ip($long)); } -var_dump(ip2long()); var_dump(ip2long("")); var_dump(ip2long("777.777.777.777")); var_dump(ip2long("111.111.111.111")); -var_dump(ip2long(array())); -var_dump(long2ip()); var_dump(long2ip(-110000)); -var_dump(long2ip("")); -var_dump(long2ip(array())); echo "Done\n"; ?> @@ -47,23 +42,8 @@ int(0) string(7) "0.0.0.0" int(1118019956) string(14) "66.163.161.116" - -Warning: ip2long() expects exactly 1 parameter, 0 given in %sip.php on line %d -NULL bool(false) bool(false) int(1869573999) - -Warning: ip2long() expects parameter 1 to be string, array given in %sip.php on line %d -NULL - -Warning: long2ip() expects exactly 1 parameter, 0 given in %sip.php on line %d -NULL string(13) "255.254.82.80" - -Warning: long2ip() expects parameter 1 to be int, string given in %sip.php on line %d -NULL - -Warning: long2ip() expects parameter 1 to be int, array given in %sip.php on line %d -NULL Done diff --git a/ext/standard/tests/network/ip_x86_64.phpt b/ext/standard/tests/network/ip_x86_64.phpt index 3c530b8371..06ed1549a6 100644 --- a/ext/standard/tests/network/ip_x86_64.phpt +++ b/ext/standard/tests/network/ip_x86_64.phpt @@ -21,16 +21,11 @@ foreach ($array as $ip) { var_dump(long2ip($long)); } -var_dump(ip2long()); var_dump(ip2long("")); var_dump(ip2long("777.777.777.777")); var_dump(ip2long("111.111.111.111")); -var_dump(ip2long(array())); -var_dump(long2ip()); var_dump(long2ip(-110000)); -var_dump(long2ip("")); -var_dump(long2ip(array())); echo "Done\n"; ?> @@ -47,23 +42,8 @@ int(0) string(7) "0.0.0.0" int(1118019956) string(14) "66.163.161.116" - -Warning: ip2long() expects exactly 1 parameter, 0 given in %sip_x86_64.php on line %d -NULL bool(false) bool(false) int(1869573999) - -Warning: ip2long() expects parameter 1 to be string, array given in %sip_x86_64.php on line %d -NULL - -Warning: long2ip() expects exactly 1 parameter, 0 given in %sip_x86_64.php on line %d -NULL string(13) "255.254.82.80" - -Warning: long2ip() expects parameter 1 to be int, string given in %sip_x86_64.php on line %d -NULL - -Warning: long2ip() expects parameter 1 to be int, array given in %sip_x86_64.php on line %d -NULL Done diff --git a/ext/standard/tests/password/password_bcrypt_errors.phpt b/ext/standard/tests/password/password_bcrypt_errors.phpt index a0826080e6..64496744cb 100644 --- a/ext/standard/tests/password/password_bcrypt_errors.phpt +++ b/ext/standard/tests/password/password_bcrypt_errors.phpt @@ -8,14 +8,6 @@ var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => 3))); var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => 32))); -var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => "foo"))); - -var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => "123456789012345678901"))); - -var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => 123))); - -var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => "foo"))); - ?> --EXPECTF-- Warning: password_hash(): Invalid bcrypt cost parameter specified: 3 in %s on line %d @@ -23,21 +15,3 @@ NULL Warning: password_hash(): Invalid bcrypt cost parameter specified: 32 in %s on line %d NULL - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d - -Warning: password_hash(): Provided salt is too short: 3 expecting 22 in %s on line %d -NULL - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d - -Warning: password_hash(): Provided salt is too short: 21 expecting 22 in %s on line %d -NULL - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d - -Warning: password_hash(): Provided salt is too short: 3 expecting 22 in %s on line %d -NULL - -Warning: password_hash(): Invalid bcrypt cost parameter specified: 0 in %s on line %d -NULL diff --git a/ext/standard/tests/password/password_deprecated_salts.phpt b/ext/standard/tests/password/password_deprecated_salts.phpt deleted file mode 100644 index c173401067..0000000000 --- a/ext/standard/tests/password/password_deprecated_salts.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Test deprecated operation of password_hash() ---FILE-- -<?php -//-=-=-=- - - -var_dump(password_hash("rasmuslerdorf", PASSWORD_BCRYPT, array("cost" => 7, "salt" => "usesomesillystringforsalt"))); - -var_dump(password_hash("test", PASSWORD_BCRYPT, array("salt" => "123456789012345678901" . chr(0)))); - -echo "OK!"; -?> ---EXPECTF-- -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d -string(60) "$2y$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi" - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d -string(60) "$2y$10$MTIzNDU2Nzg5MDEyMzQ1Nej0NmcAWSLR.oP7XOR9HD/vjUuOj100y" -OK! diff --git a/ext/standard/tests/password/password_hash_error.phpt b/ext/standard/tests/password/password_hash_error.phpt index 6416eca91b..04a8249ced 100644 --- a/ext/standard/tests/password/password_hash_error.phpt +++ b/ext/standard/tests/password/password_hash_error.phpt @@ -4,30 +4,31 @@ Test error operation of password_hash() <?php //-=-=-=- -var_dump(password_hash()); - -var_dump(password_hash("foo")); +try { + var_dump(password_hash("foo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(password_hash("foo", array())); var_dump(password_hash("foo", 19, new StdClass)); -var_dump(password_hash("foo", PASSWORD_BCRYPT, "baz")); - -var_dump(password_hash(array(), PASSWORD_BCRYPT)); +try { + var_dump(password_hash("foo", PASSWORD_BCRYPT, "baz")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} -var_dump(password_hash("123", PASSWORD_BCRYPT, array("salt" => array()))); - -/* Non-string salt, checking for memory leaks */ -var_dump(password_hash('123', PASSWORD_BCRYPT, array('salt' => 1234))); +try { + var_dump(password_hash(array(), PASSWORD_BCRYPT)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- -Warning: password_hash() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: password_hash() expects at least 2 parameters, 1 given in %s on line %d -NULL +password_hash() expects at least 2 parameters, 1 given Notice: Array to string conversion in %s on line %d @@ -36,19 +37,5 @@ NULL Warning: password_hash(): Unknown password hashing algorithm: 19 in %s on line %d NULL - -Warning: password_hash() expects parameter 3 to be array, string given in %s on line %d -NULL - -Warning: password_hash() expects parameter 1 to be string, array given in %s on line %d -NULL - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d - -Warning: password_hash(): Non-string salt parameter supplied in %s on line %d -NULL - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d - -Warning: password_hash(): Provided salt is too short: 4 expecting 22 in %s on line %d -NULL +password_hash() expects parameter 3 to be array, string given +password_hash() expects parameter 1 to be string, array given diff --git a/ext/standard/tests/password/password_needs_rehash_error.phpt b/ext/standard/tests/password/password_needs_rehash_error.phpt index 7180d11de7..f64723ee85 100644 --- a/ext/standard/tests/password/password_needs_rehash_error.phpt +++ b/ext/standard/tests/password/password_needs_rehash_error.phpt @@ -3,29 +3,32 @@ Test error operation of password_needs_rehash() --FILE-- <?php //-=-=-=- -var_dump(password_needs_rehash()); -var_dump(password_needs_rehash('')); +try { + var_dump(password_needs_rehash('')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(password_needs_rehash('', [])); -var_dump(password_needs_rehash(array(), PASSWORD_BCRYPT)); +try { + var_dump(password_needs_rehash(array(), PASSWORD_BCRYPT)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} -var_dump(password_needs_rehash("", PASSWORD_BCRYPT, "foo")); +try { + var_dump(password_needs_rehash("", PASSWORD_BCRYPT, "foo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "OK!"; ?> --EXPECTF-- -Warning: password_needs_rehash() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: password_needs_rehash() expects at least 2 parameters, 1 given in %s on line %d -NULL +password_needs_rehash() expects at least 2 parameters, 1 given bool(false) - -Warning: password_needs_rehash() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: password_needs_rehash() expects parameter 3 to be array, string given in %s on line %d -NULL +password_needs_rehash() expects parameter 1 to be string, array given +password_needs_rehash() expects parameter 3 to be array, string given OK! diff --git a/ext/standard/tests/password/password_removed_salt_option.phpt b/ext/standard/tests/password/password_removed_salt_option.phpt new file mode 100644 index 0000000000..356bdec3e8 --- /dev/null +++ b/ext/standard/tests/password/password_removed_salt_option.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test removed support for explicit salt option +--FILE-- +<?php +//-=-=-=- + + +var_dump(strlen(password_hash("rasmuslerdorf", PASSWORD_BCRYPT, array("cost" => 7, "salt" => "usesomesillystringforsalt")))); + +var_dump(strlen(password_hash("test", PASSWORD_BCRYPT, array("salt" => "123456789012345678901" . chr(0))))); + +echo "OK!"; +?> +--EXPECTF-- +Warning: password_hash(): The 'salt' option is no longer supported. The provided salt has been been ignored in %s on line %d +int(60) + +Warning: password_hash(): The 'salt' option is no longer supported. The provided salt has been been ignored in %s on line %d +int(60) +OK! diff --git a/ext/standard/tests/password/password_verify_error.phpt b/ext/standard/tests/password/password_verify_error.phpt index 7f680af448..192a4ae288 100644 --- a/ext/standard/tests/password/password_verify_error.phpt +++ b/ext/standard/tests/password/password_verify_error.phpt @@ -4,14 +4,12 @@ Test error operation of password_verify() <?php //-=-=-=- -var_dump(password_verify()); - -var_dump(password_verify("foo")); +try { + var_dump(password_verify("foo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: password_verify() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: password_verify() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) +--EXPECT-- +password_verify() expects exactly 2 parameters, 1 given diff --git a/ext/standard/tests/streams/bug46426.phpt b/ext/standard/tests/streams/bug46426.phpt index 8c95ea456e..b69c6c557b 100644 --- a/ext/standard/tests/streams/bug46426.phpt +++ b/ext/standard/tests/streams/bug46426.phpt @@ -21,8 +21,6 @@ echo stream_get_contents($tmp, 1, 0); echo "\n"; echo stream_get_contents($tmp, -1); -@unlink($tmp); - ?> --EXPECT-- 23 diff --git a/ext/standard/tests/streams/bug54623.phpt b/ext/standard/tests/streams/bug54623.phpt index c21dc82019..02b1924eea 100644 --- a/ext/standard/tests/streams/bug54623.phpt +++ b/ext/standard/tests/streams/bug54623.phpt @@ -9,9 +9,12 @@ $sock2 = pfsockopen('udp://127.0.0.1', '63844'); var_dump((int)$sock2); @fwrite($sock2, "2"); fclose($sock2); -fwrite($sock, "3"); +try { + fwrite($sock, "3"); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} --EXPECTF-- int(%d) int(%d) - -Warning: fwrite(): supplied resource is not a valid stream resource in %s on line %d +fwrite(): supplied resource is not a valid stream resource diff --git a/ext/standard/tests/streams/stream_get_contents_001.phpt b/ext/standard/tests/streams/stream_get_contents_001.phpt index dc7fcb239c..6f5abcb782 100644 --- a/ext/standard/tests/streams/stream_get_contents_001.phpt +++ b/ext/standard/tests/streams/stream_get_contents_001.phpt @@ -12,8 +12,6 @@ echo stream_get_contents($tmp, 2), "--\n"; echo stream_get_contents($tmp, 2, 3), "--\n"; echo stream_get_contents($tmp, 2, -1), "--\n"; -@unlink($tmp); - ?> --EXPECT-- -- diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt index bb98d7c6e7..7bfa4f0510 100644 --- a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt +++ b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt @@ -10,48 +10,20 @@ Test stream_get_meta_data() function : error conditions echo "*** Testing stream_get_meta_data() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing stream_get_meta_data() function with Zero arguments --\n"; -var_dump( stream_get_meta_data() ); - -//Test stream_get_meta_data with one more than the expected number of arguments -echo "\n-- Testing stream_get_meta_data() function with more than expected no. of arguments --\n"; - -$fp = null; -$extra_arg = 10; -var_dump( stream_get_meta_data($fp, $extra_arg) ); - -echo "\n-- Testing stream_get_meta_data() function with invalid stream resource --\n"; -$fp = null; -var_dump(stream_get_meta_data($fp)); - echo "\n-- Testing stream_get_meta_data() function with closed stream resource --\n"; $fp = fopen(__FILE__, 'r'); fclose($fp); -var_dump(stream_get_meta_data($fp)); +try { + var_dump(stream_get_meta_data($fp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing stream_get_meta_data() : error conditions *** --- Testing stream_get_meta_data() function with Zero arguments -- - -Warning: stream_get_meta_data() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing stream_get_meta_data() function with more than expected no. of arguments -- - -Warning: stream_get_meta_data() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Testing stream_get_meta_data() function with invalid stream resource -- - -Warning: stream_get_meta_data() expects parameter 1 to be resource, null given in %s on line %d -NULL - -- Testing stream_get_meta_data() function with closed stream resource -- - -Warning: stream_get_meta_data(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +stream_get_meta_data(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/streams/stream_resolve_include_path.phpt b/ext/standard/tests/streams/stream_resolve_include_path.phpt index 4109b5672e..f77c0730f3 100644 --- a/ext/standard/tests/streams/stream_resolve_include_path.phpt +++ b/ext/standard/tests/streams/stream_resolve_include_path.phpt @@ -14,8 +14,6 @@ mkdir($include_path_nested); file_put_contents($include_path_file, 'include_path'); file_put_contents($include_path_nested_file, 'include_path'); -var_dump(stream_resolve_include_path()); - set_include_path($include_path . PATH_SEPARATOR . $include_path_nested); var_dump(stream_resolve_include_path('file-does-not-exist')); @@ -24,13 +22,20 @@ var_dump(stream_resolve_include_path('file')); set_include_path($include_path_nested . PATH_SEPARATOR . $include_path); var_dump(stream_resolve_include_path('file')); +?> +--CLEAN-- +<?php +$include_path = __DIR__ . '/test_path'; +$include_path_nested = $include_path . '/nested'; +$include_path_file = $include_path . DIRECTORY_SEPARATOR . 'file'; +$include_path_nested_file = $include_path_nested . DIRECTORY_SEPARATOR . 'file'; + unlink($include_path_nested_file); rmdir($include_path_nested); unlink($include_path_file); rmdir($include_path); +?> --EXPECTF-- -Warning: stream_resolve_include_path() expects exactly 1 parameter, 0 given in %s on line %d -NULL bool(false) string(%d) "%stest_path%sfile" string(%d) "%stest_path%snested%sfile" diff --git a/ext/standard/tests/streams/stream_set_chunk_size.phpt b/ext/standard/tests/streams/stream_set_chunk_size.phpt index 8c2ae9865b..851fd2cfcf 100644 --- a/ext/standard/tests/streams/stream_set_chunk_size.phpt +++ b/ext/standard/tests/streams/stream_set_chunk_size.phpt @@ -51,7 +51,6 @@ var_dump(strlen(fwrite($f, str_repeat('b', 250)))); echo "\nerror conditions\n"; var_dump(stream_set_chunk_size($f, 0)); var_dump(stream_set_chunk_size($f, -1)); -var_dump(stream_set_chunk_size($f, array())); --EXPECTF-- bool(true) should return previous chunk size (8192) @@ -87,6 +86,3 @@ bool(false) Warning: stream_set_chunk_size(): The chunk size must be a positive integer, given -1 in %s on line %d bool(false) - -Warning: stream_set_chunk_size() expects parameter 2 to be int, array given in %s on line %d -bool(false) diff --git a/ext/standard/tests/streams/stream_set_timeout_error.phpt b/ext/standard/tests/streams/stream_set_timeout_error.phpt index 0334b951e0..7dcc645422 100644 --- a/ext/standard/tests/streams/stream_set_timeout_error.phpt +++ b/ext/standard/tests/streams/stream_set_timeout_error.phpt @@ -10,9 +10,6 @@ Test stream_set_timeout() function : error conditions echo "*** Testing stream_set_timeout() : error conditions ***\n"; -//Test stream_set_timeout with one more than the expected number of arguments -echo "\n-- Testing stream_set_timeout() function with more than expected no. of arguments --\n"; - for ($i=0; $i<100; $i++) { $port = rand(10000, 65000); /* Setup socket server */ @@ -26,22 +23,14 @@ $client = fsockopen("tcp://127.0.0.1:$port"); $seconds = 10; $microseconds = 10; -$extra_arg = 10; -var_dump( stream_set_timeout($client, $seconds, $microseconds, $extra_arg) ); - -// Testing stream_set_timeout with one less than the expected number of arguments -echo "\n-- Testing stream_set_timeout() function with less than expected no. of arguments --\n"; - -$seconds = 10; -var_dump( stream_set_timeout($client) ); - echo "\n-- Testing stream_set_timeout() function with a closed socket --\n"; fclose($client); -var_dump( stream_set_timeout($client, $seconds) ); - -echo "\n-- Testing stream_set_timeout() function with an invalid stream --\n"; -var_dump( stream_set_timeout($seconds, $seconds) ); +try { + var_dump( stream_set_timeout($client, $seconds) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing stream_set_timeout() function with a stream that does not support timeouts --\n"; $filestream = fopen(__FILE__, "r"); @@ -55,25 +44,8 @@ echo "Done"; --EXPECTF-- *** Testing stream_set_timeout() : error conditions *** --- Testing stream_set_timeout() function with more than expected no. of arguments -- - -Warning: stream_set_timeout() expects at most 3 parameters, 4 given in %s on line %d -NULL - --- Testing stream_set_timeout() function with less than expected no. of arguments -- - -Warning: stream_set_timeout() expects at least 2 parameters, 1 given in %s on line %d -NULL - -- Testing stream_set_timeout() function with a closed socket -- - -Warning: stream_set_timeout(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - --- Testing stream_set_timeout() function with an invalid stream -- - -Warning: stream_set_timeout() expects parameter 1 to be resource, int given in %s on line %d -NULL +stream_set_timeout(): supplied resource is not a valid stream resource -- Testing stream_set_timeout() function with a stream that does not support timeouts -- bool(false) diff --git a/ext/standard/tests/strings/addcslashes_001.phpt b/ext/standard/tests/strings/addcslashes_001.phpt Binary files differindex 4080c7214d..5b60f6168d 100644 --- a/ext/standard/tests/strings/addcslashes_001.phpt +++ b/ext/standard/tests/strings/addcslashes_001.phpt diff --git a/ext/standard/tests/strings/bug24208.phpt b/ext/standard/tests/strings/bug24208.phpt deleted file mode 100644 index f85c9c1e54..0000000000 --- a/ext/standard/tests/strings/bug24208.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Bug #24208 (parse_str() is not working) ---FILE-- -<?php -$a = $b = $c = "oops"; -parse_str("a=1&b=2&c=3"); -var_dump($a, $b, $c); -?> ---EXPECTF-- -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d -string(1) "1" -string(1) "2" -string(1) "3" diff --git a/ext/standard/tests/strings/bug33605.phpt b/ext/standard/tests/strings/bug33605.phpt index 7ba38f94f5..b3cb2ece95 100644 --- a/ext/standard/tests/strings/bug33605.phpt +++ b/ext/standard/tests/strings/bug33605.phpt @@ -2,10 +2,12 @@ Bug #33605 (substr_compare crashes) --FILE-- <?php -$res = substr_compare("aa", "a", -99999999, -1, 0); -var_dump($res); +try { + substr_compare("aa", "a", -99999999, -1, 0); +} catch (\Error $e) { + echo $e->getMessage(); +} ?> --EXPECTF-- -Warning: substr_compare(): The length must be greater than or equal to zero in %s on line %d -bool(false) +The length must be greater than or equal to zero diff --git a/ext/standard/tests/strings/bug37262.phpt b/ext/standard/tests/strings/bug37262.phpt index b964c4a659..92abb29206 100644 --- a/ext/standard/tests/strings/bug37262.phpt +++ b/ext/standard/tests/strings/bug37262.phpt @@ -2,9 +2,7 @@ Bug #37262 (var_export() does not escape \0 character) --FILE-- <?php -$func = create_function('$a', 'return $a;'); -var_export($func); +var_export("foo\0bar"); ?> ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -'' . "\0" . 'lambda_%d' +--EXPECT-- +'foo' . "\0" . 'bar' diff --git a/ext/standard/tests/strings/bug40754.phpt b/ext/standard/tests/strings/bug40754.phpt index 26ea5bc770..d502bff829 100644 --- a/ext/standard/tests/strings/bug40754.phpt +++ b/ext/standard/tests/strings/bug40754.phpt @@ -53,10 +53,10 @@ bool(false) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strrpos(): Offset not contained in string in %s on line %d bool(false) -Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strripos(): Offset not contained in string in %s on line %d bool(false) int(2) string(8) "abcdeabc" diff --git a/ext/standard/tests/strings/bug54322.phpt b/ext/standard/tests/strings/bug54322.phpt index 6b8d10daa7..f31f94fd84 100644 --- a/ext/standard/tests/strings/bug54322.phpt +++ b/ext/standard/tests/strings/bug54322.phpt @@ -2,9 +2,11 @@ Bug #54322: Null pointer deref in get_html_translation_table due to information loss in long-to-int conversion --FILE-- <?php -var_dump( -get_html_translation_table(NAN, 0, "UTF-8") > 0 -); ---EXPECTF-- -Warning: get_html_translation_table() expects parameter 1 to be int, float given in %s on line %d -bool(false) +try { + var_dump(get_html_translation_table(NAN, 0, "UTF-8") > 0); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +?> +--EXPECT-- +get_html_translation_table() expects parameter 1 to be int, float given diff --git a/ext/standard/tests/strings/bug61116.phpt b/ext/standard/tests/strings/bug61116.phpt index b9b38a7bbb..478004a635 100644 --- a/ext/standard/tests/strings/bug61116.phpt +++ b/ext/standard/tests/strings/bug61116.phpt @@ -9,18 +9,20 @@ echo new ReflectionFunction('get_html_translation_table'), "\n"; Function [ <internal:standard> function htmlspecialchars ] { - Parameters [4] { - Parameter #0 [ <required> $string ] - Parameter #1 [ <optional> $quote_style ] - Parameter #2 [ <optional> $encoding ] - Parameter #3 [ <optional> $double_encode ] + Parameter #0 [ <required> string $string ] + Parameter #1 [ <optional> int $quote_style ] + Parameter #2 [ <optional> string or NULL $encoding ] + Parameter #3 [ <optional> bool $double_encode ] } + - Return [ string ] } Function [ <internal:standard> function get_html_translation_table ] { - Parameters [3] { - Parameter #0 [ <optional> $table ] - Parameter #1 [ <optional> $quote_style ] - Parameter #2 [ <optional> $encoding ] + Parameter #0 [ <optional> int $table ] + Parameter #1 [ <optional> int $quote_style ] + Parameter #2 [ <optional> string $encoding ] } + - Return [ array ] } diff --git a/ext/standard/tests/strings/bug63943.phpt b/ext/standard/tests/strings/bug63943.phpt deleted file mode 100644 index 6018879b24..0000000000 --- a/ext/standard/tests/strings/bug63943.phpt +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Bug #63943 (Bad warning text from strpos() on empty needle) ---FILE-- -<?php -strpos("lllllll", ''); -?> ---EXPECTF-- -Warning: strpos(): Empty needle in %sbug63943.php on line %d diff --git a/ext/standard/tests/strings/bug77439.phpt b/ext/standard/tests/strings/bug77439.phpt index ee8a3d2845..98ae56222b 100644 --- a/ext/standard/tests/strings/bug77439.phpt +++ b/ext/standard/tests/strings/bug77439.phpt @@ -2,12 +2,11 @@ Bug #77439: parse_str segfaults when inserting item into existing array --FILE-- <?php -$a = []; -parse_str('a[1]=1'); -var_dump($a); +$vars = ['a' => []]; +parse_str('a[1]=1', $vars); +var_dump($vars['a']); ?> ---EXPECTF-- -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d +--EXPECT-- array(1) { [1]=> string(1) "1" diff --git a/ext/standard/tests/strings/chr_error.phpt b/ext/standard/tests/strings/chr_error.phpt Binary files differindex 4d595543bb..820cadece0 100644 --- a/ext/standard/tests/strings/chr_error.phpt +++ b/ext/standard/tests/strings/chr_error.phpt diff --git a/ext/standard/tests/strings/chunk_split.phpt b/ext/standard/tests/strings/chunk_split.phpt index 648388f23a..a2696cd26b 100644 --- a/ext/standard/tests/strings/chunk_split.phpt +++ b/ext/standard/tests/strings/chunk_split.phpt @@ -7,17 +7,6 @@ echo chunk_split('foooooooooooooooo', 5)."\n"; echo chunk_split(str_repeat('X', 2*76))."\n"; echo chunk_split("test", 10, "|end") . "\n"; -$a=str_repeat("B", 65535); -$b=1; -$c=str_repeat("B", 65535); -var_dump(chunk_split($a,$b,$c)); - -$a=str_repeat("B", 65537); -$b=1; -$c=str_repeat("B", 65537); -var_dump(chunk_split($a,$b,$c)); - - ?> --EXPECT-- a-b-c- @@ -30,5 +19,3 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX test|end -bool(false) -bool(false) diff --git a/ext/standard/tests/strings/chunk_split_variation1_32bit.phpt b/ext/standard/tests/strings/chunk_split_variation1_32bit.phpt new file mode 100644 index 0000000000..f9825eb438 --- /dev/null +++ b/ext/standard/tests/strings/chunk_split_variation1_32bit.phpt @@ -0,0 +1,26 @@ +--TEST-- +Test chunk_split() function : usage variations - unexpected large '$end' string argument variation 1 +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); +if (getenv("USE_ZEND_ALLOC") === "0") die("skip ZMM is disabled"); +?> +--FILE-- +<?php +/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]]) + * Description: Returns split line + * Source code: ext/standard/string.c + * Alias to functions: none +*/ + +echo "*** Testing chunk_split() : unexpected large 'end' string argument variation 1 ***\n"; + +$a=str_repeat("B", 65535); +$b=1; +$c=str_repeat("B", 65535); +var_dump(chunk_split($a,$b,$c)); +?> +--EXPECTF-- +*** Testing chunk_split() : unexpected large 'end' string argument variation 1 *** + +Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d diff --git a/ext/standard/tests/strings/chunk_split_variation2_32bit.phpt b/ext/standard/tests/strings/chunk_split_variation2_32bit.phpt new file mode 100644 index 0000000000..ca0948d999 --- /dev/null +++ b/ext/standard/tests/strings/chunk_split_variation2_32bit.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test chunk_split() function : usage variations - unexpected large '$end' string argument variation 2 +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); +?> +--FILE-- +<?php +/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]]) + * Description: Returns split line + * Source code: ext/standard/string.c + * Alias to functions: none +*/ + +echo "*** Testing chunk_split() : unexpected large 'end' string argument variation 2 ***\n"; + +$a=str_repeat("B", 65537); +$b=1; +$c=str_repeat("B", 65537); +var_dump(chunk_split($a,$b,$c)); +?> +--EXPECTF-- +*** Testing chunk_split() : unexpected large 'end' string argument variation 2 *** + +Fatal error: Possible integer overflow in memory allocation (65537 * 65537 + 65556) in %s on line %d diff --git a/ext/standard/tests/strings/chunk_split_variation3.phpt b/ext/standard/tests/strings/chunk_split_variation3.phpt new file mode 100644 index 0000000000..3992e212d5 --- /dev/null +++ b/ext/standard/tests/strings/chunk_split_variation3.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test chunk_split() function : usage variations - unexpected large number of chunks +--SKIPIF-- +<?php +if (getenv("USE_ZEND_ALLOC") === "0") die("skip ZMM is disabled"); +?> +--FILE-- +<?php +/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]]) + * Description: Returns split line + * Source code: ext/standard/string.c + * Alias to functions: none +*/ + +$chunk_length = 1; + +echo "*** Testing chunk_split() : unexpected large 'end' string argument variation 2 ***\n"; + +echo "Body generation\n"; +$body = str_repeat("Hello", 10000000); + +echo "Using chunk_split()\n"; +var_dump(chunk_split($body, $chunk_length)); +?> +--EXPECTF-- +*** Testing chunk_split() : unexpected large 'end' string argument variation 2 *** +Body generation +Using chunk_split() + +Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d diff --git a/ext/standard/tests/strings/chunk_split_variation5.phpt b/ext/standard/tests/strings/chunk_split_variation5.phpt Binary files differindex 8a5a8cd6bb..bea49d24b4 100644 --- a/ext/standard/tests/strings/chunk_split_variation5.phpt +++ b/ext/standard/tests/strings/chunk_split_variation5.phpt diff --git a/ext/standard/tests/strings/chunk_split_variation8.phpt b/ext/standard/tests/strings/chunk_split_variation8.phpt index bfafd1af0b..15c224962e 100644 --- a/ext/standard/tests/strings/chunk_split_variation8.phpt +++ b/ext/standard/tests/strings/chunk_split_variation8.phpt @@ -46,7 +46,13 @@ $values = array ( // loop through each element of values for 'chunklen' for($count = 0; $count < count($values); $count++) { echo "-- Iteration ".($count+1). " --\n"; - var_dump( chunk_split($heredoc_str, $values[$count], $ending) ); + try { + var_dump( chunk_split($heredoc_str, $values[$count], $ending) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } } echo "Done" @@ -54,18 +60,14 @@ echo "Done" --EXPECTF-- *** Testing chunk_split() : different 'chunklen' with heredoc 'str' *** -- Iteration 1 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) +Chunk length should be greater than zero -- Iteration 2 -- string(504) "T:::h:::i:::s:::':::s::: :::h:::e:::r:::e:::d:::o:::c::: :::s:::t:::r:::i:::n:::g::: :::w:::i:::t:::h::: ::: ::: :::a:::n:::d::: ::: ::: :::w:::h:::i:::t:::e::: :::s:::p:::a:::c:::e::: :::c:::h:::a:::r:::.::: :::I:::t::: :::h:::a:::s::: :::_:::s:::p:::e:::c:::i:::@:::l::: :::c:::h:::@:::r:::$::: :::2:::2:::2:::2::: :::!:::!:::!:::N:::o:::w::: :::\:::k::: :::a:::s::: :::e:::s:::c:::a:::p:::e::: :::c:::h:::a:::r::: :::t:::o::: :::t:::e:::s:::t::: :::c:::h:::u:::n:::k:::_:::s:::p:::l:::i:::t:::(:::):::" -- Iteration 3 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) +Chunk length should be greater than zero -- Iteration 4 -- string(129) "This's heredoc string with and white space char. @@ -82,11 +84,7 @@ string(129) "This's heredoc string with and It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test chunk_split():::" -- Iteration 7 -- - -Warning: chunk_split() expects parameter 2 to be int, float given in %s on line %d -NULL +chunk_split() expects parameter 2 to be int, float given -- Iteration 8 -- - -Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d -bool(false) +Chunk length should be greater than zero Done diff --git a/ext/standard/tests/strings/convert_cyr_string.phpt b/ext/standard/tests/strings/convert_cyr_string.phpt index 01bd0f50fc..3bbde00cf1 100644 --- a/ext/standard/tests/strings/convert_cyr_string.phpt +++ b/ext/standard/tests/strings/convert_cyr_string.phpt @@ -4,7 +4,6 @@ basic convert_cyr_string() tests <?php var_dump(convert_cyr_string("", "", "")); -var_dump(convert_cyr_string(array(), array(), array())); var_dump(convert_cyr_string("[[[[[[", "q", "m")); var_dump(convert_cyr_string("[[[[[[", "k", "w")); @@ -26,11 +25,6 @@ string(0) "" Deprecated: Function convert_cyr_string() is deprecated in %s on line %d -Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d -NULL - -Deprecated: Function convert_cyr_string() is deprecated in %s on line %d - Warning: convert_cyr_string(): Unknown source charset: q in %s on line %d string(6) "[[[[[[" diff --git a/ext/standard/tests/strings/crypt.phpt b/ext/standard/tests/strings/crypt.phpt index f64b61cb5f..270f0372d1 100644 --- a/ext/standard/tests/strings/crypt.phpt +++ b/ext/standard/tests/strings/crypt.phpt @@ -19,8 +19,6 @@ echo (CRYPT_MD5) ? ((crypt($str, $salt3) === $res_3) ? 'MD5' : 'MD5 - ERROR echo (CRYPT_BLOWFISH) ? ((crypt($str, $salt4) === $res_4) ? 'BLO' : 'BLO - ERROR') : 'BLO', "\n"; var_dump(crypt($str)); -var_dump(crypt()); -var_dump(crypt("", "", "")); ?> --EXPECTF-- @@ -31,9 +29,3 @@ BLO Notice: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash. in %s on line %d string(%d) "%s" - -Warning: crypt() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: crypt() expects at most 2 parameters, 3 given in %s on line %d -NULL diff --git a/ext/standard/tests/strings/dirname_error.phpt b/ext/standard/tests/strings/dirname_error.phpt index 98a9ea5b45..daf4e2cb0a 100644 --- a/ext/standard/tests/strings/dirname_error.phpt +++ b/ext/standard/tests/strings/dirname_error.phpt @@ -6,26 +6,17 @@ Test dirname() function : error conditions Description: Returns directory name component of path. */ echo "*** Testing error conditions ***\n"; -// zero arguments -var_dump( dirname() ); // Bad arg -var_dump( dirname("/var/tmp/bar.gz", 0) ); - -// more than expected no. of arguments -var_dump( dirname("/var/tmp/bar.gz", 1, ".gz") ); +try { + dirname("/var/tmp/bar.gz", 0); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} echo "Done\n"; ?> --EXPECTF-- *** Testing error conditions *** - -Warning: dirname() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: dirname(): Invalid argument, levels must be >= 1 in %s on line %d -NULL - -Warning: dirname() expects at most 2 parameters, 3 given in %s on line %d -NULL +Invalid argument, levels must be >= 1 Done diff --git a/ext/standard/tests/strings/dirname_multi.phpt b/ext/standard/tests/strings/dirname_multi.phpt index febbd0c293..f95bf16d2a 100644 --- a/ext/standard/tests/strings/dirname_multi.phpt +++ b/ext/standard/tests/strings/dirname_multi.phpt @@ -11,14 +11,17 @@ if((substr(PHP_OS, 0, 3) == "WIN")) Description: Returns directory name component of path. */ for ($i=0 ; $i<5 ; $i++) { - var_dump(dirname("/foo/bar/baz", $i)); + try { + var_dump(dirname("/foo/bar/baz", $i)); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } } var_dump(dirname("/foo/bar/baz", PHP_INT_MAX)); ?> Done --EXPECTF-- -Warning: dirname(): Invalid argument, levels must be >= 1 in %sdirname_multi.php on line %d -NULL +Invalid argument, levels must be >= 1 string(8) "/foo/bar" string(4) "/foo" string(1) "/" diff --git a/ext/standard/tests/strings/dirname_multi_win.phpt b/ext/standard/tests/strings/dirname_multi_win.phpt index 4fed5895e6..9dc0c05c59 100644 --- a/ext/standard/tests/strings/dirname_multi_win.phpt +++ b/ext/standard/tests/strings/dirname_multi_win.phpt @@ -10,17 +10,22 @@ if((substr(PHP_OS, 0, 3) != "WIN")) /* Prototype: string dirname ( string $path [, int nb]); Description: Returns directory name component of path. */ + for ($i=0 ; $i<5 ; $i++) { - var_dump(dirname("/foo/bar/baz", $i)); + try { + var_dump(dirname("/foo/bar/baz", $i)); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } } + var_dump(dirname("/foo/bar/baz", PHP_INT_MAX)); var_dump(dirname("g:/foo/bar/baz", PHP_INT_MAX)); var_dump(dirname("g:foo/bar/baz", PHP_INT_MAX)); ?> Done ---EXPECTF-- -Warning: dirname(): Invalid argument, levels must be >= 1 in %sdirname_multi_win.php on line %d -NULL +--EXPECT-- +Invalid argument, levels must be >= 1 string(8) "/foo/bar" string(4) "/foo" string(1) "\" diff --git a/ext/standard/tests/strings/explode.phpt b/ext/standard/tests/strings/explode.phpt index 84cdcb985f..8fa3b62079 100644 --- a/ext/standard/tests/strings/explode.phpt +++ b/ext/standard/tests/strings/explode.phpt @@ -8,21 +8,40 @@ error_reporting=2047 <?php /* From http://bugs.php.net/19865 */ echo var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE); +echo "\n"; echo md5(var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE)); echo "\n"; -var_dump(@explode("", "")); -var_dump(@explode("", NULL)); -var_dump(@explode(NULL, "")); -var_dump(@explode("a", "")); -var_dump(@explode("a", "a")); -var_dump(@explode("a", NULL)); -var_dump(@explode(NULL, "a")); -var_dump(@explode("abc", "acb")); -var_dump(@explode("somestring", "otherstring")); -var_dump(@explode("somestring", "otherstring", -1)); -var_dump(@explode("a", "aaaaaa")); -var_dump(@explode("==", str_repeat("-=".ord(0)."=-", 10))); -var_dump(@explode("=", str_repeat("-=".ord(0)."=-", 10))); + +try { + var_dump(explode("", "")); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} +try { + var_dump(explode("", NULL)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} +try { + var_dump(explode(NULL, "")); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + +var_dump(explode("a", "")); +var_dump(explode("a", "a")); +var_dump(explode("a", NULL)); +try { + var_dump(explode(NULL, "a")); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} +var_dump(explode("abc", "acb")); +var_dump(explode("somestring", "otherstring")); +var_dump(explode("somestring", "otherstring", -1)); +var_dump(explode("a", "aaaaaa")); +var_dump(explode("==", str_repeat("-=".ord(0)."=-", 10))); +var_dump(explode("=", str_repeat("-=".ord(0)."=-", 10))); ////////////////////////////////////// var_dump(explode(":","a lazy dog:jumps:over:",-1)); var_dump(explode(":","a lazy dog:jumps:over", -1)); @@ -39,10 +58,11 @@ array ( 2 => 'f', 3 => '1', 4 => 'd', -)d6bee42a771449205344c0938ad4f035 -bool(false) -bool(false) -bool(false) +) +d6bee42a771449205344c0938ad4f035 +Empty delimiter +Empty delimiter +Empty delimiter array(1) { [0]=> string(0) "" @@ -57,7 +77,7 @@ array(1) { [0]=> string(0) "" } -bool(false) +Empty delimiter array(1) { [0]=> string(3) "acb" diff --git a/ext/standard/tests/strings/explode1.phpt b/ext/standard/tests/strings/explode1.phpt index 6842947605..4d692e49e8 100644 --- a/ext/standard/tests/strings/explode1.phpt +++ b/ext/standard/tests/strings/explode1.phpt @@ -32,12 +32,29 @@ $string = "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"; */ $counter = 1; foreach($delimiters as $delimiter) { - echo "-- Iteration $counter --\n"; - var_dump( explode($delimiter, $string, -1) ); - var_dump( explode($delimiter, $string, 0) ); - var_dump( explode($delimiter, $string, 1) ); - var_dump( explode($delimiter, $string, 2) ); - $counter++; + echo "-- Iteration $counter --\n"; + + try { + var_dump( explode($delimiter, $string, -1) ); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } + try { + var_dump( explode($delimiter, $string, 0) ); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } + try { + var_dump( explode($delimiter, $string, 1) ); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } + try { + var_dump( explode($delimiter, $string, 2) ); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } + $counter++; } echo "\n*** Testing explode() with miscelleneous input arguments ***\n"; @@ -77,41 +94,20 @@ class string1 { $obj = new string1; var_dump( explode("b", $obj) ); -echo "\n*** Testing error conditions ***\n"; -/* checking for arguments <2 and >3 */ -var_dump( explode(":", "array1:array2:array3", -1, -33) ); -var_dump( explode(":") ); - echo "Done\n"; ?> --EXPECTF-- *** Testing explode() for basic operations *** -- Iteration 1 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) +Empty delimiter +Empty delimiter +Empty delimiter +Empty delimiter -- Iteration 2 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) +Empty delimiter +Empty delimiter +Empty delimiter +Empty delimiter -- Iteration 3 -- array(1) { [0]=> @@ -213,18 +209,10 @@ array(2) { string(56) "234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND" } -- Iteration 7 -- - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) - -Warning: explode(): Empty delimiter in %s on line %d -bool(false) +Empty delimiter +Empty delimiter +Empty delimiter +Empty delimiter -- Iteration 8 -- array(2) { [0]=> @@ -498,12 +486,4 @@ array(2) { [1]=> string(4) "ject" } - -*** Testing error conditions *** - -Warning: explode() expects at most 3 parameters, 4 given in %s on line %d -NULL - -Warning: explode() expects at least 2 parameters, 1 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/strings/fprintf_error.phpt b/ext/standard/tests/strings/fprintf_error.phpt index ccc37407e8..1ffc188051 100644 --- a/ext/standard/tests/strings/fprintf_error.phpt +++ b/ext/standard/tests/strings/fprintf_error.phpt @@ -7,25 +7,31 @@ Test fprintf() function (errors) echo "*** Testing Error Conditions ***\n"; /* zero argument */ -var_dump( fprintf() ); +try { + var_dump( fprintf() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* scalar argument */ -var_dump( fprintf(3) ); +try { + var_dump( fprintf(3) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* NULL argument */ -var_dump( fprintf(NULL) ); +try { + var_dump( fprintf(NULL) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> --EXPECTF-- *** Testing Error Conditions *** - -Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d -NULL - -Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d -NULL - -Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d -NULL +Wrong parameter count for fprintf() +Wrong parameter count for fprintf() +Wrong parameter count for fprintf() Done diff --git a/ext/standard/tests/strings/highlight_file.phpt b/ext/standard/tests/strings/highlight_file.phpt index 4eba32aebc..895e53358c 100644 --- a/ext/standard/tests/strings/highlight_file.phpt +++ b/ext/standard/tests/strings/highlight_file.phpt @@ -13,7 +13,6 @@ allow_url_fopen=1 $filename = __DIR__."/highlight_file.dat"; -var_dump(highlight_file()); var_dump(highlight_file($filename)); var_dump(highlight_file('data:,<?php echo "test"; ?>')); @@ -39,9 +38,6 @@ echo "Done\n"; --EXPECTF-- Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0 -Warning: highlight_file() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - Warning: highlight_file(%shighlight_file.dat): failed to open stream: No such file or directory in %s on line %d Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d diff --git a/ext/standard/tests/strings/htmlentities24.phpt b/ext/standard/tests/strings/htmlentities24.phpt index 5a023df701..f2abfd5ba8 100644 --- a/ext/standard/tests/strings/htmlentities24.phpt +++ b/ext/standard/tests/strings/htmlentities24.phpt @@ -35,12 +35,6 @@ var_dump( htmlentities($str, ENT_QUOTES) ); var_dump( htmlentities($str, ENT_NOQUOTES) ); var_dump( htmlentities($str, ENT_COMPAT) ); -echo "\n*** Testing error conditions ***\n"; -/* zero argument */ -var_dump( htmlentities() ); -/* arguments more than expected */ -var_dump( htmlentities("\x84\x91",ENT_QUOTES, 'cp1252', "test1") ); - echo "Done\n"; ?> --EXPECTF-- @@ -320,10 +314,4 @@ string(36) "A 'quote' is <b>bold</b>" string(46) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" - -*** Testing error conditions *** - -Warning: htmlentities() expects at least 1 parameter, 0 given in %s on line %d -NULL -string(14) "„‘" Done diff --git a/ext/standard/tests/strings/htmlspecialchars.phpt b/ext/standard/tests/strings/htmlspecialchars.phpt index 8506c73e72..6e5c5fac36 100644 --- a/ext/standard/tests/strings/htmlspecialchars.phpt +++ b/ext/standard/tests/strings/htmlspecialchars.phpt @@ -35,13 +35,6 @@ var_dump( htmlspecialchars($str, ENT_QUOTES) ); var_dump( htmlspecialchars($str, ENT_NOQUOTES) ); var_dump( htmlspecialchars($str, ENT_COMPAT) ); -echo "\n*** Testing error conditions ***\n"; -/* zero argument */ -var_dump( htmlspecialchars() ); - -/* giving arguments more than expected */ -var_dump( htmlspecialchars("<br>",ENT_QUOTES,'iso-8859-1', "test2") ); - echo "Done\n" ?> --EXPECTF-- @@ -321,10 +314,4 @@ string(36) "A 'quote' is <b>bold</b>" string(46) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" - -*** Testing error conditions *** - -Warning: htmlspecialchars() expects at least 1 parameter, 0 given in %s on line %d -NULL -string(10) "<br>" Done diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt Binary files differindex 629f4ce60c..3906e997f1 100644 --- a/ext/standard/tests/strings/implode1.phpt +++ b/ext/standard/tests/strings/implode1.phpt diff --git a/ext/standard/tests/strings/join_error.phpt b/ext/standard/tests/strings/join_error.phpt index 36ee9d7ba6..fa15b75da5 100644 --- a/ext/standard/tests/strings/join_error.phpt +++ b/ext/standard/tests/strings/join_error.phpt @@ -10,41 +10,21 @@ Test join() function: error conditions echo "*** Testing join() : error conditions ***\n"; -// Zero argument -echo "\n-- Testing join() function with Zero arguments --\n"; -var_dump( join() ); - -// More than expected number of arguments -echo "\n-- Testing join() function with more than expected no. of arguments --\n"; -$glue = 'string_val'; -$pieces = array(1, 2); -$extra_arg = 10; - -var_dump( join($glue, $pieces, $extra_arg) ); - // Less than expected number of arguments echo "\n-- Testing join() with less than expected no. of arguments --\n"; $glue = 'string_val'; -var_dump( join($glue)); +try { + var_dump(join($glue)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing join() : error conditions *** --- Testing join() function with Zero arguments -- - -Warning: join() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing join() function with more than expected no. of arguments -- - -Warning: join() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Testing join() with less than expected no. of arguments -- - -Warning: join(): Argument must be an array in %s on line %d -NULL +Argument must be an array Done diff --git a/ext/standard/tests/strings/join_variation2.phpt b/ext/standard/tests/strings/join_variation2.phpt index 03b3250b40..16e053cce1 100644 --- a/ext/standard/tests/strings/join_variation2.phpt +++ b/ext/standard/tests/strings/join_variation2.phpt @@ -86,12 +86,16 @@ $values = array ( echo "\n--- Testing join() by supplying different values for 'pieces' argument ---\n"; $counter = 1; for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $pieces = $values [$index]; + echo "-- Iteration $counter --\n"; + $pieces = $values [$index]; - var_dump( join($glue, $pieces) ); + try { + var_dump( join($glue, $pieces) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } - $counter ++; + $counter ++; } // close the resources used @@ -99,100 +103,54 @@ fclose($fp); echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing join() : usage variations *** --- Testing join() by supplying different values for 'pieces' argument --- -- Iteration 1 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 2 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 3 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 4 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 5 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 6 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 7 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 8 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 9 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 10 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 11 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 12 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 13 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 14 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 15 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 16 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 17 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 18 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 19 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 20 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 21 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 22 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed -- Iteration 23 -- - -Warning: join(): Invalid arguments passed in %s on line %d -NULL +Invalid arguments passed Done diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt Binary files differindex 8178fa2eb5..38cb7e566f 100644 --- a/ext/standard/tests/strings/lcfirst.phpt +++ b/ext/standard/tests/strings/lcfirst.phpt diff --git a/ext/standard/tests/strings/levenshtein.phpt b/ext/standard/tests/strings/levenshtein.phpt index 1ac05cf2ae..b4b7c03e7f 100644 --- a/ext/standard/tests/strings/levenshtein.phpt +++ b/ext/standard/tests/strings/levenshtein.phpt @@ -63,10 +63,8 @@ $n += test_me("gt maxlength2", -1, "A", "AbcdefghijklmnopqrstuvwxyzAbcdefghijkl echo ($n==0)?"all passed\n":"$n failed\n"; -var_dump(levenshtein(array(), array())); var_dump(levenshtein("", "", -1, -1, -1)); var_dump(levenshtein("", "", 10, 10, 10)); -var_dump(levenshtein("")); ?> --EXPECTF-- @@ -76,11 +74,5 @@ Warning: levenshtein(): Argument string(s) too long in %s on line %d Warning: levenshtein(): Argument string(s) too long in %s on line %d all passed - -Warning: levenshtein() expects parameter 1 to be string, array given in %s on line %d -NULL int(0) int(0) - -Warning: Wrong parameter count for levenshtein() in %s on line %d -NULL diff --git a/ext/standard/tests/strings/ltrim.phpt b/ext/standard/tests/strings/ltrim.phpt index 638c93557f..51287e04d7 100644 --- a/ext/standard/tests/strings/ltrim.phpt +++ b/ext/standard/tests/strings/ltrim.phpt @@ -9,12 +9,6 @@ Test ltrim() function echo "\n *** Output for Error Conditions ***\n"; - echo "\n *** Output for zero argument ***\n"; - var_dump( ltrim() ); - - echo "\n *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) ***\n"; - var_dump( ltrim("", " ", 1) ); - /* heredoc string */ $str = <<<EOD us @@ -50,16 +44,6 @@ echo "\nDone\n"; --EXPECTF-- *** Output for Error Conditions *** - *** Output for zero argument *** - -Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d -NULL - - *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) *** - -Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d -NULL - *** Using heredoc string *** string(17) "ng heredoc string" diff --git a/ext/standard/tests/strings/ltrim_error.phpt b/ext/standard/tests/strings/ltrim_error.phpt index 694d9fea18..58324d7f3a 100644 --- a/ext/standard/tests/strings/ltrim_error.phpt +++ b/ext/standard/tests/strings/ltrim_error.phpt @@ -11,14 +11,6 @@ Test ltrim() function : error conditions echo "*** Testing ltrim() : error conditions ***\n"; -echo "\n-- Testing ltrim() function with no arguments --\n"; -var_dump( ltrim() ); - -echo "\n-- Testing ltrim() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( ltrim("Hello World", "Heo", $extra_arg) ); - - $hello = " Hello World\n"; echo "\n-- Test ltrim function with various invalid charlists\n"; var_dump(ltrim($hello, "..a")); @@ -31,16 +23,6 @@ var_dump(ltrim($hello, "a..b..c")); --EXPECTF-- *** Testing ltrim() : error conditions *** --- Testing ltrim() function with no arguments -- - -Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing ltrim() function with more than expected no. of arguments -- - -Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Test ltrim function with various invalid charlists Warning: ltrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d diff --git a/ext/standard/tests/strings/md5_file.phpt b/ext/standard/tests/strings/md5_file.phpt Binary files differindex 45009669f4..e56987cd6a 100644 --- a/ext/standard/tests/strings/md5_file.phpt +++ b/ext/standard/tests/strings/md5_file.phpt diff --git a/ext/standard/tests/strings/metaphone.phpt b/ext/standard/tests/strings/metaphone.phpt index ef1d23d89a..c70b4846a1 100644 --- a/ext/standard/tests/strings/metaphone.phpt +++ b/ext/standard/tests/strings/metaphone.phpt @@ -3,7 +3,6 @@ metaphone() tests --FILE-- <?php -var_dump(metaphone()); var_dump(metaphone("")); var_dump(metaphone(-1)); var_dump(metaphone(-1, -1)); @@ -26,8 +25,6 @@ foreach($array as $str) { echo "Done\n"; ?> --EXPECTF-- -Warning: metaphone() expects at least 1 parameter, 0 given in %s on line %d -NULL string(0) "" string(0) "" bool(false) diff --git a/ext/standard/tests/strings/money_format_error.phpt b/ext/standard/tests/strings/money_format_error.phpt index da725a4131..d593c0ec7f 100644 --- a/ext/standard/tests/strings/money_format_error.phpt +++ b/ext/standard/tests/strings/money_format_error.phpt @@ -23,15 +23,6 @@ $extra_arg = 10; echo "*** Testing money_format() : error conditions ***\n"; -echo "\n-- Testing money_format() function with no arguments --\n"; -var_dump( money_format() ); - -echo "\n-- Testing money_format() function with insufficient arguments --\n"; -var_dump( money_format($string) ); - -echo "\n-- Testing money_format() function with more than expected no. of arguments --\n"; -var_dump( money_format($string, $value, $extra_arg) ); - echo "\n-- Testing money_format() function with more than one token --\n"; var_dump( money_format($string . $string, $value) ); ?> @@ -39,27 +30,6 @@ var_dump( money_format($string . $string, $value) ); --EXPECTF-- *** Testing money_format() : error conditions *** --- Testing money_format() function with no arguments -- - -Deprecated: Function money_format() is deprecated in %s on line %d - -Warning: money_format() expects exactly 2 parameters, 0 given in %s on line %d -NULL - --- Testing money_format() function with insufficient arguments -- - -Deprecated: Function money_format() is deprecated in %s on line %d - -Warning: money_format() expects exactly 2 parameters, 1 given in %s on line %d -NULL - --- Testing money_format() function with more than expected no. of arguments -- - -Deprecated: Function money_format() is deprecated in %s on line %d - -Warning: money_format() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -- Testing money_format() function with more than one token -- Deprecated: Function money_format() is deprecated in %s on line %d diff --git a/ext/standard/tests/strings/parse_str_basic1.phpt b/ext/standard/tests/strings/parse_str_basic1.phpt index b3f2fe5cfc..e442c0fd70 100644 --- a/ext/standard/tests/strings/parse_str_basic1.phpt +++ b/ext/standard/tests/strings/parse_str_basic1.phpt @@ -3,18 +3,13 @@ Test parse_str() function : basic functionality --FILE-- <?php -/* Prototype : void parse_str ( string $str [, array &$arr ] ) +/* Prototype : void parse_str ( string $str , array &$arr ) * Description: Parses the string into variables * Source code: ext/standard/string.c */ echo "*** Testing parse_str() : basic functionality ***\n"; -echo "Basic test WITHOUT result arg\n"; -$s1 = "first=val1&second=val2&third=val3"; -var_dump(parse_str($s1)); -var_dump($first, $second, $third); - echo "\nBasic test WITH undefined var for result arg\n"; $s1 = "first=val1&second=val2&third=val3"; var_dump(parse_str($s1, $res1)); @@ -35,13 +30,6 @@ var_dump($res3_array); ===DONE=== --EXPECTF-- *** Testing parse_str() : basic functionality *** -Basic test WITHOUT result arg - -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d -NULL -string(4) "val1" -string(4) "val2" -string(4) "val3" Basic test WITH undefined var for result arg NULL diff --git a/ext/standard/tests/strings/parse_str_basic3.phpt b/ext/standard/tests/strings/parse_str_basic3.phpt Binary files differindex 0368dea5f9..06f9579188 100644 --- a/ext/standard/tests/strings/parse_str_basic3.phpt +++ b/ext/standard/tests/strings/parse_str_basic3.phpt diff --git a/ext/standard/tests/strings/pathinfo.phpt b/ext/standard/tests/strings/pathinfo.phpt index a3d735069d..2bbea73588 100644 --- a/ext/standard/tests/strings/pathinfo.phpt +++ b/ext/standard/tests/strings/pathinfo.phpt @@ -3,7 +3,6 @@ pathinfo() tests --FILE-- <?php -var_dump(pathinfo()); var_dump(pathinfo("")); var_dump(pathinfo(".")); var_dump(pathinfo("..")); @@ -27,8 +26,6 @@ var_dump(pathinfo(__FILE__, PATHINFO_DIRNAME|PATHINFO_BASENAME)); echo "Done\n"; ?> --EXPECTF-- -Warning: pathinfo() expects at least 1 parameter, 0 given in %s on line %d -NULL array(2) { ["basename"]=> string(0) "" diff --git a/ext/standard/tests/strings/php_strip_whitespace.phpt b/ext/standard/tests/strings/php_strip_whitespace.phpt index 442672c6aa..5fb314c168 100644 --- a/ext/standard/tests/strings/php_strip_whitespace.phpt +++ b/ext/standard/tests/strings/php_strip_whitespace.phpt @@ -5,7 +5,6 @@ php_strip_whitespace() tests $filename = __DIR__."/php_strip_whitespace.dat"; -var_dump(php_strip_whitespace()); var_dump(php_strip_whitespace($filename)); $data = '/* test comment */'; @@ -40,9 +39,6 @@ var_dump(php_strip_whitespace($filename)); echo "Done\n"; ?> --EXPECTF-- -Warning: php_strip_whitespace() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - Warning: php_strip_whitespace(%sphp_strip_whitespace.dat): failed to open stream: No such file or directory in %s on line %d string(0) "" string(18) "/* test comment */" diff --git a/ext/standard/tests/strings/printf.phpt b/ext/standard/tests/strings/printf.phpt index eab44a4a65..89b1b9ace2 100644 --- a/ext/standard/tests/strings/printf.phpt +++ b/ext/standard/tests/strings/printf.phpt @@ -28,7 +28,11 @@ $strings = array( NULL, "abc", 'aaa' ); /* Zero argument */ echo "\n*** Output for zero argument ***\n"; -printf(); +try { + printf(); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* Number of arguments not matching as specified in format field */ echo "\n*** Output for insufficient number of arguments ***\n"; @@ -226,8 +230,7 @@ printf("%d", $tempstring); ?> --EXPECTF-- *** Output for zero argument *** - -Warning: printf() expects at least %d parameter, %d given in %s on line %d +printf() expects at least %d parameter, %d given *** Output for insufficient number of arguments *** diff --git a/ext/standard/tests/strings/printf_64bit.phpt b/ext/standard/tests/strings/printf_64bit.phpt index 1a90970371..0106f71445 100644 --- a/ext/standard/tests/strings/printf_64bit.phpt +++ b/ext/standard/tests/strings/printf_64bit.phpt @@ -28,7 +28,11 @@ $strings = array( NULL, "abc", 'aaa' ); /* Zero argument */ echo "\n*** Output for zero argument ***\n"; -printf(); +try { + printf(); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* Number of arguments not matching as specified in format field */ echo "\n*** Output for insufficient number of arguments ***\n"; @@ -226,8 +230,7 @@ printf("%d", $tempstring); ?> --EXPECTF-- *** Output for zero argument *** - -Warning: printf() expects at least 1 parameter, 0 given in %s on line %d +printf() expects at least 1 parameter, 0 given *** Output for insufficient number of arguments *** diff --git a/ext/standard/tests/strings/printf_error.phpt b/ext/standard/tests/strings/printf_error.phpt index a88390bc04..aff95426e6 100644 --- a/ext/standard/tests/strings/printf_error.phpt +++ b/ext/standard/tests/strings/printf_error.phpt @@ -11,7 +11,11 @@ echo "*** Testing printf() : error conditions ***\n"; // Zero arguments echo "\n-- Testing printf() function with Zero arguments --\n"; -var_dump( printf() ); +try { + var_dump( printf() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing printf() function with less than expected no. of arguments --\n"; $format1 = '%s'; @@ -38,9 +42,7 @@ var_dump( printf($format3) ); *** Testing printf() : error conditions *** -- Testing printf() function with Zero arguments -- - -Warning: printf() expects at least 1 parameter, 0 given in %s on line %d -bool(false) +printf() expects at least 1 parameter, 0 given -- Testing printf() function with less than expected no. of arguments -- diff --git a/ext/standard/tests/strings/quoted_printable_encode_001.phpt b/ext/standard/tests/strings/quoted_printable_encode_001.phpt index 1ce7d791dc..df26d5cf4b 100644 --- a/ext/standard/tests/strings/quoted_printable_encode_001.phpt +++ b/ext/standard/tests/strings/quoted_printable_encode_001.phpt @@ -3,30 +3,18 @@ quoted_printable_encode() tests - 1 --FILE-- <?php -var_dump(quoted_printable_encode()); var_dump(quoted_printable_encode("")); var_dump(quoted_printable_encode("test")); -var_dump(quoted_printable_encode("test", "more")); -$a = array("str"); -var_dump(quoted_printable_encode($a)); var_dump(quoted_printable_encode(1)); var_dump(quoted_printable_encode(NULL)); var_dump(quoted_printable_encode(false)); echo "Done\n"; ?> ---EXPECTF-- -Warning: quoted_printable_encode() expects exactly 1 parameter, 0 given in %s on line %d -NULL +--EXPECT-- string(0) "" string(4) "test" - -Warning: quoted_printable_encode() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: quoted_printable_encode() expects parameter 1 to be string, array given in %s on line %d -NULL string(1) "1" string(0) "" string(0) "" diff --git a/ext/standard/tests/strings/quotemeta_basic_1.phpt b/ext/standard/tests/strings/quotemeta_basic_1.phpt index 4b479a9a60..4d1feb5ae1 100644 --- a/ext/standard/tests/strings/quotemeta_basic_1.phpt +++ b/ext/standard/tests/strings/quotemeta_basic_1.phpt @@ -1,5 +1,5 @@ --TEST-- -Test function quotemeta() - using an empty string is given as str. +Test function quotemeta() - using an empty string is given as str --CREDITS-- Rodrigo Prado de Jesus <royopa [at] gmail [dot] com> User Group: PHPSP #PHPTestFestBrasil @@ -9,4 +9,4 @@ $str = ""; var_dump(quotemeta($str)); ?> --EXPECT-- -bool(false) +string(0) "" diff --git a/ext/standard/tests/strings/rtrim.phpt b/ext/standard/tests/strings/rtrim.phpt Binary files differindex 5f57b0e850..223a839f58 100644 --- a/ext/standard/tests/strings/rtrim.phpt +++ b/ext/standard/tests/strings/rtrim.phpt diff --git a/ext/standard/tests/strings/rtrim_error.phpt b/ext/standard/tests/strings/rtrim_error.phpt index 108f96a1f0..210fb58c4e 100644 --- a/ext/standard/tests/strings/rtrim_error.phpt +++ b/ext/standard/tests/strings/rtrim_error.phpt @@ -11,14 +11,6 @@ Test rtrim() function : error conditions echo "*** Testing rtrim() : error conditions ***\n"; -echo "\n-- Testing rtrim() function with no arguments --\n"; -var_dump( rtrim() ); - -echo "\n-- Testing rtrim() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( rtrim("Hello World", "Heo", $extra_arg) ); - - $hello = " Hello World\n"; echo "\n-- Test rtrim function with various invalid charlists\n"; var_dump(rtrim($hello, "..a")); @@ -31,16 +23,6 @@ var_dump(rtrim($hello, "a..b..c")); --EXPECTF-- *** Testing rtrim() : error conditions *** --- Testing rtrim() function with no arguments -- - -Warning: rtrim() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing rtrim() function with more than expected no. of arguments -- - -Warning: rtrim() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Test rtrim function with various invalid charlists Warning: rtrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d diff --git a/ext/standard/tests/strings/setlocale_error.phpt b/ext/standard/tests/strings/setlocale_error.phpt index 14bb7d7ed5..c2b18b1992 100644 --- a/ext/standard/tests/strings/setlocale_error.phpt +++ b/ext/standard/tests/strings/setlocale_error.phpt @@ -18,14 +18,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { echo "*** Testing setlocale() : error conditions ***\n"; -// Zero argument -echo "\n-- Testing setlocale() function with Zero arguments --"; -var_dump( setlocale()); - -// One argument -echo "\n-- Testing setlocale() function with One argument, 'category' = LC_ALL --"; -var_dump( setlocale(LC_ALL) ); - echo "\n-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --\n"; //Invalid array of locales $invalid_locales = array("en_US.invalid", "en_AU.invalid", "ko_KR.invalid"); @@ -44,14 +36,6 @@ echo "\nDone"; --EXPECTF-- *** Testing setlocale() : error conditions *** --- Testing setlocale() function with Zero arguments -- -Warning: setlocale() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing setlocale() function with One argument, 'category' = LC_ALL -- -Warning: setlocale() expects at least 2 parameters, 1 given in %s on line %d -NULL - -- Testing setlocale() function with invalid locale array, 'category' = LC_ALL -- bool(false) diff --git a/ext/standard/tests/strings/sha1_file.phpt b/ext/standard/tests/strings/sha1_file.phpt index 102dab75ff..09e81be014 100644 --- a/ext/standard/tests/strings/sha1_file.phpt +++ b/ext/standard/tests/strings/sha1_file.phpt @@ -46,12 +46,6 @@ var_dump( sha1_file(12) ); echo "\n-- NULL as filename --\n"; var_dump( sha1_file(NULL) ); -echo "\n-- Zero arguments --\n"; - var_dump ( sha1_file() ); - -echo "\n-- More than valid number of arguments ( valid is 2) --\n"; -var_dump ( sha1_file("EmptyFileSHA1.txt", true, NULL) ); - echo "\n-- Hexadecimal Output for Empty file as Argument --\n"; var_dump( sha1_file("EmptyFileSHA1.txt") ); @@ -95,16 +89,6 @@ bool(false) Warning: sha1_file(): Filename cannot be empty in %s on line %d bool(false) --- Zero arguments -- - -Warning: sha1_file() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- More than valid number of arguments ( valid is 2) -- - -Warning: sha1_file() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Hexadecimal Output for Empty file as Argument -- string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" diff --git a/ext/standard/tests/strings/soundex.phpt b/ext/standard/tests/strings/soundex.phpt index 650236c2e5..744f71c17a 100644 --- a/ext/standard/tests/strings/soundex.phpt +++ b/ext/standard/tests/strings/soundex.phpt @@ -5,7 +5,6 @@ soundex() tests var_dump(soundex("")); var_dump(soundex(-1)); -var_dump(soundex(array())); $array = array( "From", @@ -34,9 +33,6 @@ echo "Done\n"; --EXPECTF-- bool(false) string(4) "0000" - -Warning: soundex() expects parameter 1 to be string, array given in %s on line %d -NULL string(4) "F650" string(4) "T300" string(4) "T500" diff --git a/ext/standard/tests/strings/sprintf_error.phpt b/ext/standard/tests/strings/sprintf_error.phpt index 1c12cd3168..1b21b8b141 100644 --- a/ext/standard/tests/strings/sprintf_error.phpt +++ b/ext/standard/tests/strings/sprintf_error.phpt @@ -11,7 +11,11 @@ echo "*** Testing sprintf() : error conditions ***\n"; // Zero arguments echo "\n-- Testing sprintf() function with Zero arguments --\n"; -var_dump( sprintf() ); +try { + var_dump( sprintf() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing sprintf() function with less than expected no. of arguments --\n"; $format1 = '%s'; @@ -38,9 +42,7 @@ echo "Done"; *** Testing sprintf() : error conditions *** -- Testing sprintf() function with Zero arguments -- - -Warning: sprintf() expects at least %d parameter, %d given in %s on line %d -bool(false) +sprintf() expects at least %d parameter, %d given -- Testing sprintf() function with less than expected no. of arguments -- diff --git a/ext/standard/tests/strings/sscanf_error.phpt b/ext/standard/tests/strings/sscanf_error.phpt index ca967758ab..3e54a42f1e 100644 --- a/ext/standard/tests/strings/sscanf_error.phpt +++ b/ext/standard/tests/strings/sscanf_error.phpt @@ -12,12 +12,6 @@ echo "*** Testing sscanf() : error conditions ***\n"; $str = "Hello World"; $format = "%s %s"; -echo "\n-- Testing sscanf() function with no arguments --\n"; -var_dump( sscanf() ); - -echo "\n-- Testing sscanf() function with one argument --\n"; -var_dump( sscanf($str) ); - echo "\n-- Testing sscanf() function with more than expected no. of arguments --\n"; var_dump( sscanf($str, $format, $str1, $str2, $extra_str) ); @@ -27,16 +21,6 @@ var_dump( sscanf($str, $format, $str1, $str2, $extra_str) ); --EXPECTF-- *** Testing sscanf() : error conditions *** --- Testing sscanf() function with no arguments -- - -Warning: sscanf() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing sscanf() function with one argument -- - -Warning: sscanf() expects at least 2 parameters, 1 given in %s on line %d -NULL - -- Testing sscanf() function with more than expected no. of arguments -- Warning: sscanf(): Variable is not assigned by any conversion specifiers in %s on line %d diff --git a/ext/standard/tests/strings/str_ireplace.phpt b/ext/standard/tests/strings/str_ireplace.phpt index 526b8ac723..71a9d1e127 100644 --- a/ext/standard/tests/strings/str_ireplace.phpt +++ b/ext/standard/tests/strings/str_ireplace.phpt @@ -3,9 +3,6 @@ str_ireplace() tests --FILE-- <?php -var_dump(str_ireplace()); -var_dump(str_ireplace("")); -var_dump(str_ireplace("", "")); var_dump(str_ireplace("", "", "")); var_dump(str_ireplace("tt", "a", "ttttTttttttttTT")); @@ -48,14 +45,6 @@ var_dump($Data = str_ireplace("\n", "<br>", $Data)); echo "Done\n"; ?> --EXPECTF-- -Warning: str_ireplace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: str_ireplace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: str_ireplace() expects at least 3 parameters, 2 given in %s on line %d -NULL string(0) "" string(8) "aaaaaaaT" string(8) "aaaaaaaT" diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt Binary files differindex b44a9517ab..a4f60bfa6a 100644 --- a/ext/standard/tests/strings/str_pad.phpt +++ b/ext/standard/tests/strings/str_pad.phpt diff --git a/ext/standard/tests/strings/str_pad_variation1.phpt b/ext/standard/tests/strings/str_pad_variation1.phpt new file mode 100644 index 0000000000..6123bc60c9 --- /dev/null +++ b/ext/standard/tests/strings/str_pad_variation1.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test str_pad() function : usage variations - large values for '$pad_length' argument +--SKIPIF-- +<?php +if (getenv("USE_ZEND_ALLOC") === "0") { + die("skip Zend MM disabled"); +} +?> +--FILE-- +<?php +/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] ) + * Description: Pad a string to a certain length with another string + * Source code: ext/standard/string.c +*/ + +/* Test str_pad() function: with unexpected inputs for '$pad_length' + * and expected type for '$input' +*/ + +echo "*** Testing str_pad() function: with large value for for 'pad_length' argument ***\n"; + +//defining '$input' argument +$input = "Test string"; + +$extra_large_pad_length = PHP_INT_MAX*5; +try { + var_dump( str_pad($input, $extra_large_pad_length) ); +} catch (\TypeError $e) { + echo $e->getMessage() . "\n"; +} + +$php_int_max_pad_length = PHP_INT_MAX; +var_dump( str_pad($input, $php_int_max_pad_length) ); + + +?> +--EXPECTF-- +*** Testing str_pad() function: with large value for for 'pad_length' argument *** +str_pad() expects parameter 2 to be int, float given + +Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d + diff --git a/ext/standard/tests/strings/str_pad_variation2.phpt b/ext/standard/tests/strings/str_pad_variation2.phpt new file mode 100644 index 0000000000..1ebf1b2825 --- /dev/null +++ b/ext/standard/tests/strings/str_pad_variation2.phpt @@ -0,0 +1,70 @@ +--TEST-- +str_pad() function: usage variations - Non printable chars +--INI-- +precision=14 +--FILE-- +<?php +// Split from str_pad for NUL Bytes +// 7-bit ASCII +$string = chr(0).chr(255).chr(128).chr(234).chr(143); + +/* different pad_lengths */ +$pad_lengths = [ + -PHP_INT_MAX, // huge negative value + -1, // negative value + 0, // pad_length < sizeof(input_string) + 9, // pad_length <= sizeof(input_string) + 10, // pad_length > sizeof(input_string) + 16, // pad_length > sizeof(input_string) +]; + +$pad_string = "="; + +/*loop through to use each variant of $pad_length on + each element of $input_strings array */ +foreach ($pad_lengths as $pad_length ) { + // default pad_string & pad_type + var_dump( bin2hex( str_pad($string, $pad_length) ) ); + // default pad_type + var_dump( bin2hex( str_pad($string, $pad_length, $pad_string) ) ); + var_dump( bin2hex( str_pad($string, $pad_length, $pad_string, STR_PAD_LEFT) ) ); + var_dump( bin2hex( str_pad($string, $pad_length, $pad_string, STR_PAD_RIGHT) ) ); + var_dump( bin2hex( str_pad($string, $pad_length, $pad_string, STR_PAD_BOTH) ) ); +} + +?> + +DONE +--EXPECT-- +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(10) "00ff80ea8f" +string(18) "00ff80ea8f20202020" +string(18) "00ff80ea8f3d3d3d3d" +string(18) "3d3d3d3d00ff80ea8f" +string(18) "00ff80ea8f3d3d3d3d" +string(18) "3d3d00ff80ea8f3d3d" +string(20) "00ff80ea8f2020202020" +string(20) "00ff80ea8f3d3d3d3d3d" +string(20) "3d3d3d3d3d00ff80ea8f" +string(20) "00ff80ea8f3d3d3d3d3d" +string(20) "3d3d00ff80ea8f3d3d3d" +string(32) "00ff80ea8f2020202020202020202020" +string(32) "00ff80ea8f3d3d3d3d3d3d3d3d3d3d3d" +string(32) "3d3d3d3d3d3d3d3d3d3d3d00ff80ea8f" +string(32) "00ff80ea8f3d3d3d3d3d3d3d3d3d3d3d" +string(32) "3d3d3d3d3d00ff80ea8f3d3d3d3d3d3d" + +DONE diff --git a/ext/standard/tests/strings/str_pad_variation5.phpt b/ext/standard/tests/strings/str_pad_variation5.phpt index 8eade37df3..41a70e675a 100644 --- a/ext/standard/tests/strings/str_pad_variation5.phpt +++ b/ext/standard/tests/strings/str_pad_variation5.phpt @@ -31,4 +31,4 @@ var_dump( str_pad($input, $pad_length) ); --EXPECTF-- *** Testing str_pad() function: with large value for for 'pad_length' argument *** -Fatal error: Allowed memory size of 134217728 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d diff --git a/ext/standard/tests/strings/str_repeat.phpt b/ext/standard/tests/strings/str_repeat.phpt Binary files differindex 306b7d381a..6e5f0cf68e 100644 --- a/ext/standard/tests/strings/str_repeat.phpt +++ b/ext/standard/tests/strings/str_repeat.phpt diff --git a/ext/standard/tests/strings/str_repeat_variation1.phpt b/ext/standard/tests/strings/str_repeat_variation1.phpt new file mode 100644 index 0000000000..4740f7c5b8 --- /dev/null +++ b/ext/standard/tests/strings/str_repeat_variation1.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test str_repeat() function: usage variations - complex strings containing other than 7-bit chars +--INI-- +precision=14 +--FILE-- +<?php +$str = chr(0).chr(128).chr(129).chr(234).chr(235).chr(254).chr(255); + +$withCodePoint = str_repeat($str, chr(51)); // ASCII value of '3' given +$explicit = str_repeat($str, 3); + +var_dump($withCodePoint === $explicit); +var_dump( bin2hex( $withCodePoint ) ); +var_dump( bin2hex( $explicit ) ); + +?> +DONE +--EXPECT-- +bool(true) +string(42) "008081eaebfeff008081eaebfeff008081eaebfeff" +string(42) "008081eaebfeff008081eaebfeff008081eaebfeff" +DONE diff --git a/ext/standard/tests/strings/str_replace.phpt b/ext/standard/tests/strings/str_replace.phpt index 7b411abac5..bef11f872a 100644 --- a/ext/standard/tests/strings/str_replace.phpt +++ b/ext/standard/tests/strings/str_replace.phpt @@ -223,15 +223,6 @@ var_dump( str_replace("worldS", "FOUND", "$strS") ); var_dump( str_replace("worldS", "FOUND", "${str}S") ); var_dump( str_replace("worldS", "FOUND", "{$str}S") ); - -echo "\n*** Testing error conditions ***"; -/* Invalid arguments */ -var_dump( str_replace() ); -var_dump( str_replace("") ); -var_dump( str_replace(NULL) ); -var_dump( str_replace(1, 2) ); -var_dump( str_replace(1,2,3,$var,5) ); - fclose($resource1); closedir($resource2); echo "Done\n"; @@ -938,20 +929,4 @@ Notice: Undefined variable: strS in %s on line %d string(0) "" string(5) "FOUND" string(5) "FOUND" - -*** Testing error conditions *** -Warning: str_replace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: str_replace() expects at least 3 parameters, 2 given in %s on line %d -NULL - -Warning: str_replace() expects at most 4 parameters, 5 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/strings/str_split_variation6.phpt b/ext/standard/tests/strings/str_split_variation6.phpt index a477800a26..111eb11858 100644 --- a/ext/standard/tests/strings/str_split_variation6.phpt +++ b/ext/standard/tests/strings/str_split_variation6.phpt @@ -18,7 +18,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); * passing different integer values for 'split_length' argument to str_split() */ -echo "*** Testing str_split() : different intger values for 'split_length' ***\n"; +echo "*** Testing str_split() : different integer values for 'split_length' ***\n"; //Initialise variables $str = 'This is a string with 123 & escape char \t'; @@ -30,23 +30,25 @@ $values = array ( 0234, //octal number 0x1A, //hexadecimal number 2147483647, //max positive integer number - 2147483648, //max positive integer+1 -2147483648, //min negative integer ); //loop through each element of $values for 'split_length' for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( str_split($str, $values[$count]) ); + echo "-- Iteration ".($count + 1)." --\n"; + + try { + var_dump( str_split($str, $values[$count]) ); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } } echo "Done" ?> ---EXPECTF-- -*** Testing str_split() : different intger values for 'split_length' *** +--EXPECT-- +*** Testing str_split() : different integer values for 'split_length' *** -- Iteration 1 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) +The length of each segment must be greater than zero -- Iteration 2 -- array(42) { [0]=> @@ -135,9 +137,7 @@ array(42) { string(1) "t" } -- Iteration 3 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) +The length of each segment must be greater than zero -- Iteration 4 -- array(1) { [0]=> @@ -156,11 +156,5 @@ array(1) { string(42) "This is a string with 123 & escape char \t" } -- Iteration 7 -- - -Warning: str_split() expects parameter 2 to be int, float given in %s line %d -NULL --- Iteration 8 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) +The length of each segment must be greater than zero Done diff --git a/ext/standard/tests/strings/str_split_variation6_64bit.phpt b/ext/standard/tests/strings/str_split_variation6_64bit.phpt index 583c7db3cf..e6893e9263 100644 --- a/ext/standard/tests/strings/str_split_variation6_64bit.phpt +++ b/ext/standard/tests/strings/str_split_variation6_64bit.phpt @@ -36,17 +36,19 @@ $values = array ( //loop through each element of $values for 'split_length' for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( str_split($str, $values[$count]) ); + echo "-- Iteration ".($count + 1)." --\n"; + try { + var_dump( str_split($str, $values[$count]) ); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } } echo "Done" ?> ---EXPECTF-- +--EXPECT-- *** Testing str_split() : different intger values for 'split_length' *** -- Iteration 1 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) +The length of each segment must be greater than zero -- Iteration 2 -- array(42) { [0]=> @@ -135,9 +137,7 @@ array(42) { string(1) "t" } -- Iteration 3 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) +The length of each segment must be greater than zero -- Iteration 4 -- array(1) { [0]=> @@ -161,7 +161,5 @@ array(1) { string(42) "This is a string with 123 & escape char \t" } -- Iteration 8 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) +The length of each segment must be greater than zero Done diff --git a/ext/standard/tests/strings/str_split_variation7.phpt b/ext/standard/tests/strings/str_split_variation7.phpt index 5082c7ba2f..a810dd7ecb 100644 --- a/ext/standard/tests/strings/str_split_variation7.phpt +++ b/ext/standard/tests/strings/str_split_variation7.phpt @@ -18,7 +18,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); * passing different integer values for 'split_length' and heredoc string as 'str' argument to str_split() */ -echo "*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***\n"; +echo "*** Testing str_split() : different integer values for 'split_length' with heredoc 'str' ***\n"; //Initialise variables $str = <<<EOT string with 123,escape char \t. @@ -32,23 +32,25 @@ $values = array ( 0234, //octal number 0x1A, //hexadecimal number 2147483647, //max positive integer number - 2147483648, //max positive integer+1 -2147483648, //min negative integer ); //loop through each element of $values for 'split_length' for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( str_split($str, $values[$count]) ); + echo "-- Iteration ".($count + 1)." --\n"; + + try { + var_dump( str_split($str, $values[$count]) ); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } } echo "Done" ?> ---EXPECTF-- -*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' *** +--EXPECT-- +*** Testing str_split() : different integer values for 'split_length' with heredoc 'str' *** -- Iteration 1 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) +The length of each segment must be greater than zero -- Iteration 2 -- array(30) { [0]=> @@ -113,9 +115,7 @@ array(30) { string(1) "." } -- Iteration 3 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) +The length of each segment must be greater than zero -- Iteration 4 -- array(1) { [0]=> @@ -134,11 +134,5 @@ array(1) { string(30) "string with 123,escape char ." } -- Iteration 7 -- - -Warning: str_split() expects parameter 2 to be int, float given in %s on line %d -NULL --- Iteration 8 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) +The length of each segment must be greater than zero Done diff --git a/ext/standard/tests/strings/str_split_variation7_64bit.phpt b/ext/standard/tests/strings/str_split_variation7_64bit.phpt index bff61adb30..1a1980028a 100644 --- a/ext/standard/tests/strings/str_split_variation7_64bit.phpt +++ b/ext/standard/tests/strings/str_split_variation7_64bit.phpt @@ -18,7 +18,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); * passing different integer values for 'split_length' and heredoc string as 'str' argument to str_split() */ -echo "*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***\n"; +echo "*** Testing str_split() : different integer values for 'split_length' with heredoc 'str' ***\n"; //Initialise variables $str = <<<EOT string with 123,escape char \t. @@ -38,17 +38,19 @@ $values = array ( //loop through each element of $values for 'split_length' for($count = 0; $count < count($values); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( str_split($str, $values[$count]) ); + echo "-- Iteration ".($count + 1)." --\n"; + try { + var_dump( str_split($str, $values[$count]) ); + } catch (\Error $e) { + echo $e->getMessage() . "\n"; + } } echo "Done" ?> ---EXPECTF-- -*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' *** +--EXPECT-- +*** Testing str_split() : different integer values for 'split_length' with heredoc 'str' *** -- Iteration 1 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) +The length of each segment must be greater than zero -- Iteration 2 -- array(30) { [0]=> @@ -113,9 +115,7 @@ array(30) { string(1) "." } -- Iteration 3 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) +The length of each segment must be greater than zero -- Iteration 4 -- array(1) { [0]=> @@ -139,7 +139,5 @@ array(1) { string(30) "string with 123,escape char ." } -- Iteration 8 -- - -Warning: str_split(): The length of each segment must be greater than zero in %s on line %d -bool(false) +The length of each segment must be greater than zero Done diff --git a/ext/standard/tests/strings/str_word_count.phpt b/ext/standard/tests/strings/str_word_count.phpt index f88646370b..375f26dee0 100644 --- a/ext/standard/tests/strings/str_word_count.phpt +++ b/ext/standard/tests/strings/str_word_count.phpt @@ -2,39 +2,51 @@ str_word_count() --FILE-- <?php -error_reporting(E_ALL); $str = "Hello friend, you're looking good today!"; $b =& $str; var_dump(str_word_count($str, 1)); var_dump(str_word_count($str, 2)); var_dump(str_word_count($str)); -var_dump(str_word_count($str, 3)); -var_dump(str_word_count($str, 123)); -var_dump(str_word_count($str, -1)); -var_dump(str_word_count($str, 999999999)); -var_dump(str_word_count($str, array())); -var_dump(str_word_count($str, $b)); + +try { + var_dump(str_word_count($str, 3)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(str_word_count($str, 123)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(str_word_count($str, -1)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(str_word_count($str, 999999999)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + var_dump($str); $str2 = "F0o B4r 1s bar foo"; var_dump(str_word_count($str2, NULL, "04")); var_dump(str_word_count($str2, NULL, "01")); var_dump(str_word_count($str2, NULL, "014")); -var_dump(str_word_count($str2, NULL, array())); -var_dump(str_word_count($str2, NULL, new stdClass)); var_dump(str_word_count($str2, NULL, "")); var_dump(str_word_count($str2, 1, "04")); var_dump(str_word_count($str2, 1, "01")); var_dump(str_word_count($str2, 1, "014")); -var_dump(str_word_count($str2, 1, array())); -var_dump(str_word_count($str2, 1, new stdClass)); var_dump(str_word_count($str2, 1, "")); var_dump(str_word_count($str2, 2, "04")); var_dump(str_word_count($str2, 2, "01")); var_dump(str_word_count($str2, 2, "014")); -var_dump(str_word_count($str2, 2, array())); -var_dump(str_word_count($str2, 2, new stdClass)); var_dump(str_word_count($str2, 2, "")); var_dump(str_word_count("foo'0 bar-0var", 2, "0")); var_dump(str_word_count("'foo'", 2)); @@ -42,9 +54,10 @@ var_dump(str_word_count("'foo'", 2, "'")); var_dump(str_word_count("-foo-", 2)); var_dump(str_word_count("-foo-", 2, "-")); -echo "Done\n"; ?> ---EXPECTF-- + +DONE +--EXPECT-- array(6) { [0]=> string(5) "Hello" @@ -74,35 +87,15 @@ array(6) { string(5) "today" } int(6) - -Warning: str_word_count(): Invalid format value 3 in %s on line %d -bool(false) - -Warning: str_word_count(): Invalid format value 123 in %s on line %d -bool(false) - -Warning: str_word_count(): Invalid format value -1 in %s on line %d -bool(false) - -Warning: str_word_count(): Invalid format value 999999999 in %s on line %d -bool(false) - -Warning: str_word_count() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 2 to be int, string given in %s on line %d -NULL +Invalid format value 3 +Invalid format value 123 +Invalid format value -1 +Invalid format value 999999999 string(55) "Hello friend, you're looking good today!" int(5) int(6) int(5) - -Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d -NULL int(7) array(5) { [0]=> @@ -142,12 +135,6 @@ array(5) { [4]=> string(3) "foo" } - -Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d -NULL array(7) { [0]=> string(1) "F" @@ -202,12 +189,6 @@ array(5) { [15]=> string(3) "foo" } - -Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d -NULL array(7) { [0]=> string(1) "F" @@ -246,4 +227,5 @@ array(1) { [0]=> string(5) "-foo-" } -Done + +DONE diff --git a/ext/standard/tests/strings/str_word_count1.phpt b/ext/standard/tests/strings/str_word_count1.phpt index e942a17385..18652699e2 100644 --- a/ext/standard/tests/strings/str_word_count1.phpt +++ b/ext/standard/tests/strings/str_word_count1.phpt @@ -4,23 +4,31 @@ str_word_count() and invalid arguments <?php var_dump(str_word_count("")); -var_dump(str_word_count("", -1)); -var_dump(str_word_count("", -1, $a)); -var_dump($a); -echo "Done\n"; +try { + var_dump(str_word_count("", -1)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + +try { + var_dump(str_word_count("", -1, $a)); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} + +var_dump($a); ?> + +DONE --EXPECTF-- int(0) - -Warning: str_word_count(): Invalid format value -1 in %s on line %d -bool(false) +Invalid format value -1 Notice: Undefined variable: a in %s on line %d - -Warning: str_word_count(): Invalid format value -1 in %s on line %d -bool(false) +Invalid format value -1 Notice: Undefined variable: a in %s on line %d NULL -Done + +DONE diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt Binary files differindex 3086c2be92..d9063cc9de 100644 --- a/ext/standard/tests/strings/strcasecmp.phpt +++ b/ext/standard/tests/strings/strcasecmp.phpt diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt Binary files differindex 397e072c52..fd20e50195 100644 --- a/ext/standard/tests/strings/strcmp.phpt +++ b/ext/standard/tests/strings/strcmp.phpt diff --git a/ext/standard/tests/strings/stripos.phpt b/ext/standard/tests/strings/stripos.phpt index 057b8ca494..bc2a7bc8e5 100644 --- a/ext/standard/tests/strings/stripos.phpt +++ b/ext/standard/tests/strings/stripos.phpt @@ -25,10 +25,10 @@ stripos() function test var_dump(stripos("0", false)); var_dump(stripos("1", true)); var_dump(stripos("\\\\a", "\\a")); - - echo "Done\n"; ?> ---EXPECTF-- + +DONE +--EXPECT-- int(0) int(5) int(5) @@ -37,31 +37,20 @@ int(10) int(2) int(0) int(0) -bool(false) -bool(false) -bool(false) -bool(false) +int(0) int(0) bool(false) bool(false) +int(0) bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) +int(0) +int(0) +int(0) int(1) -Done + +DONE diff --git a/ext/standard/tests/strings/stripos_error.phpt b/ext/standard/tests/strings/stripos_error.phpt index 324014cf6d..0420bb090b 100644 --- a/ext/standard/tests/strings/stripos_error.phpt +++ b/ext/standard/tests/strings/stripos_error.phpt @@ -8,14 +8,6 @@ Test stripos() function : error conditions */ echo "*** Testing stripos() function: error conditions ***\n"; -echo "\n-- With Zero arguments --"; -var_dump( stripos() ); - -echo "\n-- With less than expected number of arguments --"; -var_dump( stripos("String") ); - -echo "\n-- With more than expected number of arguments --"; -var_dump( stripos("string", "String", 1, 'extra_arg') ); echo "\n-- Offset beyond the end of the string --"; var_dump( stripos("Hello World", "o", 12) ); @@ -28,18 +20,6 @@ echo "*** Done ***"; --EXPECTF-- *** Testing stripos() function: error conditions *** --- With Zero arguments -- -Warning: stripos() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- With less than expected number of arguments -- -Warning: stripos() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- With more than expected number of arguments -- -Warning: stripos() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Offset beyond the end of the string -- Warning: stripos(): Offset not contained in string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/stripos_variation1.phpt b/ext/standard/tests/strings/stripos_variation1.phpt index a3fc324dd7..c34917ffce 100644 --- a/ext/standard/tests/strings/stripos_variation1.phpt +++ b/ext/standard/tests/strings/stripos_variation1.phpt @@ -81,7 +81,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing stripos() function: with double quoted strings *** -- Iteration 1 -- int(2) @@ -117,36 +117,20 @@ int(9) int(8) bool(false) -- Iteration 12 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) +int(11) -- Iteration 13 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) +int(12) -- Iteration 14 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) +int(13) -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) +int(14) -- Iteration 16 -- -bool(false) -bool(false) +int(0) +int(15) -- Iteration 17 -- int(10) int(47) diff --git a/ext/standard/tests/strings/stripos_variation10.phpt b/ext/standard/tests/strings/stripos_variation10.phpt index 81b8f5adb1..879da88aa7 100644 --- a/ext/standard/tests/strings/stripos_variation10.phpt +++ b/ext/standard/tests/strings/stripos_variation10.phpt @@ -83,7 +83,11 @@ $needles = array ( $counter = 1; for($index = 0; $index < count($needles); $index ++) { echo "\n-- Iteration $counter --\n"; - var_dump( stripos($haystack, $needles[$index]) ); + try { + var_dump( stripos($haystack, $needles[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -91,134 +95,84 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing stripos() function with unexpected values for needle *** -- Iteration 1 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(7) -- Iteration 2 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(9) -- Iteration 3 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 5 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(16) -- Iteration 6 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(21) -- Iteration 7 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 8 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 9 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(17) -- Iteration 10 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +stripos() expects parameter 2 to be string, array given -- Iteration 11 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +stripos() expects parameter 2 to be string, array given -- Iteration 12 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +stripos() expects parameter 2 to be string, array given -- Iteration 13 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +stripos() expects parameter 2 to be string, array given -- Iteration 14 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +stripos() expects parameter 2 to be string, array given -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(9) -- Iteration 16 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) -- Iteration 17 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(9) -- Iteration 18 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(64) -- Iteration 20 -- -bool(false) +int(0) -- Iteration 21 -- -bool(false) +int(0) -- Iteration 22 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) -- Iteration 23 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) -- Iteration 24 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -%s +stripos() expects parameter 2 to be string, resource given -- Iteration 25 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) -- Iteration 26 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) *** Done *** diff --git a/ext/standard/tests/strings/stripos_variation11.phpt b/ext/standard/tests/strings/stripos_variation11.phpt index b4b83a1641..4f002ed0ca 100644 --- a/ext/standard/tests/strings/stripos_variation11.phpt +++ b/ext/standard/tests/strings/stripos_variation11.phpt @@ -81,8 +81,16 @@ $counter = 1; for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; $haystack = $values[$index]; - var_dump( stripos($values[$index], $values[$index]) ); - var_dump( stripos($values[$index], $values[$index], 1) ); + try { + var_dump( stripos($values[$index], $values[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( stripos($values[$index], $values[$index], 1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -91,172 +99,96 @@ echo "*** Done ***"; --EXPECTF-- *** Testing stripos() function with unexpected values for haystack and needle *** -- Iteration 1 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 2 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 3 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 4 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 5 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 6 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 7 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 8 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 9 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 10 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 11 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 12 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 13 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 14 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 16 -- -bool(false) +int(0) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 18 -- -bool(false) +int(0) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 20 -- -bool(false) +int(0) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 21 -- -bool(false) +int(0) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 22 -- -bool(false) +int(0) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 23 -- -bool(false) +int(0) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 24 -- - -Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d -NULL +stripos() expects parameter 1 to be string, resource given +stripos() expects parameter 1 to be string, resource given -- Iteration 25 -- -bool(false) +int(0) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 26 -- -bool(false) +int(0) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/stripos_variation2.phpt b/ext/standard/tests/strings/stripos_variation2.phpt index bb77d1becb..294b088d02 100644 --- a/ext/standard/tests/strings/stripos_variation2.phpt +++ b/ext/standard/tests/strings/stripos_variation2.phpt @@ -83,7 +83,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing stripos() function: with single quoted strings *** -- Iteration 1 -- int(2) @@ -119,36 +119,20 @@ bool(false) int(10) int(10) -- Iteration 12 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) +int(11) -- Iteration 13 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) +int(12) -- Iteration 14 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) +int(13) -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(0) +int(14) -- Iteration 16 -- -bool(false) -bool(false) +int(0) +int(15) -- Iteration 17 -- int(14) int(51) @@ -234,11 +218,7 @@ bool(false) bool(false) bool(false) -- Iteration 45 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(26) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 46 -- int(0) diff --git a/ext/standard/tests/strings/stripos_variation3.phpt b/ext/standard/tests/strings/stripos_variation3.phpt index 936f870579..32faf63871 100644 --- a/ext/standard/tests/strings/stripos_variation3.phpt +++ b/ext/standard/tests/strings/stripos_variation3.phpt @@ -32,6 +32,6 @@ echo "*** Done ***"; int(14) int(23) int(23) -bool(false) +int(0) int(7) *** Done *** diff --git a/ext/standard/tests/strings/stripos_variation7.phpt b/ext/standard/tests/strings/stripos_variation7.phpt index 04c636365f..a21686876d 100644 --- a/ext/standard/tests/strings/stripos_variation7.phpt +++ b/ext/standard/tests/strings/stripos_variation7.phpt @@ -25,10 +25,10 @@ echo "*** Done ***"; --EXPECTF-- *** Testing stripos() function: with heredoc strings *** -- With empty heredoc string -- -bool(false) +int(0) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -bool(false) -bool(false) +int(0) +int(0) *** Done *** diff --git a/ext/standard/tests/strings/stristr.phpt b/ext/standard/tests/strings/stristr.phpt index 8fca54b082..0d47e80bcb 100644 --- a/ext/standard/tests/strings/stristr.phpt +++ b/ext/standard/tests/strings/stristr.phpt @@ -2,42 +2,27 @@ stristr() function --FILE-- <?php - var_dump(stristr()); - var_dump(stristr(array(), "")); - var_dump(stristr("", array())); - var_dump(stristr(array(), array())); var_dump(stristr("tEsT sTrInG", "tEsT")); var_dump(stristr("tEsT sTrInG", "stRiNg")); var_dump(stristr("tEsT sTrInG", "stRiN")); var_dump(stristr("tEsT sTrInG", "t S")); var_dump(stristr("tEsT sTrInG", "g")); var_dump(md5(stristr("te".chr(0)."st", chr(0)))); - var_dump(@stristr("", "")); - var_dump(@stristr("a", "")); - var_dump(@stristr("", "a")); - var_dump(md5(@stristr("\\\\a\\", "\\a"))); + var_dump(stristr("", "")); + var_dump(stristr("a", "")); + var_dump(stristr("", "a")); + var_dump(md5(stristr("\\\\a\\", "\\a"))); var_dump(stristr("tEsT sTrInG", " ")); ?> --EXPECTF-- -Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d -NULL string(11) "tEsT sTrInG" string(6) "sTrInG" string(6) "sTrInG" string(8) "T sTrInG" string(1) "G" string(32) "7272696018bdeb2c9a3f8d01fc2a9273" -bool(false) -bool(false) +string(0) "" +string(1) "a" bool(false) string(32) "6ec19f52f0766c463f3bb240f4396913" string(7) " sTrInG" diff --git a/ext/standard/tests/strings/stristr2.phpt b/ext/standard/tests/strings/stristr2.phpt index b899b4739d..ae2c8e93cf 100644 --- a/ext/standard/tests/strings/stristr2.phpt +++ b/ext/standard/tests/strings/stristr2.phpt @@ -16,14 +16,10 @@ var_dump(stristr($email, 97)); var_dump(stristr($email, 97, 1)); ?> ---EXPECTF-- +--EXPECT-- string(7) "cCdEfGh" string(2) "Ab" string(5) "eEfGh" string(4) "AbCd" - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(11) "azAbCdeEfGh" - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(1) "w" +bool(false) +bool(false) diff --git a/ext/standard/tests/strings/stristr_error.phpt b/ext/standard/tests/strings/stristr_error.phpt deleted file mode 100644 index a0057574f9..0000000000 --- a/ext/standard/tests/strings/stristr_error.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -Test stristr() function : error conditions ---FILE-- -<?php - -/* Prototype: string stristr ( string $haystack , mixed $needle [, bool $before_needle ] ) - Description: Case-insensitive strstr() -*/ -echo "*** Testing stristr() : error conditions ***\n"; - -echo "\n-- Testing stristr() function with no arguments --\n"; -var_dump( stristr() ); -var_dump( stristr("") ); - -echo "\n-- Testing stristr() function with no needle --\n"; -var_dump( stristr("Hello World") ); // without "needle" - -echo "\n-- Testing stristr() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( stristr("Hello World", "World", true, $extra_arg) ); - -echo "\n-- Testing stristr() function with empty haystack --\n"; -var_dump( stristr(NULL, "") ); - -echo "\n-- Testing stristr() function with empty needle --\n"; -var_dump( stristr("Hello World", "") ); - -?> -===DONE=== ---EXPECTF-- -*** Testing stristr() : error conditions *** - --- Testing stristr() function with no arguments -- - -Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing stristr() function with no needle -- - -Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing stristr() function with more than expected no. of arguments -- - -Warning: stristr() expects at most 3 parameters, 4 given in %s on line %d -NULL - --- Testing stristr() function with empty haystack -- - -Warning: stristr(): Empty needle in %s on line %d -bool(false) - --- Testing stristr() function with empty needle -- - -Warning: stristr(): Empty needle in %s on line %d -bool(false) -===DONE=== diff --git a/ext/standard/tests/strings/stristr_variation2.phpt b/ext/standard/tests/strings/stristr_variation2.phpt index 4a0b62f261..dd0b34f883 100644 --- a/ext/standard/tests/strings/stristr_variation2.phpt +++ b/ext/standard/tests/strings/stristr_variation2.phpt @@ -72,7 +72,11 @@ $pad_length = "20"; $count = 1; foreach($inputs as $input) { echo "-- Iteration $count --\n"; - var_dump( stristr("Hello World", $input) ); + try { + var_dump( stristr("Hello World", $input) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count ++; } @@ -80,88 +84,46 @@ fclose($file_handle); //closing the file handle ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing stristr() function: with unexpected inputs for 'needle' argument *** -- Iteration 1 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 2 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 3 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 5 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 6 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 7 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 8 -- - -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +stristr() expects parameter 2 to be string, array given -- Iteration 9 -- - -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +stristr() expects parameter 2 to be string, array given -- Iteration 10 -- - -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +stristr() expects parameter 2 to be string, array given -- Iteration 11 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 12 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +string(11) "Hello World" -- Iteration 13 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 14 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +string(11) "Hello World" -- Iteration 15 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +string(11) "Hello World" -- Iteration 16 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +string(11) "Hello World" -- Iteration 17 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 18 -- - -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +stristr() expects parameter 2 to be string, resource given -- Iteration 19 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +string(11) "Hello World" -- Iteration 20 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +string(11) "Hello World" ===DONE=== diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt Binary files differindex a546bdb8d2..156038ed7b 100644 --- a/ext/standard/tests/strings/strlen.phpt +++ b/ext/standard/tests/strings/strlen.phpt diff --git a/ext/standard/tests/strings/strncasecmp_error.phpt b/ext/standard/tests/strings/strncasecmp_error.phpt index d443f8113b..00ddfaed9b 100644 --- a/ext/standard/tests/strings/strncasecmp_error.phpt +++ b/ext/standard/tests/strings/strncasecmp_error.phpt @@ -10,18 +10,6 @@ Test strncasecmp() function : error conditions echo "*** Testing strncasecmp() function: error conditions ***\n"; $str1 = 'string_val'; $str2 = 'string_val'; -$len = 10; -$extra_arg = 10; - -echo "\n-- Testing strncasecmp() function with Zero arguments --"; -var_dump( strncasecmp() ); - -echo "\n-- Testing strncasecmp() function with less than expected number of arguments --"; -var_dump( strncasecmp($str1) ); -var_dump( strncasecmp($str1, $str2) ); - -echo "\n-- Testing strncasecmp() function with more than expected number of arguments --"; -var_dump( strncasecmp($str1, $str2, $len, $extra_arg) ); echo "\n-- Testing strncasecmp() function with invalid argument --"; $len = -10; @@ -31,21 +19,6 @@ echo "*** Done ***\n"; --EXPECTF-- *** Testing strncasecmp() function: error conditions *** --- Testing strncasecmp() function with Zero arguments -- -Warning: strncasecmp() expects exactly 3 parameters, 0 given in %s on line %d -NULL - --- Testing strncasecmp() function with less than expected number of arguments -- -Warning: strncasecmp() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: strncasecmp() expects exactly 3 parameters, 2 given in %s on line %d -NULL - --- Testing strncasecmp() function with more than expected number of arguments -- -Warning: strncasecmp() expects exactly 3 parameters, 4 given in %s on line %d -NULL - -- Testing strncasecmp() function with invalid argument -- Warning: Length must be greater than or equal to 0 in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strncmp_error.phpt b/ext/standard/tests/strings/strncmp_error.phpt index 4eb73eb318..13a4cb0350 100644 --- a/ext/standard/tests/strings/strncmp_error.phpt +++ b/ext/standard/tests/strings/strncmp_error.phpt @@ -12,13 +12,6 @@ Test strncmp() function : error conditions echo "*** Testing strncmp() function: error conditions ***\n"; $str1 = 'string_val'; $str2 = 'string_val'; -$len = 10; -$extra_arg = 10; - -var_dump( strncmp() ); //Zero argument -var_dump( strncmp($str1) ); //One argument, less than expected no. of args -var_dump( strncmp($str1, $str2) ); //Two arguments, less than expected no. of args -var_dump( strncmp($str1, $str2, $len, $extra_arg) ); //Four arguments, greater than expected no. of args /* Invalid argument for $len */ $len = -10; @@ -28,18 +21,6 @@ echo "*** Done ***\n"; --EXPECTF-- *** Testing strncmp() function: error conditions *** -Warning: strncmp() expects exactly 3 parameters, 0 given in %s on line %d -NULL - -Warning: strncmp() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: strncmp() expects exactly 3 parameters, 2 given in %s on line %d -NULL - -Warning: strncmp() expects exactly 3 parameters, 4 given in %s on line %d -NULL - Warning: Length must be greater than or equal to 0 in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strpbrk_error.phpt b/ext/standard/tests/strings/strpbrk_error.phpt index 658e2f429e..cce843c2f1 100644 --- a/ext/standard/tests/strings/strpbrk_error.phpt +++ b/ext/standard/tests/strings/strpbrk_error.phpt @@ -11,47 +11,17 @@ Test strpbrk() function : error conditions echo "*** Testing strpbrk() : error conditions ***\n"; $haystack = 'This is a Simple text.'; -$char_list = 'string_val'; -$extra_arg = 10; - -echo "\n-- Testing strpbrk() function with more than expected no. of arguments --\n"; -var_dump( strpbrk($haystack, $char_list, $extra_arg) ); - -echo "\n-- Testing strpbrk() function with less than expected no. of arguments --\n"; -var_dump( strpbrk($haystack) ); echo "\n-- Testing strpbrk() function with empty second argument --\n"; var_dump( strpbrk($haystack, '') ); -echo "\n-- Testing strpbrk() function with arrays --\n"; -var_dump( strpbrk($haystack, array('a', 'b', 'c') ) ); -var_dump( strpbrk(array('foo', 'bar'), 'b') ); - ?> ===DONE=== --EXPECTF-- *** Testing strpbrk() : error conditions *** --- Testing strpbrk() function with more than expected no. of arguments -- - -Warning: strpbrk() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) - --- Testing strpbrk() function with less than expected no. of arguments -- - -Warning: strpbrk() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) - -- Testing strpbrk() function with empty second argument -- Warning: strpbrk(): The character list cannot be empty in %s on line %d bool(false) - --- Testing strpbrk() function with arrays -- - -Warning: strpbrk() expects parameter 2 to be string, array given in %s on line %d -bool(false) - -Warning: strpbrk() expects parameter 1 to be string, array given in %s on line %d -bool(false) ===DONE=== diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt Binary files differindex 578539804d..9fc521d8d8 100644 --- a/ext/standard/tests/strings/strpos.phpt +++ b/ext/standard/tests/strings/strpos.phpt diff --git a/ext/standard/tests/strings/strpos_number.phpt b/ext/standard/tests/strings/strpos_number.phpt index fd045c64d3..76cf8e59ef 100644 --- a/ext/standard/tests/strings/strpos_number.phpt +++ b/ext/standard/tests/strings/strpos_number.phpt @@ -9,10 +9,7 @@ var_dump(strpos("foo bar", 111)); // string("11") is contained var_dump(strpos("foo 11", "11")); ?> ---EXPECTF-- -Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +--EXPECT-- +int(4) bool(false) - -Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(1) int(4) diff --git a/ext/standard/tests/strings/strpos_variation1.phpt b/ext/standard/tests/strings/strpos_variation1.phpt new file mode 100644 index 0000000000..f28517316d --- /dev/null +++ b/ext/standard/tests/strings/strpos_variation1.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test strpos() function : usage variations - complex strings containing other than 7-bit chars +--FILE-- +<?php +$string = chr(0).chr(128).chr(129).chr(234).chr(235).chr(254).chr(255); +$stringAsHex = bin2hex($string); +echo "-- Positions of some chars in the string '$stringAsHex' are as follows --\n"; +echo bin2hex( chr(128) ) ." => "; +var_dump( strpos($string, chr(128)) ); +echo bin2hex( chr(255) ) ." => "; +var_dump( strpos($string, chr(255), 3) ); +echo bin2hex( chr(256) ) ." => "; +var_dump( strpos($string, chr(256)) ); +?> + +DONE +--EXPECT-- +-- Positions of some chars in the string '008081eaebfeff' are as follows -- +80 => int(1) +ff => int(6) +00 => int(0) + +DONE diff --git a/ext/standard/tests/strings/strrchr_variation1.phpt b/ext/standard/tests/strings/strrchr_variation1.phpt Binary files differindex 5043128945..a75dd96bbf 100644 --- a/ext/standard/tests/strings/strrchr_variation1.phpt +++ b/ext/standard/tests/strings/strrchr_variation1.phpt diff --git a/ext/standard/tests/strings/strrchr_variation10.phpt b/ext/standard/tests/strings/strrchr_variation10.phpt index 3b06b20be1..1004a3d915 100644 --- a/ext/standard/tests/strings/strrchr_variation10.phpt +++ b/ext/standard/tests/strings/strrchr_variation10.phpt @@ -121,7 +121,11 @@ $needles = array ( $count = 1; for($index = 0; $index < count($haystacks); $index++) { echo "-- Iteration $count --\n"; - var_dump( strrchr($haystacks[$index], $needles[$index]) ); + try { + var_dump( strrchr($haystacks[$index], $needles[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count ++; } @@ -129,108 +133,58 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrchr() function with unexpected inputs for needle *** -- Iteration 1 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "0" -- Iteration 2 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 3 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(2) "-2" -- Iteration 5 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(4) "10.5" -- Iteration 6 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "-10.5" -- Iteration 7 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(2) "10" -- Iteration 8 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(2) "10" -- Iteration 9 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 10 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, array given -- Iteration 11 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, array given -- Iteration 12 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, array given -- Iteration 13 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, array given -- Iteration 14 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, array given -- Iteration 15 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 16 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 18 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 19 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 20 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 21 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(6) "object" -- Iteration 22 -- bool(false) -- Iteration 23 -- bool(false) -- Iteration 24 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, resource given -- Iteration 25 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation11.phpt b/ext/standard/tests/strings/strrchr_variation11.phpt index 108ba2e0f2..79ffe4c2ec 100644 --- a/ext/standard/tests/strings/strrchr_variation11.phpt +++ b/ext/standard/tests/strings/strrchr_variation11.phpt @@ -80,7 +80,11 @@ $values = array ( $counter = 1; for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; - var_dump( strrchr($values[$index], $values[$index]) ); + try { + var_dump( strrchr($values[$index], $values[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -88,108 +92,58 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrchr() function: with unexpected inputs for haystack and needle *** -- Iteration 1 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "0" -- Iteration 2 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 3 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "12345" -- Iteration 4 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "-2345" -- Iteration 5 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(4) "10.5" -- Iteration 6 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "-10.5" -- Iteration 7 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(10) "1234567000" -- Iteration 8 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(4) "1E-9" -- Iteration 9 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(3) "0.5" -- Iteration 10 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 11 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 12 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 13 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 14 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 15 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 16 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 18 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(6) "object" -- Iteration 20 -- bool(false) -- Iteration 21 -- bool(false) -- Iteration 22 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 23 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 24 -- - -Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, resource given -- Iteration 25 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation12.phpt b/ext/standard/tests/strings/strrchr_variation12.phpt Binary files differindex 730811ea47..a17902604a 100644 --- a/ext/standard/tests/strings/strrchr_variation12.phpt +++ b/ext/standard/tests/strings/strrchr_variation12.phpt diff --git a/ext/standard/tests/strings/strrchr_variation2.phpt b/ext/standard/tests/strings/strrchr_variation2.phpt index ddce2c2ccb..2ff6720fb9 100644 --- a/ext/standard/tests/strings/strrchr_variation2.phpt +++ b/ext/standard/tests/strings/strrchr_variation2.phpt @@ -117,23 +117,15 @@ bool(false) string(5) "\101 " -- Iteration 12 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 14 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 15 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 16 -- @@ -221,9 +213,7 @@ bool(false) string(7) "4 \101 " -- Iteration 44 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -string(37) "*+-./:;<=>?@hello123456he \x234 \101 " +string(7) "4 \101 " -- Iteration 45 -- string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " diff --git a/ext/standard/tests/strings/strrchr_variation8.phpt b/ext/standard/tests/strings/strrchr_variation8.phpt index 6b49b698f4..31a727ed6f 100644 --- a/ext/standard/tests/strings/strrchr_variation8.phpt +++ b/ext/standard/tests/strings/strrchr_variation8.phpt @@ -30,15 +30,11 @@ foreach($needles as $needle) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrchr() function: with heredoc strings *** bool(false) bool(false) - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) bool(false) bool(false) diff --git a/ext/standard/tests/strings/strripos.phpt b/ext/standard/tests/strings/strripos.phpt index 291ff78cd7..c343e92731 100644 --- a/ext/standard/tests/strings/strripos.phpt +++ b/ext/standard/tests/strings/strripos.phpt @@ -10,14 +10,11 @@ strripos() function var_dump(strripos("te".chr(0)."st", chr(0))); var_dump(strripos("tEst", "test")); var_dump(strripos("teSt", "test")); - var_dump(@strripos("foo", "f", 1)); - var_dump(@strripos("", "")); - var_dump(@strripos("a", "")); - var_dump(@strripos("", "a")); - var_dump(@strripos("\\\\a", "\\a")); - - $fp = fopen(__FILE__, "r"); - var_dump(@strripos("", $fp)); + var_dump(strripos("foo", "f", 1)); + var_dump(strripos("", "")); + var_dump(strripos("a", "")); + var_dump(strripos("", "a")); + var_dump(strripos("\\\\a", "\\a")); ?> --EXPECT-- int(5) @@ -29,8 +26,7 @@ int(2) int(0) int(0) bool(false) -bool(false) -bool(false) -bool(false) +int(0) int(1) bool(false) +int(1) diff --git a/ext/standard/tests/strings/strripos_offset.phpt b/ext/standard/tests/strings/strripos_offset.phpt index 70a9534ebd..7dc0ce0d61 100644 --- a/ext/standard/tests/strings/strripos_offset.phpt +++ b/ext/standard/tests/strings/strripos_offset.phpt @@ -3,11 +3,12 @@ strripos() offset integer overflow --FILE-- <?php -var_dump(strripos("t", "t", PHP_INT_MAX+1)); -var_dump(strripos("tttt", "tt", PHP_INT_MAX+1)); -var_dump(strripos(100, 101, PHP_INT_MAX+1)); -var_dump(strripos(1024, 1024, PHP_INT_MAX+1)); -var_dump(strripos(array(), array(), PHP_INT_MAX+1)); +try { + var_dump(strripos("t", "t", PHP_INT_MAX+1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + var_dump(strripos(1024, 1024, -PHP_INT_MAX)); var_dump(strripos(1024, "te", -PHP_INT_MAX)); var_dump(strripos(1024, 1024, -PHP_INT_MAX-1)); @@ -16,34 +17,17 @@ var_dump(strripos(1024, "te", -PHP_INT_MAX-1)); echo "Done\n"; ?> --EXPECTF-- -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) +strripos() expects parameter 3 to be int, float given -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d +Warning: strripos(): Offset not contained in string in %s on line %d bool(false) -Warning: strripos() expects parameter 1 to be string, array given in %s on line %d +Warning: strripos(): Offset not contained in string in %s on line %d bool(false) -Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) - -Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strripos(): Offset not contained in string in %s on line %d bool(false) -Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strripos(): Offset not contained in string in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/strripos_variation1.phpt b/ext/standard/tests/strings/strripos_variation1.phpt index 59d7a64686..8b0c3a35cc 100644 --- a/ext/standard/tests/strings/strripos_variation1.phpt +++ b/ext/standard/tests/strings/strripos_variation1.phpt @@ -74,7 +74,7 @@ foreach ($needles as $needle) { } ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing strripos() function: with double quoted strings *** -- Iteration 1 -- int(28) @@ -132,62 +132,30 @@ int(8) bool(false) int(8) -- Iteration 12 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +int(44) +int(44) +int(44) +int(43) -- Iteration 13 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +int(44) +int(44) +int(44) +int(43) -- Iteration 14 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +int(44) +int(44) +int(44) +int(43) -- Iteration 15 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +int(44) +int(44) +int(44) +int(43) -- Iteration 16 -- -bool(false) -bool(false) -bool(false) -bool(false) +int(44) +int(44) +int(44) +int(43) -- Iteration 17 -- int(43) int(43) diff --git a/ext/standard/tests/strings/strripos_variation2.phpt b/ext/standard/tests/strings/strripos_variation2.phpt index 7b47b787be..affe72a50a 100644 --- a/ext/standard/tests/strings/strripos_variation2.phpt +++ b/ext/standard/tests/strings/strripos_variation2.phpt @@ -75,7 +75,7 @@ foreach ($needles as $needle) { } ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing strripos() function: with single quoted strings *** -- Iteration 1 -- int(32) @@ -133,62 +133,30 @@ int(10) bool(false) int(10) -- Iteration 12 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(54) +int(54) +int(54) +int(53) -- Iteration 13 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(54) +int(54) +int(54) +int(53) -- Iteration 14 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(54) +int(54) +int(54) +int(53) -- Iteration 15 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(54) +int(54) +int(54) +int(53) -- Iteration 16 -- -bool(false) -bool(false) -bool(false) -bool(false) +int(54) +int(54) +int(54) +int(53) -- Iteration 17 -- int(53) int(53) @@ -280,18 +248,10 @@ bool(false) bool(false) bool(false) -- Iteration 35 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) +bool(false) +bool(false) +bool(false) +bool(false) -- Iteration 36 -- int(0) bool(false) diff --git a/ext/standard/tests/strings/strripos_variation3.phpt b/ext/standard/tests/strings/strripos_variation3.phpt index 4fccaeb47e..0f531f03da 100644 --- a/ext/standard/tests/strings/strripos_variation3.phpt +++ b/ext/standard/tests/strings/strripos_variation3.phpt @@ -54,6 +54,6 @@ bool(false) -- Multi line strings with no offset -- int(18) int(31) -bool(false) +int(63) int(55) ===DONE=== diff --git a/ext/standard/tests/strings/strripos_variation6.phpt b/ext/standard/tests/strings/strripos_variation6.phpt new file mode 100644 index 0000000000..92bb70440a --- /dev/null +++ b/ext/standard/tests/strings/strripos_variation6.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test strrpos() function : usage variations - negative offset with empty needle +--FILE-- +<?php +$haystack = "Hello,\t\n\0\n $&!#%()*<=>?@hello123456he \x234 \101 "; + +var_dump(strlen($haystack)); + +var_dump( strripos($haystack, "", -1) ); +var_dump( strripos($haystack, "", -10) ); +var_dump( strripos($haystack, "", -26) ); +var_dump( strripos($haystack, "", -44) ); +?> + +DONE +--EXPECT-- +int(44) +int(43) +int(34) +int(18) +int(0) + +DONE diff --git a/ext/standard/tests/strings/strrpos.phpt b/ext/standard/tests/strings/strrpos.phpt index 691f67e599..f672d93a2a 100644 --- a/ext/standard/tests/strings/strrpos.phpt +++ b/ext/standard/tests/strings/strrpos.phpt @@ -10,11 +10,11 @@ strrpos() function var_dump(strrpos("te".chr(0)."st", chr(0))); var_dump(strrpos("tEst", "test")); var_dump(strrpos("teSt", "test")); - var_dump(@strrpos("foo", "f", 1)); - var_dump(@strrpos("", "")); - var_dump(@strrpos("a", "")); - var_dump(@strrpos("", "a")); - var_dump(@strrpos("\\\\a", "\\a")); + var_dump(strrpos("foo", "f", 1)); + var_dump(strrpos("", "")); + var_dump(strrpos("a", "")); + var_dump(strrpos("", "a")); + var_dump(strrpos("\\\\a", "\\a")); ?> --EXPECT-- int(5) @@ -26,7 +26,7 @@ int(2) bool(false) bool(false) bool(false) -bool(false) -bool(false) +int(0) +int(1) bool(false) int(1) diff --git a/ext/standard/tests/strings/strrpos_offset.phpt b/ext/standard/tests/strings/strrpos_offset.phpt index 9ef4f42d18..fdff39fdb2 100644 --- a/ext/standard/tests/strings/strrpos_offset.phpt +++ b/ext/standard/tests/strings/strrpos_offset.phpt @@ -3,10 +3,12 @@ strrpos() offset integer overflow --FILE-- <?php -var_dump(strrpos("t", "t", PHP_INT_MAX+1)); -var_dump(strrpos("tttt", "tt", PHP_INT_MAX+1)); -var_dump(strrpos(100, 101, PHP_INT_MAX+1)); -var_dump(strrpos(1024, 1024, PHP_INT_MAX+1)); +try { + var_dump(strrpos("t", "t", PHP_INT_MAX+1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + var_dump(strrpos(1024, 1024, -PHP_INT_MAX)); var_dump(strrpos(1024, "te", -PHP_INT_MAX)); var_dump(strrpos(1024, 1024, -PHP_INT_MAX-1)); @@ -15,31 +17,17 @@ var_dump(strrpos(1024, "te", -PHP_INT_MAX-1)); echo "Done\n"; ?> --EXPECTF-- -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) +strrpos() expects parameter 3 to be int, float given -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d +Warning: strrpos(): Offset not contained in string in %s on line %d bool(false) -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strrpos(): Offset not contained in string in %s on line %d bool(false) -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strrpos(): Offset not contained in string in %s on line %d bool(false) -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d +Warning: strrpos(): Offset not contained in string in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/strrpos_variation1.phpt b/ext/standard/tests/strings/strrpos_variation1.phpt index fd236d04d4..d54adaec73 100644 --- a/ext/standard/tests/strings/strrpos_variation1.phpt +++ b/ext/standard/tests/strings/strrpos_variation1.phpt @@ -72,7 +72,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function: with double quoted strings *** -- Iteration 1 -- int(28) @@ -108,36 +108,20 @@ int(9) int(8) bool(false) -- Iteration 12 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(44) +int(44) -- Iteration 13 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(44) +int(44) -- Iteration 14 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(44) +int(44) -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(44) +int(44) -- Iteration 16 -- -bool(false) -bool(false) +int(44) +int(44) -- Iteration 17 -- int(43) int(43) diff --git a/ext/standard/tests/strings/strrpos_variation10.phpt b/ext/standard/tests/strings/strrpos_variation10.phpt index b9b24b9cb1..2a6b84337c 100644 --- a/ext/standard/tests/strings/strrpos_variation10.phpt +++ b/ext/standard/tests/strings/strrpos_variation10.phpt @@ -83,7 +83,11 @@ $needles = array ( $counter = 1; for($index = 0; $index < count($needles); $index ++) { echo "-- Iteration $counter --\n"; - var_dump( strrpos($haystack, $needles[$index]) ); + try { + var_dump( strrpos($haystack, $needles[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -91,108 +95,58 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function with unexpected values for needle *** -- Iteration 1 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(42) -- Iteration 2 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(41) -- Iteration 3 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 5 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(27) -- Iteration 6 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(21) -- Iteration 7 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 8 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 9 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(28) -- Iteration 10 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 11 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 12 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 13 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 14 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(41) -- Iteration 16 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(87) -- Iteration 17 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(41) -- Iteration 18 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(87) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(64) -- Iteration 20 -- -bool(false) +int(87) -- Iteration 21 -- -bool(false) +int(87) -- Iteration 22 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(87) -- Iteration 23 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(87) -- Iteration 24 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, resource given -- Iteration 25 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(87) -- Iteration 26 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(87) *** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation11.phpt b/ext/standard/tests/strings/strrpos_variation11.phpt index 94c1b9d96d..2fbe78e30a 100644 --- a/ext/standard/tests/strings/strrpos_variation11.phpt +++ b/ext/standard/tests/strings/strrpos_variation11.phpt @@ -81,8 +81,16 @@ $counter = 1; for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; $haystack = $values[$index]; - var_dump( strrpos($values[$index], $values[$index]) ); - var_dump( strrpos($values[$index], $values[$index], 1) ); + try { + var_dump( strrpos($values[$index], $values[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( strrpos($values[$index], $values[$index], 1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -91,181 +99,97 @@ echo "*** Done ***"; --EXPECTF-- *** Testing strrpos() function with unexpected values for haystack and needle *** -- Iteration 1 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 2 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 3 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 4 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 5 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 6 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 7 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 8 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 9 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 10 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 11 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 12 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 13 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 14 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 16 -- +int(0) -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +Warning: strrpos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 18 -- +int(0) -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +Warning: strrpos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 20 -- -bool(false) +int(0) + +Warning: strrpos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 21 -- -bool(false) -bool(false) --- Iteration 22 -- +int(0) -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +Warning: strrpos(): Offset not contained in string in %s on line %d bool(false) +-- Iteration 22 -- +int(0) -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +Warning: strrpos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 23 -- +int(0) -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +Warning: strrpos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 24 -- - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, resource given +strrpos() expects parameter 1 to be string, resource given -- Iteration 25 -- +int(0) -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +Warning: strrpos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 26 -- +int(0) -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +Warning: strrpos(): Offset not contained in string in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation14.phpt b/ext/standard/tests/strings/strrpos_variation14.phpt new file mode 100644 index 0000000000..d244a19e47 --- /dev/null +++ b/ext/standard/tests/strings/strrpos_variation14.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test strrpos() function : usage variations - negative offset with empty needle +--FILE-- +<?php +$haystack = "Hello,\t\n\0\n $&!#%()*<=>?@hello123456he \x234 \101 "; + +var_dump(strlen($haystack)); + +var_dump( strrpos($haystack, "", -1) ); +var_dump( strrpos($haystack, "", -10) ); +var_dump( strrpos($haystack, "", -26) ); +var_dump( strrpos($haystack, "", -44) ); +?> + +DONE +--EXPECT-- +int(44) +int(43) +int(34) +int(18) +int(0) + +DONE diff --git a/ext/standard/tests/strings/strrpos_variation15.phpt b/ext/standard/tests/strings/strrpos_variation15.phpt deleted file mode 100644 index 798a6877e4..0000000000 --- a/ext/standard/tests/strings/strrpos_variation15.phpt +++ /dev/null @@ -1,205 +0,0 @@ ---TEST-- -Test strrpos() function : usage variations - unexpected inputs for 'haystack', 'needle' & 'offset' arguments ---SKIPIF-- -<?php if (PHP_INT_SIZE !== 4) die("skip this test is for 32-bit only"); ---FILE-- -<?php -/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] ); - * Description: Find position of last occurrence of 'needle' in 'haystack'. - * Source code: ext/standard/string.c -*/ - -/* Test strrpos() function with unexpected inputs for 'haystack', 'needle' & 'offset' arguments */ - -echo "*** Testing strrpos() function: with unexpected values for haystack, needle & offset ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// defining a class -class sample { - public function __toString() { - return "object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - //resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - - -// loop through each element of the array and check the working of strrpos() -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - var_dump( strrpos($values[$index], $values[$index], $values[$index]) ); - $counter ++; -} - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing strrpos() function: with unexpected values for haystack, needle & offset *** --- Iteration 1 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 2 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 3 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 4 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 5 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 6 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) --- Iteration 8 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 9 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 10 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 11 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 12 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 13 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 14 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 16 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 17 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 18 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 19 -- - -Warning: strrpos() expects parameter 3 to be int, object given in %s on line %d -bool(false) --- Iteration 20 -- - -Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d -bool(false) --- Iteration 21 -- - -Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d -bool(false) --- Iteration 22 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 23 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 24 -- - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) --- Iteration 25 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 26 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) -*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation2.phpt b/ext/standard/tests/strings/strrpos_variation2.phpt index 9c0a320785..3accd165bb 100644 --- a/ext/standard/tests/strings/strrpos_variation2.phpt +++ b/ext/standard/tests/strings/strrpos_variation2.phpt @@ -73,7 +73,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function: with single quoted strings *** -- Iteration 1 -- int(32) @@ -109,36 +109,20 @@ bool(false) int(10) int(10) -- Iteration 12 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(54) +int(54) -- Iteration 13 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(54) +int(54) -- Iteration 14 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(54) +int(54) -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(54) +int(54) -- Iteration 16 -- -bool(false) -bool(false) +int(54) +int(54) -- Iteration 17 -- int(53) int(53) @@ -194,11 +178,7 @@ bool(false) bool(false) bool(false) -- Iteration 35 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 36 -- int(0) diff --git a/ext/standard/tests/strings/strrpos_variation3.phpt b/ext/standard/tests/strings/strrpos_variation3.phpt index 460f18cca5..1ebe9e7a21 100644 --- a/ext/standard/tests/strings/strrpos_variation3.phpt +++ b/ext/standard/tests/strings/strrpos_variation3.phpt @@ -32,6 +32,6 @@ echo "*** Done ***"; int(44) int(44) int(44) -bool(false) +int(63) int(55) *** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation7.phpt b/ext/standard/tests/strings/strrpos_variation7.phpt index 54db4b372e..d5aa8b561c 100644 --- a/ext/standard/tests/strings/strrpos_variation7.phpt +++ b/ext/standard/tests/strings/strrpos_variation7.phpt @@ -25,12 +25,10 @@ echo "*** Done ***"; --EXPECTF-- *** Testing strrpos() function: with heredoc strings *** -- With empty heredoc string -- -bool(false) -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(0) -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +Warning: strrpos(): Offset not contained in string in %s on line %d bool(false) +int(0) +int(0) *** Done *** diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt Binary files differindex 2908de7a27..81ddee0804 100644 --- a/ext/standard/tests/strings/strstr.phpt +++ b/ext/standard/tests/strings/strstr.phpt diff --git a/ext/standard/tests/strings/strstr_variation1.phpt b/ext/standard/tests/strings/strstr_variation1.phpt new file mode 100644 index 0000000000..aade1fd5f8 --- /dev/null +++ b/ext/standard/tests/strings/strstr_variation1.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test strstr() function : usage variations - complex strings containing other than 7-bit chars +--FILE-- +<?php +$string = chr(0).chr(128).chr(129).chr(234).chr(235).chr(254).chr(255); +$stringAsHex = bin2hex($string); +echo "-- Positions of some chars in the string '$stringAsHex' are as follows --\n"; +echo bin2hex( chr(128) ) ." => "; +var_dump( bin2hex( strstr($string, chr(128) ) ) ); +echo bin2hex( chr(255) ) ." => "; +var_dump( bin2hex( strstr($string, chr(255) ) ) ); +echo bin2hex( chr(256) ) ." => "; +var_dump( bin2hex( strstr($string, chr(256) ) ) ); +?> + +DONE +--EXPECT-- +-- Positions of some chars in the string '008081eaebfeff' are as follows -- +80 => string(12) "8081eaebfeff" +ff => string(2) "ff" +00 => string(14) "008081eaebfeff" + +DONE diff --git a/ext/standard/tests/strings/strtolower-win32.phpt b/ext/standard/tests/strings/strtolower-win32.phpt Binary files differindex c0ad1d0115..ff631754df 100644 --- a/ext/standard/tests/strings/strtolower-win32.phpt +++ b/ext/standard/tests/strings/strtolower-win32.phpt diff --git a/ext/standard/tests/strings/strtolower.phpt b/ext/standard/tests/strings/strtolower.phpt Binary files differindex 47dfe09762..7c7e2bb4c7 100644 --- a/ext/standard/tests/strings/strtolower.phpt +++ b/ext/standard/tests/strings/strtolower.phpt diff --git a/ext/standard/tests/strings/strtoupper1-win32.phpt b/ext/standard/tests/strings/strtoupper1-win32.phpt Binary files differindex 60701652e1..7240e5c021 100644 --- a/ext/standard/tests/strings/strtoupper1-win32.phpt +++ b/ext/standard/tests/strings/strtoupper1-win32.phpt diff --git a/ext/standard/tests/strings/strtoupper1.phpt b/ext/standard/tests/strings/strtoupper1.phpt Binary files differindex e0ebf42ea7..c243ff10c7 100644 --- a/ext/standard/tests/strings/strtoupper1.phpt +++ b/ext/standard/tests/strings/strtoupper1.phpt diff --git a/ext/standard/tests/strings/strtr_variation8.phpt b/ext/standard/tests/strings/strtr_variation8.phpt index 8d29db1cc3..2e2843335d 100644 --- a/ext/standard/tests/strings/strtr_variation8.phpt +++ b/ext/standard/tests/strings/strtr_variation8.phpt @@ -75,10 +75,15 @@ $replace_pairs_arr = array ( // loop through with each element of the $replace_pairs array to test strtr() function $count = 1; for($index = 0; $index < count($replace_pairs_arr); $index++) { - echo "\n-- Iteration $count --\n"; - $replace_pairs = $replace_pairs_arr[$index]; - var_dump( strtr($str, $replace_pairs) ); - $count ++; + echo "\n-- Iteration $count --\n"; + $replace_pairs = $replace_pairs_arr[$index]; + try { + var_dump( strtr($str, $replace_pairs) ); + } catch (\TypeError $e) { + echo $e->getMessage() . "\n"; + } + + $count ++; } fclose($file_handle); //closing the file handle @@ -89,34 +94,22 @@ echo "*** Done ***"; *** Testing strtr() function: with unexpected inputs for 'replace_pairs' *** -- Iteration 1 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array -- Iteration 2 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array -- Iteration 3 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array -- Iteration 4 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array -- Iteration 5 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array -- Iteration 6 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array -- Iteration 7 -- string(6) "012atm" @@ -128,52 +121,32 @@ string(6) "012atm" string(6) "122atm" -- Iteration 10 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array -- Iteration 11 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array -- Iteration 12 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array -- Iteration 13 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array -- Iteration 14 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array -- Iteration 15 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array -- Iteration 16 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array -- Iteration 17 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array -- Iteration 18 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array -- Iteration 19 -- - -Warning: strtr(): The second argument is not an array in %s on line %d -bool(false) +The second argument is not an array *** Done *** diff --git a/ext/standard/tests/strings/strval_error.phpt b/ext/standard/tests/strings/strval_error.phpt index 4e1ece6016..3cd76c5e15 100644 --- a/ext/standard/tests/strings/strval_error.phpt +++ b/ext/standard/tests/strings/strval_error.phpt @@ -16,17 +16,6 @@ class MyClass // no toString() method defined } -$string = "Hello"; -$extra_arg = 10; - -//Test strval with one more than the expected number of arguments -echo "\n-- Testing strval() function with more than expected no. of arguments --\n"; -var_dump( strval($string, $extra_arg) ); - -// Testing strval with one less than the expected number of arguments -echo "\n-- Testing strval() function with less than expected no. of arguments --\n"; -var_dump( strval() ); - // Testing strval with a object which has no toString() method echo "\n-- Testing strval() function with object which has not toString() method --\n"; try { @@ -40,16 +29,6 @@ try { --EXPECTF-- *** Testing strval() : error conditions *** --- Testing strval() function with more than expected no. of arguments -- - -Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Testing strval() function with less than expected no. of arguments -- - -Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -- Testing strval() function with object which has not toString() method -- Object of class MyClass could not be converted to string ===DONE=== diff --git a/ext/standard/tests/strings/substr.phpt b/ext/standard/tests/strings/substr.phpt Binary files differindex 0901d2082e..18e7cd1781 100644 --- a/ext/standard/tests/strings/substr.phpt +++ b/ext/standard/tests/strings/substr.phpt diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt index f1edf0afdf..b0a8a5b0eb 100644 --- a/ext/standard/tests/strings/substr_compare.phpt +++ b/ext/standard/tests/strings/substr_compare.phpt @@ -12,11 +12,14 @@ var_dump(substr_compare("abcde", "cd", 1, 2) < 0); var_dump(substr_compare("abcde", "abc", 5, 1)); var_dump(substr_compare("abcde", "abcdef", -10, 10) < 0); var_dump(substr_compare("abcde", "abc", 0, 0)); -var_dump(substr_compare("abcde", -1, 0, NULL, new stdClass)); echo "Test\n"; -var_dump(substr_compare("abcde", "abc", 0, -1)); + +try { + substr_compare("abcde", "abc", 0, -1); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} var_dump(substr_compare("abcde", "abc", -1, NULL, -5) > 0); -var_dump(substr_compare("abcde", -1, 0, "str", new stdClass)); echo "Done\n"; ?> @@ -30,15 +33,7 @@ bool(true) int(-1) bool(true) int(0) - -Warning: substr_compare() expects parameter 5 to be bool, object given in %s on line %d -bool(false) Test - -Warning: substr_compare(): The length must be greater than or equal to zero in %s on line %d -bool(false) +The length must be greater than or equal to zero bool(true) - -Warning: substr_compare() expects parameter 4 to be int, string given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/strings/substr_count_basic.phpt b/ext/standard/tests/strings/substr_count_basic.phpt index 4023a774d8..385689e697 100644 --- a/ext/standard/tests/strings/substr_count_basic.phpt +++ b/ext/standard/tests/strings/substr_count_basic.phpt @@ -4,17 +4,25 @@ Test substr_count() function (basic) <?php echo "***Testing basic operations ***\n"; -var_dump(@substr_count("", "")); -var_dump(@substr_count("a", "")); -var_dump(@substr_count("", "a")); -var_dump(@substr_count("", "a")); -var_dump(@substr_count("", chr(0))); +try { + substr_count("", ""); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} +try { + substr_count("a", ""); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} +var_dump(substr_count("", "a")); +var_dump(substr_count("", "a")); +var_dump(substr_count("", chr(0))); $a = str_repeat("abcacba", 100); -var_dump(@substr_count($a, "bca")); +var_dump(substr_count($a, "bca")); $a = str_repeat("abcacbabca", 100); -var_dump(@substr_count($a, "bca")); +var_dump(substr_count($a, "bca")); var_dump(substr_count($a, "bca", 200)); var_dump(substr_count($a, "bca", 200, 50)); var_dump(substr_count($a, "bca", -200)); @@ -26,8 +34,8 @@ echo "Done\n"; ?> --EXPECT-- ***Testing basic operations *** -bool(false) -bool(false) +Empty substring +Empty substring int(0) int(0) int(0) diff --git a/ext/standard/tests/strings/substr_count_error.phpt b/ext/standard/tests/strings/substr_count_error.phpt index eecc251e6c..246963d13b 100644 --- a/ext/standard/tests/strings/substr_count_error.phpt +++ b/ext/standard/tests/strings/substr_count_error.phpt @@ -6,12 +6,6 @@ Test substr_count() function (error conditions) echo "\n*** Testing error conditions ***\n"; $str = 'abcdefghik'; -/* Zero argument */ -var_dump( substr_count() ); - -/* more than expected no. of args */ -var_dump( substr_count($str, "t", 0, 15, 30) ); - /* offset before start */ var_dump(substr_count($str, "t", -20)); @@ -22,9 +16,6 @@ var_dump(substr_count($str, "t", 25)); Warning message expected, as length+offset > length of string */ var_dump( substr_count($str, "i", 5, 7) ); -/* Invalid offset argument */ -var_dump( substr_count($str, "t", "") ); - /* length too small */ var_dump( substr_count($str, "t", 2, -20) ); @@ -34,12 +25,6 @@ echo "Done\n"; --EXPECTF-- *** Testing error conditions *** -Warning: substr_count() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: substr_count() expects at most 4 parameters, 5 given in %s on line %d -NULL - Warning: substr_count(): Offset not contained in string in %s on line %d bool(false) @@ -49,9 +34,6 @@ bool(false) Warning: substr_count(): Invalid length value in %s on line %d bool(false) -Warning: substr_count() expects parameter 3 to be int, string given in %s on line %d -NULL - Warning: substr_count(): Invalid length value in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/substr_count_variation_001.phpt b/ext/standard/tests/strings/substr_count_variation_001.phpt index 71f2d223e1..19a9a0310d 100644 --- a/ext/standard/tests/strings/substr_count_variation_001.phpt +++ b/ext/standard/tests/strings/substr_count_variation_001.phpt @@ -12,9 +12,6 @@ var_dump( substr_count($str, "i", "5t") ); var_dump( substr_count($str, "i", "5t", "10t") ); echo "\n-- 3rd or 4th arg as NULL --\n"; -var_dump( substr_count($str, "t", "") ); -var_dump( substr_count($str, "T", "") ); -var_dump( substr_count($str, "t", "", 15) ); var_dump( substr_count($str, "I", NULL) ); var_dump( substr_count($str, "i", NULL, 10) ); @@ -67,15 +64,6 @@ Notice: A non well formed numeric value encountered in %s on line %d int(2) -- 3rd or 4th arg as NULL -- - -Warning: substr_count() expects parameter 3 to be int, string given %s on line %d -NULL - -Warning: substr_count() expects parameter 3 to be int, string given %s on line %d -NULL - -Warning: substr_count() expects parameter 3 to be int, string given %s on line %d -NULL int(0) int(2) diff --git a/ext/standard/tests/strings/substr_replace_error.phpt b/ext/standard/tests/strings/substr_replace_error.phpt index ac945349fe..936d0fd1d5 100644 --- a/ext/standard/tests/strings/substr_replace_error.phpt +++ b/ext/standard/tests/strings/substr_replace_error.phpt @@ -15,13 +15,6 @@ echo "*** Testing substr_replace() : error conditions ***\n"; $s1 = "Good morning"; -echo "\n-- Testing substr_replace() function with less than expected no. of arguments --\n"; -var_dump(substr_replace()); -var_dump(substr_replace($s1, "evening")); - -echo "\n-- Testing substr_replace() function with more than expected no. of arguments --\n"; -var_dump(substr_replace($s1, "evening", 5, 7, true)); - echo "\n-- Testing substr_replace() function with start and length different types --\n"; var_dump(substr_replace($s1, "evening", array(5))); var_dump(substr_replace($s1, "evening", 5, array(8))); @@ -37,19 +30,6 @@ var_dump(substr_replace($s1, "evening", array(5), array(8))); --EXPECTF-- *** Testing substr_replace() : error conditions *** --- Testing substr_replace() function with less than expected no. of arguments -- - -Warning: substr_replace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: substr_replace() expects at least 3 parameters, 2 given in %s on line %d -NULL - --- Testing substr_replace() function with more than expected no. of arguments -- - -Warning: substr_replace() expects at most 4 parameters, 5 given in %s on line %d -NULL - -- Testing substr_replace() function with start and length different types -- Warning: substr_replace(): 'start' and 'length' should be of same type - numerical or array in %s on line %d diff --git a/ext/standard/tests/strings/trim1.phpt b/ext/standard/tests/strings/trim1.phpt Binary files differindex d0e4070d80..1ad504c61d 100644 --- a/ext/standard/tests/strings/trim1.phpt +++ b/ext/standard/tests/strings/trim1.phpt diff --git a/ext/standard/tests/strings/trim_error.phpt b/ext/standard/tests/strings/trim_error.phpt index b845cee1ac..046a2b04f9 100644 --- a/ext/standard/tests/strings/trim_error.phpt +++ b/ext/standard/tests/strings/trim_error.phpt @@ -11,14 +11,6 @@ Test trim() function : error conditions echo "*** Testing trim() : error conditions ***\n"; -echo "\n-- Testing trim() function with no arguments --\n"; -var_dump( trim() ); - -echo "\n-- Testing trim() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( trim("Hello World", "Heo", $extra_arg) ); - - $hello = " Hello World\n"; echo "\n-- Test trim function with various invalid charlists --\n"; var_dump(trim($hello, "..a")); @@ -31,16 +23,6 @@ var_dump(trim($hello, "a..b..c")); --EXPECTF-- *** Testing trim() : error conditions *** --- Testing trim() function with no arguments -- - -Warning: trim() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing trim() function with more than expected no. of arguments -- - -Warning: trim() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Test trim function with various invalid charlists -- Warning: trim(): Invalid '..'-range, no character to the left of '..' in %s on line %d diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt Binary files differindex b524b45e59..3508881d3c 100644 --- a/ext/standard/tests/strings/ucfirst.phpt +++ b/ext/standard/tests/strings/ucfirst.phpt diff --git a/ext/standard/tests/strings/unpack_error.phpt b/ext/standard/tests/strings/unpack_error.phpt index f04e493772..b34be23267 100644 --- a/ext/standard/tests/strings/unpack_error.phpt +++ b/ext/standard/tests/strings/unpack_error.phpt @@ -10,13 +10,6 @@ Test unpack() function : error conditions echo "*** Testing unpack() : error conditions ***\n"; -echo "\n-- Testing unpack() function with no arguments --\n"; -var_dump( unpack() ); - -echo "\n-- Testing unpack() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump(unpack("I", pack("I", 65534), 0, $extra_arg)); - echo "\n-- Testing unpack() function with invalid format character --\n"; $extra_arg = 10; var_dump(unpack("B", pack("I", 65534))); @@ -25,16 +18,6 @@ var_dump(unpack("B", pack("I", 65534))); --EXPECTF-- *** Testing unpack() : error conditions *** --- Testing unpack() function with no arguments -- - -Warning: unpack() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing unpack() function with more than expected no. of arguments -- - -Warning: unpack() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Testing unpack() function with invalid format character -- Warning: unpack(): Invalid format type B in %s on line %d diff --git a/ext/standard/tests/strings/uuencode.phpt b/ext/standard/tests/strings/uuencode.phpt index 5a1f3d2a24..8199a2ed05 100644 --- a/ext/standard/tests/strings/uuencode.phpt +++ b/ext/standard/tests/strings/uuencode.phpt @@ -3,9 +3,6 @@ uuencode family tests --FILE-- <?php -var_dump(convert_uuencode(array())); -var_dump(convert_uudecode(array())); - var_dump(convert_uuencode("")); var_dump(convert_uudecode("")); var_dump($enc = convert_uuencode("~!@#$%^&*()_}{POIUYTREWQQSDFGHJKL:<MNBVCXZ")); @@ -18,11 +15,6 @@ var_dump(convert_uudecode(substr($enc, 0, -10))); echo "Done\n"; ?> --EXPECTF-- -Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d -bool(false) bool(false) bool(false) string(60) "J?B%`(R0E7B8J*"E??7M03TE5651215=145-$1D=(2DM,.CQ-3D)60UA: diff --git a/ext/standard/tests/strings/vfprintf_error1.phpt b/ext/standard/tests/strings/vfprintf_error1.phpt index c56631ecd7..b4548e8b49 100644 --- a/ext/standard/tests/strings/vfprintf_error1.phpt +++ b/ext/standard/tests/strings/vfprintf_error1.phpt @@ -20,8 +20,16 @@ echo "\n-- Testing vfprintf() function with more than expected no. of arguments $format = 'string_val'; $args = array( 1, 2 ); $extra_arg = 10; -var_dump( vfprintf( $fp, $format, $args, $extra_arg ) ); -var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) ); +try { + var_dump( vfprintf( $fp, $format, $args, $extra_arg ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // Close handle fclose($fp); @@ -37,10 +45,6 @@ unlink( $file ); ?> --EXPECTF-- -- Testing vfprintf() function with more than expected no. of arguments -- - -Warning: Wrong parameter count for vfprintf() in %s on line %d -NULL - -Warning: Wrong parameter count for vfprintf() in %s on line %d -NULL +Wrong parameter count for vfprintf() +Wrong parameter count for vfprintf() ===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_error4.phpt b/ext/standard/tests/strings/vfprintf_error4.phpt index 2865d42a9e..e54e34f4cd 100644 --- a/ext/standard/tests/strings/vfprintf_error4.phpt +++ b/ext/standard/tests/strings/vfprintf_error4.phpt @@ -17,7 +17,11 @@ $file = 'vfprintf_error4.txt'; $fp = fopen( $file, "a+" ); echo "\n-- Testing vfprintf() function with other strangeties --\n"; -var_dump( vfprintf( 'foo', 'bar', array( 'baz' ) ) ); +try { + var_dump( vfprintf( 'foo', 'bar', array( 'baz' ) ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump( vfprintf( $fp, 'Foo %$c-0202Sd', array( 2 ) ) ); // Close handle @@ -34,9 +38,7 @@ unlink( $file ); ?> --EXPECTF-- -- Testing vfprintf() function with other strangeties -- - -Warning: vfprintf() expects parameter 1 to be resource, string given in %s on line %d -bool(false) +vfprintf() expects parameter 1 to be resource, string given Warning: vfprintf(): Argument number must be greater than zero in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/vfprintf_variation1.phpt b/ext/standard/tests/strings/vfprintf_variation1.phpt index 76422011c2..7c969ffff9 100644 --- a/ext/standard/tests/strings/vfprintf_variation1.phpt +++ b/ext/standard/tests/strings/vfprintf_variation1.phpt @@ -48,8 +48,6 @@ writeAndDump( $fp, "%s %s %s", array( 'bar', 'bar', 'bar' ) ); writeAndDump( $fp, "%02d", array( 50 ) ); writeAndDump( $fp, "", array() ); writeAndDump( $fp, "Testing %b %d %f %o %s %x %X", array( 9, 6, 2.5502, 24, "foobar", 15, 65 ) ); -@writeAndDump( $funset, "Foo with %s", array( 'string' ) ); -@writeAndDump( new FooClass(), "Foo with %s", array( 'string' ) ); // Close handle fclose( $fp ); @@ -79,8 +77,4 @@ string(0) "" int(0) string(38) "Testing 1001 6 2.550200 30 foobar f 41" int(38) -bool(false) -bool(false) -bool(false) -bool(false) ===DONE=== diff --git a/ext/standard/tests/strings/wordwrap.phpt b/ext/standard/tests/strings/wordwrap.phpt index 543c41fdd9..8c2b08f046 100644 --- a/ext/standard/tests/strings/wordwrap.phpt +++ b/ext/standard/tests/strings/wordwrap.phpt @@ -27,10 +27,17 @@ $tests = <<<TESTS "123|==1234567890|==123" === wordwrap("123 1234567890 123", 10, "|==", 1) -FALSE === @wordwrap(chr(0), 0, "") - TESTS; include(__DIR__ . '/../../../../tests/quicktester.inc'); + +echo "\n"; + +try { + wordwrap(chr(0), 0, ""); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} --EXPECT-- OK +Break string cannot be empty diff --git a/ext/standard/tests/strings/wordwrap_error.phpt b/ext/standard/tests/strings/wordwrap_error.phpt index 41c5cbdb69..f0fa80f63d 100644 --- a/ext/standard/tests/strings/wordwrap_error.phpt +++ b/ext/standard/tests/strings/wordwrap_error.phpt @@ -9,19 +9,10 @@ Test wordwrap() function : error conditions echo "*** Testing wordwrap() : error conditions ***\n"; -// Zero argument -echo "\n-- Testing wordwrap() function with Zero arguments --\n"; -var_dump( wordwrap() ); - -// More than expected number of arguments -echo "\n-- Testing wordwrap() function with more than expected no. of arguments --\n"; $str = 'testing wordwrap function'; $width = 10; $break = '<br />\n'; $cut = true; -$extra_arg = "extra_arg"; - -var_dump( wordwrap($str, $width, $break, $cut, $extra_arg) ); // $width arg as negative value echo "\n-- Testing wordwrap() function with negative/zero value for width argument --\n"; @@ -35,7 +26,12 @@ echo "-- width = 0 & cut = true --\n"; // width as zero and cut as true $width = 0; $cut = true; -var_dump( wordwrap($str, $width, $break, $cut) ); + +try { + wordwrap($str, $width, $break, $cut); +} catch (\Error $e) { + echo $e->getMessage() . "\n"; +} echo "-- width = -10 & cut = false --\n"; // width as -ne and cut as false @@ -54,23 +50,11 @@ echo "Done\n"; --EXPECTF-- *** Testing wordwrap() : error conditions *** --- Testing wordwrap() function with Zero arguments -- - -Warning: wordwrap() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing wordwrap() function with more than expected no. of arguments -- - -Warning: wordwrap() expects at most 4 parameters, 5 given in %s on line %d -NULL - -- Testing wordwrap() function with negative/zero value for width argument -- -- width = 0 & cut = false -- string(39) "testing<br />\nwordwrap<br />\nfunction" -- width = 0 & cut = true -- - -Warning: wordwrap(): Can't force cut when width is zero in %s on line %d -bool(false) +Can't force cut when width is zero -- width = -10 & cut = false -- string(39) "testing<br />\nwordwrap<br />\nfunction" -- width = -10 & cut = true -- diff --git a/ext/standard/tests/time/strptime_error.phpt b/ext/standard/tests/time/strptime_error.phpt index f49025be44..3f7bbbdb82 100644 --- a/ext/standard/tests/time/strptime_error.phpt +++ b/ext/standard/tests/time/strptime_error.phpt @@ -19,20 +19,8 @@ date_default_timezone_set("Europe/London"); echo "*** Testing strptime() : error conditions ***\n"; -echo "\n-- Testing strptime() function with Zero arguments --\n"; -var_dump( strptime() ); - -echo "\n-- Testing strptime() function with less than expected no. of arguments --\n"; -$format = '%b %d %Y %H:%M:%S'; -$timestamp = mktime(8, 8, 8, 8, 8, 2008); -$date = strftime($format, $timestamp); -var_dump( strptime($date) ); - -echo "\n-- Testing strptime() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( strptime($date, $format, $extra_arg) ); - echo "\n-- Testing strptime() function on failure --\n"; +$format = '%b %d %Y %H:%M:%S'; var_dump( strptime('foo', $format) ); ?> @@ -40,21 +28,6 @@ var_dump( strptime('foo', $format) ); --EXPECTF-- *** Testing strptime() : error conditions *** --- Testing strptime() function with Zero arguments -- - -Warning: strptime() expects exactly 2 parameters, 0 given in %s on line %d -NULL - --- Testing strptime() function with less than expected no. of arguments -- - -Warning: strptime() expects exactly 2 parameters, 1 given in %s on line %d -NULL - --- Testing strptime() function with more than expected no. of arguments -- - -Warning: strptime() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -- Testing strptime() function on failure -- bool(false) ===DONE=== diff --git a/ext/standard/url.c b/ext/standard/url.c index a04d941498..9dc756e8e2 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -654,7 +654,7 @@ PHPAPI size_t php_raw_url_decode(char *str, size_t len) } /* }}} */ -/* {{{ proto array get_headers(string url[, int format[, resource context]]) +/* {{{ proto array|false get_headers(string url[, int format[, resource context]]) fetches all the headers sent by the server in response to a HTTP request */ PHP_FUNCTION(get_headers) { diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 6cba49b030..c66f821fd4 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -164,7 +164,7 @@ php_stream_filter_status_t userfilter_filter( zval func_name; zval retval; zval args[4]; - zval zpropname; + zend_string *propname; int call_result; /* the userfilter object probably doesn't exist anymore */ @@ -239,9 +239,9 @@ php_stream_filter_status_t userfilter_filter( /* filter resources are cleaned up by the stream destructor, * keeping a reference to the stream resource here would prevent it * from being destroyed properly */ - ZVAL_STRINGL(&zpropname, "stream", sizeof("stream")-1); - Z_OBJ_HANDLER_P(obj, unset_property)(obj, &zpropname, NULL); - zval_ptr_dtor(&zpropname); + propname = zend_string_init("stream", sizeof("stream")-1, 0); + Z_OBJ_HANDLER_P(obj, unset_property)(Z_OBJ_P(obj), propname, NULL); + zend_string_release_ex(propname, 0); zval_ptr_dtor(&args[3]); zval_ptr_dtor(&args[2]); @@ -388,7 +388,7 @@ static void filter_item_dtor(zval *zv) efree(fdat); } -/* {{{ proto object stream_bucket_make_writeable(resource brigade) +/* {{{ proto object|false stream_bucket_make_writeable(resource brigade) Return a bucket object from the brigade for operating on */ PHP_FUNCTION(stream_bucket_make_writeable) { @@ -398,11 +398,11 @@ PHP_FUNCTION(stream_bucket_make_writeable) ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_RESOURCE(zbrigade) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); if ((brigade = (php_stream_bucket_brigade*)zend_fetch_resource( Z_RES_P(zbrigade), PHP_STREAM_BRIGADE_RES_NAME, le_bucket_brigade)) == NULL) { - RETURN_FALSE; + return; } ZVAL_NULL(return_value); @@ -430,7 +430,7 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS) ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_RESOURCE(zbrigade) Z_PARAM_OBJECT(zobject) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); if (NULL == (pzbucket = zend_hash_str_find(Z_OBJPROP_P(zobject), "bucket", sizeof("bucket")-1))) { php_error_docref(NULL, E_WARNING, "Object has no bucket property"); @@ -439,11 +439,11 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS) if ((brigade = (php_stream_bucket_brigade*)zend_fetch_resource( Z_RES_P(zbrigade), PHP_STREAM_BRIGADE_RES_NAME, le_bucket_brigade)) == NULL) { - RETURN_FALSE; + return; } if ((bucket = (php_stream_bucket *)zend_fetch_resource_ex(pzbucket, PHP_STREAM_BUCKET_RES_NAME, le_bucket)) == NULL) { - RETURN_FALSE; + return; } if (NULL != (pzdata = zend_hash_str_find(Z_OBJPROP_P(zobject), "data", sizeof("data")-1)) && Z_TYPE_P(pzdata) == IS_STRING) { @@ -501,7 +501,7 @@ PHP_FUNCTION(stream_bucket_new) ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_ZVAL(zstream) Z_PARAM_STRING(buffer, buffer_len) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); php_stream_from_zval(stream, zstream); @@ -561,7 +561,7 @@ PHP_FUNCTION(stream_filter_register) ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(filtername) Z_PARAM_STR(classname) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); RETVAL_FALSE; diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c index dbc99a9634..fe4170b6aa 100644 --- a/ext/standard/uuencode.c +++ b/ext/standard/uuencode.c @@ -196,7 +196,7 @@ err: } /* }}} */ -/* {{{ proto string convert_uuencode(string data) +/* {{{ proto string|false convert_uuencode(string data) uuencode a string */ PHP_FUNCTION(convert_uuencode) { @@ -204,14 +204,14 @@ PHP_FUNCTION(convert_uuencode) ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(src) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); if (ZSTR_LEN(src) < 1) { RETURN_FALSE; } RETURN_STR(php_uuencode(ZSTR_VAL(src), ZSTR_LEN(src))); } /* }}} */ -/* {{{ proto string convert_uudecode(string data) +/* {{{ proto string|false convert_uudecode(string data) decode a uuencoded string */ PHP_FUNCTION(convert_uudecode) { @@ -220,7 +220,7 @@ PHP_FUNCTION(convert_uudecode) ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(src) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); if (ZSTR_LEN(src) < 1) { RETURN_FALSE; } if ((dest = php_uudecode(ZSTR_VAL(src), ZSTR_LEN(src))) == NULL) { diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c index e4353130d6..99f62ee471 100644 --- a/ext/standard/versioning.c +++ b/ext/standard/versioning.c @@ -201,7 +201,7 @@ php_version_compare(const char *orig_ver1, const char *orig_ver2) } /* }}} */ -/* {{{ proto int version_compare(string ver1, string ver2 [, string oper]) +/* {{{ proto int|bool|null version_compare(string ver1, string ver2 [, string oper]) Compares two "PHP-standardized" version number strings */ PHP_FUNCTION(version_compare) |