diff options
Diffstat (limited to 'ext/standard')
384 files changed, 3463 insertions, 8851 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index 3967d83242..e0b52ca169 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -345,64 +345,25 @@ static zend_always_inline int php_array_key_compare_string_locale_unstable_i(Buc static zend_always_inline int php_array_data_compare_unstable_i(Bucket *f, Bucket *s) /* {{{ */ { - zval *first = &f->val; - zval *second = &s->val; - - if (UNEXPECTED(Z_TYPE_P(first) == IS_INDIRECT)) { - first = Z_INDIRECT_P(first); - } - if (UNEXPECTED(Z_TYPE_P(second) == IS_INDIRECT)) { - second = Z_INDIRECT_P(second); - } - return zend_compare(first, second); + return zend_compare(&f->val, &s->val); } /* }}} */ static zend_always_inline int php_array_data_compare_numeric_unstable_i(Bucket *f, Bucket *s) /* {{{ */ { - zval *first = &f->val; - zval *second = &s->val; - - if (UNEXPECTED(Z_TYPE_P(first) == IS_INDIRECT)) { - first = Z_INDIRECT_P(first); - } - if (UNEXPECTED(Z_TYPE_P(second) == IS_INDIRECT)) { - second = Z_INDIRECT_P(second); - } - - return numeric_compare_function(first, second); + return numeric_compare_function(&f->val, &s->val); } /* }}} */ static zend_always_inline int php_array_data_compare_string_case_unstable_i(Bucket *f, Bucket *s) /* {{{ */ { - zval *first = &f->val; - zval *second = &s->val; - - if (UNEXPECTED(Z_TYPE_P(first) == IS_INDIRECT)) { - first = Z_INDIRECT_P(first); - } - if (UNEXPECTED(Z_TYPE_P(second) == IS_INDIRECT)) { - second = Z_INDIRECT_P(second); - } - - return string_case_compare_function(first, second); + return string_case_compare_function(&f->val, &s->val); } /* }}} */ static zend_always_inline int php_array_data_compare_string_unstable_i(Bucket *f, Bucket *s) /* {{{ */ { - zval *first = &f->val; - zval *second = &s->val; - - if (UNEXPECTED(Z_TYPE_P(first) == IS_INDIRECT)) { - first = Z_INDIRECT_P(first); - } - if (UNEXPECTED(Z_TYPE_P(second) == IS_INDIRECT)) { - second = Z_INDIRECT_P(second); - } - - return string_compare_function(first, second); + return string_compare_function(&f->val, &s->val); } /* }}} */ @@ -434,17 +395,7 @@ static zend_always_inline int php_array_natural_case_compare_unstable_i(Bucket * static int php_array_data_compare_string_locale_unstable_i(Bucket *f, Bucket *s) /* {{{ */ { - zval *first = &f->val; - zval *second = &s->val; - - if (UNEXPECTED(Z_TYPE_P(first) == IS_INDIRECT)) { - first = Z_INDIRECT_P(first); - } - if (UNEXPECTED(Z_TYPE_P(second) == IS_INDIRECT)) { - second = Z_INDIRECT_P(second); - } - - return string_locale_compare_function(first, second); + return string_locale_compare_function(&f->val, &s->val); } /* }}} */ @@ -708,7 +659,7 @@ PHPAPI zend_long php_count_recursive(HashTable *ht) /* {{{ */ GC_PROTECT_RECURSION(ht); } - cnt = zend_array_count(ht); + cnt = zend_hash_num_elements(ht); ZEND_HASH_FOREACH_VAL(ht, element) { ZVAL_DEREF(element); if (Z_TYPE_P(element) == IS_ARRAY) { @@ -742,7 +693,7 @@ PHP_FUNCTION(count) switch (Z_TYPE_P(array)) { case IS_ARRAY: if (mode != COUNT_RECURSIVE) { - cnt = zend_array_count(Z_ARRVAL_P(array)); + cnt = zend_hash_num_elements(Z_ARRVAL_P(array)); } else { cnt = php_count_recursive(Z_ARRVAL_P(array)); } @@ -898,7 +849,7 @@ static inline int php_array_user_compare_unstable(Bucket *f, Bucket *s) /* {{{ * { zval args[2]; zval retval; - zend_bool call_failed; + bool call_failed; ZVAL_COPY(&args[0], &f->val); ZVAL_COPY(&args[1], &s->val); @@ -964,7 +915,7 @@ static int php_array_user_compare(Bucket *a, Bucket *b) /* {{{ */ BG(user_compare_fci) = old_user_compare_fci; \ BG(user_compare_fci_cache) = old_user_compare_fci_cache; \ -static void php_usort(INTERNAL_FUNCTION_PARAMETERS, bucket_compare_func_t compare_func, zend_bool renumber) /* {{{ */ +static void php_usort(INTERNAL_FUNCTION_PARAMETERS, bucket_compare_func_t compare_func, bool renumber) /* {{{ */ { zval *array; zend_array *arr; @@ -1014,7 +965,7 @@ static inline int php_array_user_key_compare_unstable(Bucket *f, Bucket *s) /* { { zval args[2]; zval retval; - zend_bool call_failed; + bool call_failed; if (f->key == NULL) { ZVAL_LONG(&args[0], f->h); @@ -1321,7 +1272,13 @@ PHP_FUNCTION(max) } /* }}} */ -static int php_array_walk(zval *array, zval *userdata, int recursive) /* {{{ */ +typedef struct { + zend_fcall_info fci; + zend_fcall_info_cache fci_cache; +} php_array_walk_context; + +static int php_array_walk( + php_array_walk_context *context, zval *array, zval *userdata, int recursive) { zval args[3], /* Arguments to userland function */ retval, /* Return value - unused */ @@ -1331,15 +1288,19 @@ static int php_array_walk(zval *array, zval *userdata, int recursive) /* {{{ */ uint32_t ht_iter; int result = SUCCESS; + /* Create a local copy of fci, as we want to use different arguments at different + * levels of recursion. */ + zend_fcall_info fci = context->fci; + /* Set up known arguments */ ZVAL_UNDEF(&args[1]); if (userdata) { ZVAL_COPY(&args[2], userdata); } - BG(array_walk_fci).retval = &retval; - BG(array_walk_fci).param_count = userdata ? 3 : 2; - BG(array_walk_fci).params = args; + fci.retval = &retval; + fci.param_count = userdata ? 3 : 2; + fci.params = args; zend_hash_internal_pointer_reset_ex(target_hash, &pos); ht_iter = zend_hash_iterator_add(target_hash, pos); @@ -1386,8 +1347,6 @@ static int php_array_walk(zval *array, zval *userdata, int recursive) /* {{{ */ if (recursive && Z_TYPE_P(Z_REFVAL_P(zv)) == IS_ARRAY) { HashTable *thash; - zend_fcall_info orig_array_walk_fci; - zend_fcall_info_cache orig_array_walk_fci_cache; zval ref; ZVAL_COPY_VALUE(&ref, zv); @@ -1400,28 +1359,20 @@ static int php_array_walk(zval *array, zval *userdata, int recursive) /* {{{ */ break; } - /* backup the fcall info and cache */ - orig_array_walk_fci = BG(array_walk_fci); - orig_array_walk_fci_cache = BG(array_walk_fci_cache); - Z_ADDREF(ref); GC_PROTECT_RECURSION(thash); - result = php_array_walk(zv, userdata, recursive); + result = php_array_walk(context, zv, userdata, recursive); if (Z_TYPE_P(Z_REFVAL(ref)) == IS_ARRAY && thash == Z_ARRVAL_P(Z_REFVAL(ref))) { /* If the hashtable changed in the meantime, we'll "leak" this apply count * increment -- our reference to thash is no longer valid. */ GC_UNPROTECT_RECURSION(thash); } zval_ptr_dtor(&ref); - - /* restore the fcall info and cache */ - BG(array_walk_fci) = orig_array_walk_fci; - BG(array_walk_fci_cache) = orig_array_walk_fci_cache; } else { ZVAL_COPY(&args[0], zv); /* Call the userland function */ - result = zend_call_function(&BG(array_walk_fci), &BG(array_walk_fci_cache)); + result = zend_call_function(&fci, &context->fci_cache); if (result == SUCCESS) { zval_ptr_dtor(&retval); } @@ -1458,33 +1409,22 @@ static int php_array_walk(zval *array, zval *userdata, int recursive) /* {{{ */ zend_hash_iterator_del(ht_iter); return result; } -/* }}} */ /* {{{ Apply a user function to every member of an array */ PHP_FUNCTION(array_walk) { zval *array; zval *userdata = NULL; - zend_fcall_info orig_array_walk_fci; - zend_fcall_info_cache orig_array_walk_fci_cache; - - orig_array_walk_fci = BG(array_walk_fci); - orig_array_walk_fci_cache = BG(array_walk_fci_cache); + php_array_walk_context context; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_ARRAY_OR_OBJECT_EX(array, 0, 1) - Z_PARAM_FUNC(BG(array_walk_fci), BG(array_walk_fci_cache)) + Z_PARAM_FUNC(context.fci, context.fci_cache) Z_PARAM_OPTIONAL Z_PARAM_ZVAL(userdata) - ZEND_PARSE_PARAMETERS_END_EX( - BG(array_walk_fci) = orig_array_walk_fci; - BG(array_walk_fci_cache) = orig_array_walk_fci_cache; - return - ); - - php_array_walk(array, userdata, 0); - BG(array_walk_fci) = orig_array_walk_fci; - BG(array_walk_fci_cache) = orig_array_walk_fci_cache; + ZEND_PARSE_PARAMETERS_END(); + + php_array_walk(&context, array, userdata, 0); RETURN_TRUE; } /* }}} */ @@ -1494,26 +1434,16 @@ PHP_FUNCTION(array_walk_recursive) { zval *array; zval *userdata = NULL; - zend_fcall_info orig_array_walk_fci; - zend_fcall_info_cache orig_array_walk_fci_cache; - - orig_array_walk_fci = BG(array_walk_fci); - orig_array_walk_fci_cache = BG(array_walk_fci_cache); + php_array_walk_context context; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_ARRAY_OR_OBJECT_EX(array, 0, 1) - Z_PARAM_FUNC(BG(array_walk_fci), BG(array_walk_fci_cache)) + Z_PARAM_FUNC(context.fci, context.fci_cache) Z_PARAM_OPTIONAL Z_PARAM_ZVAL(userdata) - ZEND_PARSE_PARAMETERS_END_EX( - BG(array_walk_fci) = orig_array_walk_fci; - BG(array_walk_fci_cache) = orig_array_walk_fci_cache; - return - ); - - php_array_walk(array, userdata, 1); - BG(array_walk_fci) = orig_array_walk_fci; - BG(array_walk_fci_cache) = orig_array_walk_fci_cache; + ZEND_PARSE_PARAMETERS_END(); + + php_array_walk(&context, array, userdata, 1); RETURN_TRUE; } /* }}} */ @@ -1529,7 +1459,7 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) *entry; /* pointer to array entry */ zend_ulong num_idx; zend_string *str_idx; - zend_bool strict = 0; /* strict comparison or not */ + bool strict = 0; /* strict comparison or not */ ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_ZVAL(value) @@ -1540,81 +1470,76 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior) if (strict) { if (Z_TYPE_P(value) == IS_LONG) { - ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_idx, str_idx, entry) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) { ZVAL_DEREF(entry); if (Z_TYPE_P(entry) == IS_LONG && Z_LVAL_P(entry) == Z_LVAL_P(value)) { if (behavior == 0) { RETURN_TRUE; } else { if (str_idx) { - RETVAL_STR_COPY(str_idx); + RETURN_STR_COPY(str_idx); } else { - RETVAL_LONG(num_idx); + RETURN_LONG(num_idx); } - return; } } } ZEND_HASH_FOREACH_END(); } else { - ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_idx, str_idx, entry) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) { ZVAL_DEREF(entry); if (fast_is_identical_function(value, entry)) { if (behavior == 0) { RETURN_TRUE; } else { if (str_idx) { - RETVAL_STR_COPY(str_idx); + RETURN_STR_COPY(str_idx); } else { - RETVAL_LONG(num_idx); + RETURN_LONG(num_idx); } - return; } } } ZEND_HASH_FOREACH_END(); } } else { if (Z_TYPE_P(value) == IS_LONG) { - ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_idx, str_idx, entry) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) { if (fast_equal_check_long(value, entry)) { if (behavior == 0) { RETURN_TRUE; } else { if (str_idx) { - RETVAL_STR_COPY(str_idx); + RETURN_STR_COPY(str_idx); } else { - RETVAL_LONG(num_idx); + RETURN_LONG(num_idx); } - return; } } } ZEND_HASH_FOREACH_END(); } else if (Z_TYPE_P(value) == IS_STRING) { - ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_idx, str_idx, entry) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) { if (fast_equal_check_string(value, entry)) { if (behavior == 0) { RETURN_TRUE; } else { if (str_idx) { - RETVAL_STR_COPY(str_idx); + RETURN_STR_COPY(str_idx); } else { - RETVAL_LONG(num_idx); + RETURN_LONG(num_idx); } - return; } } } ZEND_HASH_FOREACH_END(); } else { - ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_idx, str_idx, entry) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) { if (fast_equal_check_function(value, entry)) { if (behavior == 0) { RETURN_TRUE; } else { if (str_idx) { - RETVAL_STR_COPY(str_idx); + RETURN_STR_COPY(str_idx); } else { - RETVAL_LONG(num_idx); + RETURN_LONG(num_idx); } - return; } } } ZEND_HASH_FOREACH_END(); @@ -1696,7 +1621,7 @@ static zend_always_inline int php_valid_var_name(const char *var_name, size_t va } /* }}} */ -PHPAPI int php_prefix_varname(zval *result, zend_string *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, bool add_underscore) /* {{{ */ { 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)); @@ -1717,7 +1642,7 @@ static zend_long php_extract_ref_if_exists(zend_array *arr, zend_array *symbol_t zend_string *var_name; zval *entry, *orig_var; - ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) { + ZEND_HASH_FOREACH_STR_KEY_VAL(arr, var_name, entry) { if (!var_name) { continue; } @@ -1760,7 +1685,7 @@ static zend_long php_extract_if_exists(zend_array *arr, zend_array *symbol_table zend_string *var_name; zval *entry, *orig_var; - ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) { + ZEND_HASH_FOREACH_STR_KEY_VAL(arr, var_name, entry) { if (!var_name) { continue; } @@ -1801,7 +1726,7 @@ static zend_long php_extract_ref_overwrite(zend_array *arr, zend_array *symbol_t zend_string *var_name; zval *entry, *orig_var; - ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) { + ZEND_HASH_FOREACH_STR_KEY_VAL(arr, var_name, entry) { if (!var_name) { continue; } @@ -1848,7 +1773,7 @@ static zend_long php_extract_overwrite(zend_array *arr, zend_array *symbol_table zend_string *var_name; zval *entry, *orig_var; - ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) { + ZEND_HASH_FOREACH_STR_KEY_VAL(arr, var_name, entry) { if (!var_name) { continue; } @@ -1890,7 +1815,7 @@ static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *s zend_string *var_name; zval *entry, *orig_var, final_name; - ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) { + ZEND_HASH_FOREACH_STR_KEY_VAL(arr, var_name, entry) { if (!var_name) { continue; } @@ -1946,7 +1871,7 @@ static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbo zend_string *var_name; zval *entry, *orig_var, final_name; - ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) { + ZEND_HASH_FOREACH_STR_KEY_VAL(arr, var_name, entry) { if (!var_name) { continue; } @@ -1997,7 +1922,7 @@ static zend_long php_extract_ref_prefix_same(zend_array *arr, zend_array *symbol zend_string *var_name; zval *entry, *orig_var, final_name; - ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) { + ZEND_HASH_FOREACH_STR_KEY_VAL(arr, var_name, entry) { if (!var_name) { continue; } @@ -2071,7 +1996,7 @@ static zend_long php_extract_prefix_same(zend_array *arr, zend_array *symbol_tab zend_string *var_name; zval *entry, *orig_var, final_name; - ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) { + ZEND_HASH_FOREACH_STR_KEY_VAL(arr, var_name, entry) { if (!var_name) { continue; } @@ -2138,7 +2063,7 @@ static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_ zend_ulong num_key; zval *entry, *orig_var, final_name; - ZEND_HASH_FOREACH_KEY_VAL_IND(arr, num_key, var_name, entry) { + ZEND_HASH_FOREACH_KEY_VAL(arr, num_key, var_name, entry) { if (var_name) { if (ZSTR_LEN(var_name) == 0) { continue; @@ -2185,7 +2110,7 @@ static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_tabl zend_ulong num_key; zval *entry, *orig_var, final_name; - ZEND_HASH_FOREACH_KEY_VAL_IND(arr, num_key, var_name, entry) { + ZEND_HASH_FOREACH_KEY_VAL(arr, num_key, var_name, entry) { if (var_name) { if (ZSTR_LEN(var_name) == 0) { continue; @@ -2232,7 +2157,7 @@ static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *sym zend_ulong num_key; zval *entry, *orig_var, final_name; - ZEND_HASH_FOREACH_KEY_VAL_IND(arr, num_key, var_name, entry) { + ZEND_HASH_FOREACH_KEY_VAL(arr, num_key, var_name, entry) { if (var_name) { if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name)) || zend_string_equals_literal(var_name, "this")) { @@ -2287,7 +2212,7 @@ static zend_long php_extract_prefix_invalid(zend_array *arr, zend_array *symbol_ zend_ulong num_key; zval *entry, *orig_var, final_name; - ZEND_HASH_FOREACH_KEY_VAL_IND(arr, num_key, var_name, entry) { + ZEND_HASH_FOREACH_KEY_VAL(arr, num_key, var_name, entry) { if (var_name) { if (!php_valid_var_name(ZSTR_VAL(var_name), ZSTR_LEN(var_name)) || zend_string_equals_literal(var_name, "this")) { @@ -2341,7 +2266,7 @@ static zend_long php_extract_ref_skip(zend_array *arr, zend_array *symbol_table) zend_string *var_name; zval *entry, *orig_var; - ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) { + ZEND_HASH_FOREACH_STR_KEY_VAL(arr, var_name, entry) { if (!var_name) { continue; } @@ -2386,7 +2311,7 @@ static zend_long php_extract_skip(zend_array *arr, zend_array *symbol_table) /* zend_string *var_name; zval *entry, *orig_var; - ZEND_HASH_FOREACH_STR_KEY_VAL_IND(arr, var_name, entry) { + ZEND_HASH_FOREACH_STR_KEY_VAL(arr, var_name, entry) { if (!var_name) { continue; } @@ -2549,7 +2474,7 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu } Z_PROTECT_RECURSION_P(entry); } - ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL_P(entry), value_ptr) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(entry), value_ptr) { php_compact_var(eg_active_symbol_table, return_value, value_ptr); } ZEND_HASH_FOREACH_END(); if (Z_REFCOUNTED_P(entry)) { @@ -3033,7 +2958,6 @@ static void php_splice(HashTable *in_hash, zend_long offset, zend_long length, H for (pos = 0, idx = 0; pos < offset && idx < in_hash->nNumUsed; idx++) { p = in_hash->arData + idx; if (Z_TYPE(p->val) == IS_UNDEF) continue; - /* Get entry and increase reference count */ entry = &p->val; /* Update output hash depending on key type */ @@ -3061,15 +2985,10 @@ static void php_splice(HashTable *in_hash, zend_long offset, zend_long length, H Z_TRY_ADDREF_P(entry); if (p->key == NULL) { zend_hash_next_index_insert_new(removed, entry); - zend_hash_del_bucket(in_hash, p); } else { zend_hash_add_new(removed, p->key, entry); - if (in_hash == &EG(symbol_table)) { - zend_delete_global_variable(p->key); - } else { - zend_hash_del_bucket(in_hash, p); - } } + zend_hash_del_bucket(in_hash, p); } } else { /* otherwise just skip those entries */ int pos2 = pos; @@ -3078,18 +2997,14 @@ static void php_splice(HashTable *in_hash, zend_long offset, zend_long length, H p = in_hash->arData + idx; if (Z_TYPE(p->val) == IS_UNDEF) continue; pos2++; - if (p->key && in_hash == &EG(symbol_table)) { - zend_delete_global_variable(p->key); - } else { - zend_hash_del_bucket(in_hash, p); - } + zend_hash_del_bucket(in_hash, p); } } iter_pos = zend_hash_iterators_lower_pos(in_hash, iter_pos); /* If there are entries to insert.. */ if (replace) { - ZEND_HASH_FOREACH_VAL_IND(replace, entry) { + ZEND_HASH_FOREACH_VAL(replace, entry) { Z_TRY_ADDREF_P(entry); zend_hash_next_index_insert_new(&out_hash, entry); pos++; @@ -3190,9 +3105,6 @@ PHP_FUNCTION(array_pop) idx--; p = Z_ARRVAL_P(stack)->arData + idx; val = &p->val; - if (Z_TYPE_P(val) == IS_INDIRECT) { - val = Z_INDIRECT_P(val); - } if (Z_TYPE_P(val) != IS_UNDEF) { break; } @@ -3204,12 +3116,7 @@ PHP_FUNCTION(array_pop) } /* Delete the last value */ - if (p->key && Z_ARRVAL_P(stack) == &EG(symbol_table)) { - zend_delete_global_variable(p->key); - } else { - zend_hash_del_bucket(Z_ARRVAL_P(stack), p); - } - + zend_hash_del_bucket(Z_ARRVAL_P(stack), p); zend_hash_internal_pointer_reset(Z_ARRVAL_P(stack)); } /* }}} */ @@ -3238,9 +3145,6 @@ PHP_FUNCTION(array_shift) } p = Z_ARRVAL_P(stack)->arData + idx; val = &p->val; - if (Z_TYPE_P(val) == IS_INDIRECT) { - val = Z_INDIRECT_P(val); - } if (Z_TYPE_P(val) != IS_UNDEF) { break; } @@ -3249,11 +3153,7 @@ PHP_FUNCTION(array_shift) ZVAL_COPY_DEREF(return_value, val); /* Delete the first value */ - if (p->key && Z_ARRVAL_P(stack) == &EG(symbol_table)) { - zend_delete_global_variable(p->key); - } else { - zend_hash_del_bucket(Z_ARRVAL_P(stack), p); - } + zend_hash_del_bucket(Z_ARRVAL_P(stack), p); /* re-index like it did before */ if (HT_FLAGS(Z_ARRVAL_P(stack)) & HASH_FLAG_PACKED) { @@ -3384,7 +3284,7 @@ PHP_FUNCTION(array_splice) HashTable *rem_hash = NULL; zend_long offset, length = 0; - zend_bool length_is_null = 1; + bool length_is_null = 1; int num_in; /* Number of elements in the input array */ ZEND_PARSE_PARAMETERS_START(2, 4) @@ -3403,7 +3303,7 @@ PHP_FUNCTION(array_splice) if (ZEND_NUM_ARGS() == 4) { /* Make sure the last argument, if passed, is an array */ - convert_to_array_ex(repl_array); + convert_to_array(repl_array); } /* Don't create the array of removed elements if it's not going @@ -3472,8 +3372,8 @@ PHP_FUNCTION(array_slice) 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 */ + bool length_is_null = 1; /* Whether an explicit length has been omitted */ + 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 */ zend_string *string_key; zend_ulong num_key; @@ -3601,10 +3501,10 @@ PHPAPI int php_array_merge_recursive(HashTable *dest, HashTable *src) /* {{{ */ dest_zval = dest_entry; if (Z_TYPE_P(dest_zval) == IS_NULL) { - convert_to_array_ex(dest_zval); + convert_to_array(dest_zval); add_next_index_null(dest_zval); } else { - convert_to_array_ex(dest_zval); + convert_to_array(dest_zval); } ZVAL_UNDEF(&tmp); if (Z_TYPE_P(src_zval) == IS_OBJECT) { @@ -3827,7 +3727,7 @@ static zend_always_inline void php_array_merge_wrapper(INTERNAL_FUNCTION_PARAMET return; } } else { - zend_bool copy = 1; + bool copy = 1; zend_string *string_key; ZEND_HASH_FOREACH_STR_KEY(Z_ARRVAL_P(ret), string_key) { @@ -3926,7 +3826,7 @@ PHP_FUNCTION(array_keys) *search_value = NULL, /* Value to search for */ *entry, /* An entry in the input array */ new_val; /* New value */ - zend_bool strict = 0; /* do strict comparison */ + bool strict = 0; /* do strict comparison */ zend_ulong num_idx; zend_string *str_idx; zend_array *arrval; @@ -3951,7 +3851,7 @@ PHP_FUNCTION(array_keys) array_init(return_value); if (strict) { - ZEND_HASH_FOREACH_KEY_VAL_IND(arrval, num_idx, str_idx, entry) { + ZEND_HASH_FOREACH_KEY_VAL(arrval, num_idx, str_idx, entry) { ZVAL_DEREF(entry); if (fast_is_identical_function(search_value, entry)) { if (str_idx) { @@ -3963,7 +3863,7 @@ PHP_FUNCTION(array_keys) } } ZEND_HASH_FOREACH_END(); } else { - ZEND_HASH_FOREACH_KEY_VAL_IND(arrval, num_idx, str_idx, entry) { + ZEND_HASH_FOREACH_KEY_VAL(arrval, num_idx, str_idx, entry) { if (fast_equal_check_function(search_value, entry)) { if (str_idx) { ZVAL_STR_COPY(&new_val, str_idx); @@ -3988,7 +3888,7 @@ PHP_FUNCTION(array_keys) } } else { /* Go through input array and add keys to the return array */ - ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(input), num_idx, str_idx, entry) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(input), num_idx, str_idx, entry) { if (str_idx) { ZEND_HASH_FILL_SET_STR_COPY(str_idx); } else { @@ -4169,10 +4069,10 @@ PHP_FUNCTION(array_column) zval *colval, *data, rv; zend_string *column_str = NULL; zend_long column_long; - zend_bool column_is_null = 0; + bool column_is_null = 0; zend_string *index_str = NULL; zend_long index_long; - zend_bool index_is_null = 1; + bool index_is_null = 1; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_ARRAY_HT(input) @@ -4229,7 +4129,7 @@ PHP_FUNCTION(array_reverse) *entry; /* An entry in the input array */ zend_string *string_key; zend_ulong num_key; - zend_bool preserve_keys = 0; /* whether to preserve keys */ + bool preserve_keys = 0; /* whether to preserve keys */ ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ARRAY(input) @@ -4339,7 +4239,7 @@ PHP_FUNCTION(array_pad) } } - ZEND_HASH_FOREACH_STR_KEY_VAL_IND(Z_ARRVAL_P(input), key, value) { + ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(input), key, value) { Z_TRY_ADDREF_P(value); if (key) { zend_hash_add_new(Z_ARRVAL_P(return_value), key, value); @@ -4473,7 +4373,7 @@ PHP_FUNCTION(array_unique) zend_hash_init(&seen, zend_hash_num_elements(Z_ARRVAL_P(array)), NULL, NULL, 0); array_init(return_value); - ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_key, str_key, val) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_key, str_key, val) { zval *retval; if (Z_TYPE_P(val) == IS_STRING) { retval = zend_hash_add_empty_element(&seen, Z_STR_P(val)); @@ -4512,7 +4412,6 @@ PHP_FUNCTION(array_unique) for (i = 0, idx = 0; idx < Z_ARRVAL_P(array)->nNumUsed; idx++) { p = Z_ARRVAL_P(array)->arData + idx; if (Z_TYPE(p->val) == IS_UNDEF) continue; - if (Z_TYPE(p->val) == IS_INDIRECT && Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF) continue; arTmp[i].b = *p; arTmp[i].i = i; i++; @@ -4535,11 +4434,7 @@ PHP_FUNCTION(array_unique) if (p->key == NULL) { zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); } else { - if (Z_ARRVAL_P(return_value) == &EG(symbol_table)) { - zend_delete_global_variable(p->key); - } else { - zend_hash_del(Z_ARRVAL_P(return_value), p->key); - } + zend_hash_del(Z_ARRVAL_P(return_value), p->key); } } } @@ -4580,7 +4475,7 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa int argc, i; zval *args; int (*intersect_data_compare_func)(zval *, zval *) = NULL; - zend_bool ok; + bool ok; zval *val, *data; char *param_spec; zend_string *key; @@ -4615,8 +4510,8 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa array_init(return_value); - /* Iterate over keys of the first array (handling possibility of indirects such as in $GLOBALS), to compute keys that are in all of the other arrays. */ - ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL(args[0]), h, key, val) { + /* Iterate over keys of the first array, to compute keys that are in all of the other arrays. */ + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(args[0]), h, key, val) { if (Z_ISREF_P(val) && Z_REFCOUNT_P(val) == 1) { val = Z_REFVAL_P(val); } @@ -4638,7 +4533,7 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa } else { ok = 1; for (i = 1; i < argc; i++) { - if ((data = zend_hash_find_ex_ind(Z_ARRVAL(args[i]), key, 1)) == NULL || + if ((data = zend_hash_find_ex(Z_ARRVAL(args[i]), key, 1)) == NULL || (intersect_data_compare_func && intersect_data_compare_func(val, data) != 0) ) { @@ -4959,7 +4854,7 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty int argc, i; zval *args; int (*diff_data_compare_func)(zval *, zval *) = NULL; - zend_bool ok; + bool ok; zval *val, *data; zend_string *key; zend_ulong h; @@ -4989,8 +4884,8 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty array_init(return_value); - /* Iterate over keys of the first array (handling possibility of indirects such as in $GLOBALS), to compute keys that aren't in the other arrays. */ - ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL(args[0]), h, key, val) { + /* Iterate over keys of the first array, to compute keys that aren't in the other arrays. */ + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(args[0]), h, key, val) { if (Z_ISREF_P(val) && Z_REFCOUNT_P(val) == 1) { val = Z_REFVAL_P(val); } @@ -5012,7 +4907,7 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty } else { ok = 1; for (i = 1; i < argc; i++) { - if ((data = zend_hash_find_ex_ind(Z_ARRVAL(args[i]), key, 1)) != NULL && + if ((data = zend_hash_find_ex(Z_ARRVAL(args[i]), key, 1)) != NULL && (!diff_data_compare_func || diff_data_compare_func(val, data) == 0) ) { @@ -5319,7 +5214,7 @@ PHP_FUNCTION(array_diff) zend_string *search_str, *tmp_search_str; value = NULL; - ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL(args[0]), value) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL(args[0]), value) { break; } ZEND_HASH_FOREACH_END(); @@ -5341,7 +5236,7 @@ PHP_FUNCTION(array_diff) RETURN_THROWS(); } if (!found) { - ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL(args[i]), value) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL(args[i]), value) { str = zval_get_tmp_string(value, &tmp_str); if (zend_string_equals(search_str, str)) { zend_tmp_string_release(tmp_str); @@ -5382,7 +5277,7 @@ PHP_FUNCTION(array_diff) /* create exclude map */ zend_hash_init(&exclude, num, NULL, NULL, 0); for (i = 1; i < argc; i++) { - ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL(args[i]), value) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL(args[i]), value) { str = zval_get_tmp_string(value, &tmp_str); zend_hash_add(&exclude, str, &dummy); zend_tmp_string_release(tmp_str); @@ -5391,7 +5286,7 @@ PHP_FUNCTION(array_diff) /* copy all elements of first array that are not in exclude set */ array_init_size(return_value, zend_hash_num_elements(Z_ARRVAL(args[0]))); - ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL(args[0]), idx, key, value) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(args[0]), idx, key, value) { str = zval_get_tmp_string(value, &tmp_str); if (!zend_hash_exists(&exclude, str)) { if (key) { @@ -5894,7 +5789,7 @@ PHP_FUNCTION(array_filter) zval *key; zval args[2]; zval retval; - zend_bool have_callback = 0; + bool have_callback = 0; zend_long use_type = 0; zend_string *string_key; zend_fcall_info fci = empty_fcall_info; @@ -5926,7 +5821,7 @@ PHP_FUNCTION(array_filter) } } - ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_key, string_key, operand) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_key, string_key, operand) { if (have_callback) { if (use_type) { /* Set up the key */ @@ -6011,7 +5906,7 @@ PHP_FUNCTION(array_map) array_init_size(return_value, maxlen); zend_hash_real_init(Z_ARRVAL_P(return_value), HT_FLAGS(Z_ARRVAL(arrays[0])) & HASH_FLAG_PACKED); - ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL(arrays[0]), num_key, str_key, zv) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(arrays[0]), num_key, str_key, zv) { fci.retval = &result; fci.param_count = 1; fci.params = &arg; @@ -6139,13 +6034,13 @@ PHP_FUNCTION(array_key_exists) switch (Z_TYPE_P(key)) { case IS_STRING: - RETVAL_BOOL(zend_symtable_exists_ind(ht, Z_STR_P(key))); + RETVAL_BOOL(zend_symtable_exists(ht, Z_STR_P(key))); break; case IS_LONG: RETVAL_BOOL(zend_hash_index_exists(ht, Z_LVAL_P(key))); break; case IS_NULL: - RETVAL_BOOL(zend_hash_exists_ind(ht, ZSTR_EMPTY_ALLOC())); + RETVAL_BOOL(zend_hash_exists(ht, ZSTR_EMPTY_ALLOC())); break; case IS_DOUBLE: RETVAL_BOOL(zend_hash_index_exists(ht, zend_dval_to_lval(Z_DVAL_P(key)))); @@ -6174,7 +6069,7 @@ PHP_FUNCTION(array_chunk) zend_long size, current = 0; zend_string *str_key; zend_ulong num_key; - zend_bool preserve_keys = 0; + bool preserve_keys = 0; zval *input = NULL; zval chunk; zval *entry; diff --git a/ext/standard/assert.c b/ext/standard/assert.c index 86acaec389..fae6d940ba 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -24,10 +24,10 @@ ZEND_BEGIN_MODULE_GLOBALS(assert) zval callback; char *cb; - zend_bool active; - zend_bool bail; - zend_bool warning; - zend_bool exception; + bool active; + bool bail; + bool warning; + bool exception; ZEND_END_MODULE_GLOBALS(assert) ZEND_DECLARE_MODULE_GLOBALS(assert) @@ -208,7 +208,7 @@ PHP_FUNCTION(assert_options) { zval *value = NULL; zend_long what; - zend_bool oldint; + bool oldint; int ac = ZEND_NUM_ARGS(); zend_string *key; diff --git a/ext/standard/base64.c b/ext/standard/base64.c index 2d67f88f66..234d61226f 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -243,7 +243,7 @@ static zend_always_inline size_t neon_base64_decode(const unsigned char *in, siz } #endif /* __aarch64__ */ -static zend_always_inline int php_base64_decode_impl(const unsigned char *in, size_t inl, unsigned char *out, size_t *outl, zend_bool strict) /* {{{ */ +static zend_always_inline int php_base64_decode_impl(const unsigned char *in, size_t inl, unsigned char *out, size_t *outl, bool strict) /* {{{ */ { int ch; size_t i = 0, padding = 0, j = *outl; @@ -368,23 +368,23 @@ fail: # if ZEND_INTRIN_AVX2_RESOLVER ZEND_INTRIN_AVX2_FUNC_DECL(zend_string *php_base64_encode_avx2(const unsigned char *str, size_t length)); -ZEND_INTRIN_AVX2_FUNC_DECL(zend_string *php_base64_decode_ex_avx2(const unsigned char *str, size_t length, zend_bool strict)); +ZEND_INTRIN_AVX2_FUNC_DECL(zend_string *php_base64_decode_ex_avx2(const unsigned char *str, size_t length, bool strict)); # endif # if ZEND_INTRIN_SSSE3_RESOLVER ZEND_INTRIN_SSSE3_FUNC_DECL(zend_string *php_base64_encode_ssse3(const unsigned char *str, size_t length)); -ZEND_INTRIN_SSSE3_FUNC_DECL(zend_string *php_base64_decode_ex_ssse3(const unsigned char *str, size_t length, zend_bool strict)); +ZEND_INTRIN_SSSE3_FUNC_DECL(zend_string *php_base64_decode_ex_ssse3(const unsigned char *str, size_t length, bool strict)); # endif zend_string *php_base64_encode_default(const unsigned char *str, size_t length); -zend_string *php_base64_decode_ex_default(const unsigned char *str, size_t length, zend_bool strict); +zend_string *php_base64_decode_ex_default(const unsigned char *str, size_t length, bool strict); # if (ZEND_INTRIN_AVX2_FUNC_PROTO || ZEND_INTRIN_SSSE3_FUNC_PROTO) PHPAPI zend_string *php_base64_encode(const unsigned char *str, size_t length) __attribute__((ifunc("resolve_base64_encode"))); -PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length, zend_bool strict) __attribute__((ifunc("resolve_base64_decode"))); +PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length, bool strict) __attribute__((ifunc("resolve_base64_decode"))); typedef zend_string *(*base64_encode_func_t)(const unsigned char *, size_t); -typedef zend_string *(*base64_decode_func_t)(const unsigned char *, size_t, zend_bool); +typedef zend_string *(*base64_decode_func_t)(const unsigned char *, size_t, bool); ZEND_NO_SANITIZE_ADDRESS ZEND_ATTRIBUTE_UNUSED /* clang mistakenly warns about this */ @@ -420,12 +420,12 @@ static base64_decode_func_t resolve_base64_decode() { # else /* (ZEND_INTRIN_AVX2_FUNC_PROTO || ZEND_INTRIN_SSSE3_FUNC_PROTO) */ PHPAPI zend_string *(*php_base64_encode_ptr)(const unsigned char *str, size_t length) = NULL; -PHPAPI zend_string *(*php_base64_decode_ex_ptr)(const unsigned char *str, size_t length, zend_bool strict) = NULL; +PHPAPI zend_string *(*php_base64_decode_ex_ptr)(const unsigned char *str, size_t length, bool strict) = NULL; PHPAPI zend_string *php_base64_encode(const unsigned char *str, size_t length) { return php_base64_encode_ptr(str, length); } -PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length, zend_bool strict) { +PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length, bool strict) { return php_base64_decode_ex_ptr(str, length, strict); } @@ -775,11 +775,11 @@ static __m128i php_base64_decode_ssse3_reshuffle(__m128i in) #if ZEND_INTRIN_AVX2_NATIVE || ZEND_INTRIN_AVX2_RESOLVER || ZEND_INTRIN_SSSE3_NATIVE || ZEND_INTRIN_SSSE3_RESOLVER # if ZEND_INTRIN_AVX2_NATIVE || ZEND_INTRIN_SSSE3_NATIVE -PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length, zend_bool strict) +PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length, bool strict) # elif ZEND_INTRIN_AVX2_RESOLVER -zend_string *php_base64_decode_ex_avx2(const unsigned char *str, size_t length, zend_bool strict) +zend_string *php_base64_decode_ex_avx2(const unsigned char *str, size_t length, bool strict) # else -zend_string *php_base64_decode_ex_ssse3(const unsigned char *str, size_t length, zend_bool strict) +zend_string *php_base64_decode_ex_ssse3(const unsigned char *str, size_t length, bool strict) # endif { const unsigned char *c = str; @@ -856,7 +856,7 @@ zend_string *php_base64_decode_ex_ssse3(const unsigned char *str, size_t length, } # if ZEND_INTRIN_SSSE3_RESOLVER && ZEND_INTRIN_AVX2_RESOLVER -zend_string *php_base64_decode_ex_ssse3(const unsigned char *str, size_t length, zend_bool strict) +zend_string *php_base64_decode_ex_ssse3(const unsigned char *str, size_t length, bool strict) { const unsigned char *c = str; unsigned char *o; @@ -903,9 +903,9 @@ PHPAPI zend_string *php_base64_encode(const unsigned char *str, size_t length) #if !ZEND_INTRIN_AVX2_NATIVE && !ZEND_INTRIN_SSSE3_NATIVE #if ZEND_INTRIN_AVX2_RESOLVER || ZEND_INTRIN_SSSE3_RESOLVER -zend_string *php_base64_decode_ex_default(const unsigned char *str, size_t length, zend_bool strict) +zend_string *php_base64_decode_ex_default(const unsigned char *str, size_t length, bool strict) #else -PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length, zend_bool strict) +PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length, bool strict) #endif { zend_string *result; @@ -945,7 +945,7 @@ PHP_FUNCTION(base64_encode) PHP_FUNCTION(base64_decode) { char *str; - zend_bool strict = 0; + bool strict = 0; size_t str_len; zend_string *result; diff --git a/ext/standard/base64.h b/ext/standard/base64.h index 170c0b0c61..a6ce0e22c6 100644 --- a/ext/standard/base64.h +++ b/ext/standard/base64.h @@ -62,7 +62,7 @@ PHP_MINIT_FUNCTION(base64_intrin); #endif PHPAPI extern zend_string *php_base64_encode(const unsigned char *, size_t); -PHPAPI extern zend_string *php_base64_decode_ex(const unsigned char *, size_t, zend_bool); +PHPAPI extern zend_string *php_base64_decode_ex(const unsigned char *, size_t, bool); static inline zend_string *php_base64_encode_str(const zend_string *str) { return php_base64_encode((const unsigned char*)(ZSTR_VAL(str)), ZSTR_LEN(str)); diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 876ef347eb..4084f5d853 100755 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -463,8 +463,6 @@ PHP_RINIT_FUNCTION(basic) /* {{{ */ BG(strtok_last) = NULL; BG(ctype_string) = NULL; BG(locale_changed) = 0; - BG(array_walk_fci) = empty_fcall_info; - BG(array_walk_fci_cache) = empty_fcall_info_cache; BG(user_compare_fci) = empty_fcall_info; BG(user_compare_fci_cache) = empty_fcall_info_cache; BG(page_uid) = -1; @@ -729,98 +727,98 @@ PHP_FUNCTION(long2ip) * System Functions * ********************/ -/* {{{ Get the value of an environment variable or every available environment variable - if no varname is present */ -PHP_FUNCTION(getenv) -{ - char *ptr, *str = NULL; - size_t str_len; - zend_bool local_only = 0; - - ZEND_PARSE_PARAMETERS_START(0, 2) - Z_PARAM_OPTIONAL - Z_PARAM_STRING_OR_NULL(str, str_len) - Z_PARAM_BOOL(local_only) - ZEND_PARSE_PARAMETERS_END(); - - if (!str) { - array_init(return_value); - php_import_environment_variables(return_value); - return; - } - - if (!local_only) { - /* SAPI method returns an emalloc()'d string */ - ptr = sapi_getenv(str, str_len); - if (ptr) { - // TODO: avoid reallocation ??? - RETVAL_STRING(ptr); - efree(ptr); - return; - } - } +PHPAPI zend_string *php_getenv(const char *str, size_t str_len) { #ifdef PHP_WIN32 { - wchar_t dummybuf; - DWORD size; - wchar_t *keyw, *valw; - - keyw = php_win32_cp_conv_any_to_w(str, str_len, PHP_WIN32_CP_IGNORE_LEN_P); + wchar_t *keyw = php_win32_cp_conv_any_to_w(str, str_len, PHP_WIN32_CP_IGNORE_LEN_P); if (!keyw) { - RETURN_FALSE; + return NULL; } SetLastError(0); - /*If the given buffer is not large enough to hold the data, the return value is - the buffer size, in characters, required to hold the string and its terminating - null character. We use this return value to alloc the final buffer. */ - size = GetEnvironmentVariableW(keyw, &dummybuf, 0); + /* If the given buffer is not large enough to hold the data, the return value is + * the buffer size, in characters, required to hold the string and its terminating + * null character. We use this return value to alloc the final buffer. */ + wchar_t dummybuf; + DWORD size = GetEnvironmentVariableW(keyw, &dummybuf, 0); if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) { - /* The environment variable doesn't exist. */ - free(keyw); - RETURN_FALSE; + /* The environment variable doesn't exist. */ + free(keyw); + return NULL; } if (size == 0) { - /* env exists, but it is empty */ - free(keyw); - RETURN_EMPTY_STRING(); + /* env exists, but it is empty */ + free(keyw); + return ZSTR_EMPTY_ALLOC(); } - valw = emalloc((size + 1) * sizeof(wchar_t)); + wchar_t *valw = emalloc((size + 1) * sizeof(wchar_t)); size = GetEnvironmentVariableW(keyw, valw, size); if (size == 0) { - /* has been removed between the two calls */ - free(keyw); - efree(valw); - RETURN_EMPTY_STRING(); + /* has been removed between the two calls */ + free(keyw); + efree(valw); + return ZSTR_EMPTY_ALLOC(); } else { - ptr = php_win32_cp_w_to_any(valw); - RETVAL_STRING(ptr); + char *ptr = php_win32_cp_w_to_any(valw); + zend_string *result = zend_string_init(ptr, strlen(ptr), 0); free(ptr); free(keyw); efree(valw); - return; + return result; } } #else - tsrm_env_lock(); /* system method returns a const */ - ptr = getenv(str); - + char *ptr = getenv(str); + zend_string *result = NULL; if (ptr) { - RETVAL_STRING(ptr); + result = zend_string_init(ptr, strlen(ptr), 0); } tsrm_env_unlock(); + return result; +#endif +} - if (ptr) { - return; - } +/* {{{ Get the value of an environment variable or every available environment variable + if no varname is present */ +PHP_FUNCTION(getenv) +{ + char *str = NULL; + size_t str_len; + bool local_only = 0; -#endif + ZEND_PARSE_PARAMETERS_START(0, 2) + Z_PARAM_OPTIONAL + Z_PARAM_STRING_OR_NULL(str, str_len) + Z_PARAM_BOOL(local_only) + ZEND_PARSE_PARAMETERS_END(); + + if (!str) { + array_init(return_value); + php_import_environment_variables(return_value); + return; + } + + if (!local_only) { + /* SAPI method returns an emalloc()'d string */ + char *ptr = sapi_getenv(str, str_len); + if (ptr) { + // TODO: avoid reallocation ??? + RETVAL_STRING(ptr); + efree(ptr); + return; + } + } + + zend_string *res = php_getenv(str, str_len); + if (res) { + RETURN_STR(res); + } RETURN_FALSE; } /* }}} */ @@ -1172,7 +1170,7 @@ PHP_FUNCTION(getopt) int optname_int = atoi(optname); if ((args = zend_hash_index_find(Z_ARRVAL_P(return_value), optname_int)) != NULL) { if (Z_TYPE_P(args) != IS_ARRAY) { - convert_to_array_ex(args); + convert_to_array(args); } zend_hash_next_index_insert(Z_ARRVAL_P(args), &val); } else { @@ -1182,7 +1180,7 @@ PHP_FUNCTION(getopt) /* other strings */ if ((args = zend_hash_str_find(Z_ARRVAL_P(return_value), optname, strlen(optname))) != NULL) { if (Z_TYPE_P(args) != IS_ARRAY) { - convert_to_array_ex(args); + convert_to_array(args); } zend_hash_next_index_insert(Z_ARRVAL_P(args), &val); } else { @@ -1472,7 +1470,7 @@ PHPAPI int _php_error_log_ex(int opt_err, const char *message, size_t message_le return FAILURE; case 3: /*save to a file */ - stream = php_stream_open_wrapper(opt, "a", IGNORE_URL_WIN | REPORT_ERRORS, NULL); + stream = php_stream_open_wrapper(opt, "a", REPORT_ERRORS, NULL); if (!stream) { return FAILURE; } @@ -1809,7 +1807,7 @@ PHP_FUNCTION(register_shutdown_function) } /* }}} */ -PHPAPI zend_bool register_user_shutdown_function(const char *function_name, size_t function_len, php_shutdown_function_entry *shutdown_function_entry) /* {{{ */ +PHPAPI bool register_user_shutdown_function(const char *function_name, size_t function_len, php_shutdown_function_entry *shutdown_function_entry) /* {{{ */ { if (!BG(user_shutdown_function_names)) { ALLOC_HASHTABLE(BG(user_shutdown_function_names)); @@ -1821,7 +1819,7 @@ PHPAPI zend_bool register_user_shutdown_function(const char *function_name, size } /* }}} */ -PHPAPI zend_bool remove_user_shutdown_function(const char *function_name, size_t function_len) /* {{{ */ +PHPAPI bool remove_user_shutdown_function(const char *function_name, size_t function_len) /* {{{ */ { if (BG(user_shutdown_function_names)) { return zend_hash_str_del(BG(user_shutdown_function_names), function_name, function_len) != FAILURE; @@ -1831,7 +1829,7 @@ PHPAPI zend_bool remove_user_shutdown_function(const char *function_name, size_t } /* }}} */ -PHPAPI zend_bool append_user_shutdown_function(php_shutdown_function_entry *shutdown_function_entry) /* {{{ */ +PHPAPI bool append_user_shutdown_function(php_shutdown_function_entry *shutdown_function_entry) /* {{{ */ { if (!BG(user_shutdown_function_names)) { ALLOC_HASHTABLE(BG(user_shutdown_function_names)); @@ -1859,7 +1857,7 @@ PHP_FUNCTION(highlight_file) size_t filename_len; int ret; zend_syntax_highlighter_ini syntax_highlighter_ini; - zend_bool i = 0; + bool i = 0; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_PATH(filename, filename_len) @@ -1934,7 +1932,7 @@ PHP_FUNCTION(highlight_string) zend_string *str; zend_syntax_highlighter_ini syntax_highlighter_ini; char *hicompiled_string_description; - zend_bool i = 0; + bool i = 0; int old_error_reporting = EG(error_reporting); ZEND_PARSE_PARAMETERS_START(1, 2) @@ -1953,12 +1951,8 @@ PHP_FUNCTION(highlight_string) hicompiled_string_description = zend_make_compiled_string_description("highlighted code"); - // TODO: Accept zend_string in highlight_string API. - zval str_zv; - ZVAL_STR_COPY(&str_zv, str); - highlight_string(&str_zv, &syntax_highlighter_ini, hicompiled_string_description); + highlight_string(str, &syntax_highlighter_ini, hicompiled_string_description); efree(hicompiled_string_description); - zval_ptr_dtor(&str_zv); EG(error_reporting) = old_error_reporting; @@ -2013,7 +2007,7 @@ PHP_FUNCTION(ini_get_all) char *extname = NULL; size_t extname_len = 0, module_number = 0; zend_module_entry *module; - zend_bool details = 1; + bool details = 1; zend_string *key; zend_ini_entry *ini_entry; @@ -2092,14 +2086,19 @@ static int php_ini_check_path(char *option_name, size_t option_len, char *new_op PHP_FUNCTION(ini_set) { zend_string *varname; - zend_string *new_value; + zval *new_value; zend_string *val; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(varname) - Z_PARAM_STR(new_value) + Z_PARAM_ZVAL(new_value) ZEND_PARSE_PARAMETERS_END(); + if (Z_TYPE_P(new_value) > IS_STRING) { + zend_argument_type_error(2, "must be of type string|int|float|bool|null"); + RETURN_THROWS(); + } + val = zend_ini_get_value(varname); if (val) { @@ -2108,6 +2107,9 @@ PHP_FUNCTION(ini_set) RETVAL_FALSE; } + zend_string *new_value_tmp_str; + zend_string *new_value_str = zval_get_tmp_string(new_value, &new_value_tmp_str); + #define _CHECK_PATH(var, var_len, ini) php_ini_check_path(var, var_len, ini, sizeof(ini)) /* open basedir check */ if (PG(open_basedir)) { @@ -2117,18 +2119,20 @@ PHP_FUNCTION(ini_set) _CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "mail.log") || _CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "java.library.path") || _CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "vpopmail.directory")) { - if (php_check_open_basedir(ZSTR_VAL(new_value))) { + if (php_check_open_basedir(ZSTR_VAL(new_value_str))) { zval_ptr_dtor_str(return_value); + zend_tmp_string_release(new_value_tmp_str); RETURN_FALSE; } } } #undef _CHECK_PATH - if (zend_alter_ini_entry_ex(varname, new_value, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0) == FAILURE) { + if (zend_alter_ini_entry_ex(varname, new_value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0) == FAILURE) { zval_ptr_dtor_str(return_value); - RETURN_FALSE; + RETVAL_FALSE; } + zend_tmp_string_release(new_value_tmp_str); } /* }}} */ @@ -2197,7 +2201,7 @@ PHP_FUNCTION(get_include_path) PHP_FUNCTION(print_r) { zval *var; - zend_bool do_return = 0; + bool do_return = 0; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_ZVAL(var) @@ -2235,8 +2239,8 @@ PHP_FUNCTION(connection_status) /* {{{ Set whether we want to ignore a user abort event or not */ PHP_FUNCTION(ignore_user_abort) { - zend_bool arg = 0; - zend_bool arg_is_null = 1; + bool arg = 0; + bool arg_is_null = 1; int old_setting; ZEND_PARSE_PARAMETERS_START(0, 1) @@ -2399,7 +2403,7 @@ PHP_FUNCTION(register_tick_function) } if (Z_TYPE(tick_fe.arguments[0]) != IS_ARRAY && Z_TYPE(tick_fe.arguments[0]) != IS_OBJECT) { - convert_to_string_ex(&tick_fe.arguments[0]); + convert_to_string(&tick_fe.arguments[0]); } if (!BG(user_tick_functions)) { @@ -2470,7 +2474,7 @@ PHP_FUNCTION(move_uploaded_file) { char *path, *new_path; size_t path_len, new_path_len; - zend_bool successful = 0; + bool successful = 0; #ifndef PHP_WIN32 int oldmask; int ret; @@ -2601,7 +2605,7 @@ PHP_FUNCTION(parse_ini_file) { char *filename = NULL; size_t filename_len = 0; - zend_bool process_sections = 0; + bool process_sections = 0; zend_long scanner_mode = ZEND_INI_SCANNER_NORMAL; zend_file_handle fh; zend_ini_parser_cb_t ini_parser_cb; @@ -2642,7 +2646,7 @@ PHP_FUNCTION(parse_ini_string) { char *string = NULL, *str = NULL; size_t str_len = 0; - zend_bool process_sections = 0; + bool process_sections = 0; zend_long scanner_mode = ZEND_INI_SCANNER_NORMAL; zend_ini_parser_cb_t ini_parser_cb; diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h index 97faf50fd9..5971ffd2ab 100644 --- a/ext/standard/basic_functions.h +++ b/ext/standard/basic_functions.h @@ -49,7 +49,7 @@ PHP_RSHUTDOWN_FUNCTION(browscap); /* Left for BC (not binary safe!) */ PHPAPI int _php_error_log(int opt_err, const char *message, const char *opt, const char *headers); PHPAPI int _php_error_log_ex(int opt_err, const char *message, size_t message_len, const char *opt, const char *headers); -PHPAPI int php_prefix_varname(zval *result, zend_string *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, bool add_underscore); #define MT_N (624) @@ -62,12 +62,10 @@ typedef struct _php_basic_globals { HashTable putenv_ht; zend_string *strtok_string; zend_string *ctype_string; /* current LC_CTYPE locale (or NULL for 'C') */ - zend_bool locale_changed; /* locale was changed and has to be restored */ + bool locale_changed; /* locale was changed and has to be restored */ char *strtok_last; char strtok_table[256]; size_t strtok_len; - zend_fcall_info array_walk_fci; - zend_fcall_info_cache array_walk_fci_cache; zend_fcall_info user_compare_fci; zend_fcall_info_cache user_compare_fci_cache; zend_llist *user_tick_functions; @@ -89,7 +87,7 @@ typedef struct _php_basic_globals { uint32_t *next; /* next random value is computed from here */ int left; /* can *next++ this many times before reloading */ - zend_bool mt_rand_is_seeded; /* Whether mt_rand() has been seeded */ + bool mt_rand_is_seeded; /* Whether mt_rand() has been seeded */ zend_long mt_rand_mode; /* syslog.c */ @@ -139,6 +137,8 @@ typedef struct { } putenv_entry; #endif +PHPAPI zend_string *php_getenv(const char *str, size_t str_len); + PHPAPI double php_get_nan(void); PHPAPI double php_get_inf(void); @@ -148,9 +148,9 @@ typedef struct _php_shutdown_function_entry { int arg_count; } php_shutdown_function_entry; -PHPAPI extern zend_bool register_user_shutdown_function(const char *function_name, size_t function_len, php_shutdown_function_entry *shutdown_function_entry); -PHPAPI extern zend_bool remove_user_shutdown_function(const char *function_name, size_t function_len); -PHPAPI extern zend_bool append_user_shutdown_function(php_shutdown_function_entry *shutdown_function_entry); +PHPAPI extern bool register_user_shutdown_function(const char *function_name, size_t function_len, php_shutdown_function_entry *shutdown_function_entry); +PHPAPI extern bool remove_user_shutdown_function(const char *function_name, size_t function_len); +PHPAPI extern bool append_user_shutdown_function(php_shutdown_function_entry *shutdown_function_entry); PHPAPI void php_call_shutdown_functions(void); PHPAPI void php_free_shutdown_functions(void); diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index e83c89d4bf..3a7e0de174 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -248,6 +248,8 @@ function array_chunk(array $array, int $length, bool $preserve_keys = false): ar function array_combine(array $keys, array $values): array {} +function array_is_list(array $array): bool {} + /* base64.c */ function base64_encode(string $string): string {} @@ -316,7 +318,7 @@ function ini_get(string $option): string|false {} function ini_get_all(?string $extension = null, bool $details = true): array|false {} -function ini_set(string $option, string $value): string|false {} +function ini_set(string $option, string|int|float|bool|null $value): string|false {} /** @alias ini_set */ function ini_alter(string $option, string $value): string|false {} @@ -512,15 +514,15 @@ function headers_list(): array {} /* {{{ html.c */ -function htmlspecialchars(string $string, int $flags = ENT_COMPAT, ?string $encoding = null, bool $double_encode = true): string {} +function htmlspecialchars(string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE, ?string $encoding = null, bool $double_encode = true): string {} -function htmlspecialchars_decode(string $string, int $flags = ENT_COMPAT): string {} +function htmlspecialchars_decode(string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE): string {} -function html_entity_decode(string $string, int $flags = ENT_COMPAT, ?string $encoding = null): string {} +function html_entity_decode(string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE, ?string $encoding = null): string {} -function htmlentities(string $string, int $flags = ENT_COMPAT, ?string $encoding = null, bool $double_encode = true): string {} +function htmlentities(string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE, ?string $encoding = null, bool $double_encode = true): string {} -function get_html_translation_table(int $table = HTML_SPECIALCHARS, int $flags = ENT_COMPAT, string $encoding = "UTF-8"): array {} +function get_html_translation_table(int $table = HTML_SPECIALCHARS, int $flags = ENT_QUOTES | ENT_SUBSTITUTE, string $encoding = "UTF-8"): array {} /* }}} */ diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index 801fb2bcb1..1c7f6b00ec 100644 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 39cd1ddd82efd6b62605218faff8b720d8b97170 */ + * Stub hash: e9f39cbc595f0f2cdd84e58d4857f9fdb03ff7b7 */ 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) @@ -360,6 +360,10 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_combine, 0, 2, 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_array_is_list, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, array, 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, string, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -487,10 +491,13 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ini_set, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0) + ZEND_ARG_TYPE_MASK(0, value, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_BOOL|MAY_BE_NULL, NULL) ZEND_END_ARG_INFO() -#define arginfo_ini_alter arginfo_ini_set +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ini_alter, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, option, 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_ini_restore, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0) @@ -765,19 +772,19 @@ ZEND_END_ARG_INFO() 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_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "ENT_COMPAT") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "ENT_QUOTES | ENT_SUBSTITUTE") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, double_encode, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_htmlspecialchars_decode, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "ENT_COMPAT") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "ENT_QUOTES | ENT_SUBSTITUTE") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_html_entity_decode, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "ENT_COMPAT") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "ENT_QUOTES | ENT_SUBSTITUTE") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") ZEND_END_ARG_INFO() @@ -785,7 +792,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_html_translation_table, 0, 0, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, table, IS_LONG, 0, "HTML_SPECIALCHARS") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "ENT_COMPAT") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "ENT_QUOTES | ENT_SUBSTITUTE") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 0, "\"UTF-8\"") ZEND_END_ARG_INFO() @@ -2309,6 +2316,7 @@ ZEND_FUNCTION(array_map); ZEND_FUNCTION(array_key_exists); ZEND_FUNCTION(array_chunk); ZEND_FUNCTION(array_combine); +ZEND_FUNCTION(array_is_list); ZEND_FUNCTION(base64_encode); ZEND_FUNCTION(base64_decode); ZEND_FUNCTION(constant); @@ -2933,6 +2941,7 @@ static const zend_function_entry ext_functions[] = { ZEND_FALIAS(key_exists, array_key_exists, arginfo_key_exists) ZEND_FE(array_chunk, arginfo_array_chunk) ZEND_FE(array_combine, arginfo_array_combine) + ZEND_FE(array_is_list, arginfo_array_is_list) ZEND_FE(base64_encode, arginfo_base64_encode) ZEND_FE(base64_decode, arginfo_base64_decode) ZEND_FE(constant, arginfo_constant) diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index f4e38c5860..e5a565798b 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -85,7 +85,7 @@ static void browscap_entry_dtor_persistent(zval *zvalue) pefree(entry, 1); } -static inline zend_bool is_placeholder(char c) { +static inline bool is_placeholder(char c) { return c == '?' || c == '*'; } @@ -221,7 +221,7 @@ typedef struct _browscap_parser_ctx { } browscap_parser_ctx; static zend_string *browscap_intern_str( - browscap_parser_ctx *ctx, zend_string *str, zend_bool persistent) { + browscap_parser_ctx *ctx, zend_string *str, bool persistent) { zend_string *interned = zend_hash_find_ptr(&ctx->str_interned, str); if (interned) { zend_string_addref(interned); @@ -237,7 +237,7 @@ static zend_string *browscap_intern_str( } static zend_string *browscap_intern_str_ci( - browscap_parser_ctx *ctx, zend_string *str, zend_bool persistent) { + browscap_parser_ctx *ctx, zend_string *str, bool persistent) { zend_string *lcname; zend_string *interned; ALLOCA_FLAG(use_heap); @@ -261,7 +261,7 @@ static zend_string *browscap_intern_str_ci( } static void browscap_add_kv( - browser_data *bdata, zend_string *key, zend_string *value, zend_bool persistent) { + browser_data *bdata, zend_string *key, zend_string *value, bool persistent) { if (bdata->kv_used == bdata->kv_size) { bdata->kv_size *= 2; bdata->kv = safe_perealloc(bdata->kv, sizeof(browscap_kv), bdata->kv_size, 0, persistent); @@ -679,14 +679,14 @@ static void browscap_zval_copy_ctor(zval *p) /* {{{ */ PHP_FUNCTION(get_browser) { zend_string *agent_name = NULL, *lookup_browser_name; - zend_bool return_array = 0; + bool return_array = 0; browser_data *bdata; browscap_entry *found_entry = NULL; HashTable *agent_ht; ZEND_PARSE_PARAMETERS_START(0, 2) Z_PARAM_OPTIONAL - Z_PARAM_STR_EX(agent_name, 1, 0) + Z_PARAM_STR_OR_NULL(agent_name) Z_PARAM_BOOL(return_array) ZEND_PARSE_PARAMETERS_END(); diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index 301540db58..d04add9629 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -390,34 +390,13 @@ dnl Check for argon2 dnl PHP_ARG_WITH([password-argon2], [for Argon2 support], - [AS_HELP_STRING([[--with-password-argon2[=DIR]]], - [Include Argon2 support in password_*. DIR is the Argon2 shared library - path])]) + [AS_HELP_STRING([[--with-password-argon2]], + [Include Argon2 support in password_*])]) if test "$PHP_PASSWORD_ARGON2" != "no"; then - AC_MSG_CHECKING([for Argon2 library]) - for i in $PHP_PASSWORD_ARGON2 /usr /usr/local ; do - if test -r $i/include/argon2.h; then - ARGON2_DIR=$i; - AC_MSG_RESULT(found in $i) - break - fi - done - - if test -z "$ARGON2_DIR"; then - AC_MSG_RESULT([not found]) - AC_MSG_ERROR([Please ensure the argon2 header and library are installed]) - fi - - PHP_ADD_LIBRARY_WITH_PATH(argon2, $ARGON2_DIR/$PHP_LIBDIR) - PHP_ADD_INCLUDE($ARGON2_DIR/include) - - AC_CHECK_LIB(argon2, argon2id_hash_raw, [ - LIBS="$LIBS -largon2" - AC_DEFINE(HAVE_ARGON2LIB, 1, [ Define to 1 if you have the <argon2.h> header file ]) - ], [ - AC_MSG_ERROR([Problem with libargon2.(a|so). Please verify that Argon2 header and libraries >= 20161029 are installed]) - ]) + PKG_CHECK_MODULES([ARGON2], [libargon2]) + PHP_EVAL_INCLINE($ARGON2_CFLAGS) + PHP_EVAL_LIBLINE($ARGON2_LIBS) fi dnl diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 8c105cf910..b3055bacd4 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -79,7 +79,7 @@ PHP_MSHUTDOWN_FUNCTION(crypt) /* {{{ */ } /* }}} */ -PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const char *salt, int salt_len, zend_bool quiet) +PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const char *salt, int salt_len, bool quiet) { char *crypt_res; zend_string *result; diff --git a/ext/standard/crypt_sha256.c b/ext/standard/crypt_sha256.c index f64cf00868..4ba4f6c3dd 100644 --- a/ext/standard/crypt_sha256.c +++ b/ext/standard/crypt_sha256.c @@ -344,7 +344,7 @@ char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int b char *s_bytes; /* Default number of rounds. */ size_t rounds = ROUNDS_DEFAULT; - zend_bool rounds_custom = 0; + bool rounds_custom = 0; /* Find beginning of salt string. The prefix should normally always be present. Just in case it is not. */ diff --git a/ext/standard/crypt_sha512.c b/ext/standard/crypt_sha512.c index 94dc772fd9..f896dad5a8 100644 --- a/ext/standard/crypt_sha512.c +++ b/ext/standard/crypt_sha512.c @@ -377,7 +377,7 @@ php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen) char *s_bytes; /* Default number of rounds. */ size_t rounds = ROUNDS_DEFAULT; - zend_bool rounds_custom = 0; + bool rounds_custom = 0; /* Find beginning of salt string. The prefix should normally always be present. Just in case it is not. */ diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 6807c534ba..e2b6f5bb3d 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -408,7 +408,7 @@ PHP_FUNCTION(glob) glob_t globbuf; size_t n; int ret; - zend_bool basedir_limit = 0; + bool basedir_limit = 0; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_PATH(pattern, pattern_len) diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 41b98424ed..105e0f0f26 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -811,7 +811,7 @@ PHP_FUNCTION(dns_get_record) u_char *cp = NULL, *end = NULL; int n, qd, an, ns = 0, ar = 0; int type, first_query = 1, store_results = 1; - zend_bool raw = 0; + bool raw = 0; ZEND_PARSE_PARAMETERS_START(1, 5) Z_PARAM_STRING(hostname, hostname_len) diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c index afeab23a08..afd6b7eab6 100644 --- a/ext/standard/dns_win32.c +++ b/ext/standard/dns_win32.c @@ -351,7 +351,7 @@ PHP_FUNCTION(dns_get_record) zend_long type_param = PHP_DNS_ANY; zval *authns = NULL, *addtl = NULL; int type, type_to_fetch, first_query = 1, store_results = 1; - zend_bool raw = 0; + bool raw = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lz!z!b", &hostname, &hostname_len, &type_param, &authns, &addtl, &raw) == FAILURE) { diff --git a/ext/standard/file.c b/ext/standard/file.c index adca64eecb..f2859f5477 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -379,7 +379,7 @@ PHP_FUNCTION(get_meta_tags) { char *filename; size_t filename_len; - zend_bool use_include_path = 0; + bool use_include_path = 0; int in_tag = 0, done = 0; int looking_for_val = 0, have_name = 0, have_content = 0; int saw_name = 0, saw_content = 0; @@ -523,11 +523,11 @@ PHP_FUNCTION(file_get_contents) { char *filename; size_t filename_len; - zend_bool use_include_path = 0; + bool use_include_path = 0; php_stream *stream; zend_long offset = 0; zend_long maxlen; - zend_bool maxlen_is_null = 1; + bool maxlen_is_null = 1; zval *zcontext = NULL; php_stream_context *context = NULL; zend_string *contents; @@ -650,7 +650,7 @@ PHP_FUNCTION(file_put_contents) case IS_DOUBLE: case IS_FALSE: case IS_TRUE: - convert_to_string_ex(data); + convert_to_string(data); case IS_STRING: if (Z_STRLEN_P(data)) { @@ -724,9 +724,9 @@ PHP_FUNCTION(file) register int i = 0; char eol_marker = '\n'; zend_long flags = 0; - zend_bool use_include_path; - zend_bool include_new_line; - zend_bool skip_blank_lines; + bool use_include_path; + bool include_new_line; + bool skip_blank_lines; php_stream *stream; zval *zcontext = NULL; php_stream_context *context = NULL; @@ -861,7 +861,7 @@ PHP_FUNCTION(fopen) { char *filename, *mode; size_t filename_len, mode_len; - zend_bool use_include_path = 0; + bool use_include_path = 0; zval *zcontext = NULL; php_stream *stream; php_stream_context *context = NULL; @@ -1010,7 +1010,7 @@ PHPAPI PHP_FUNCTION(fgets) { zval *res; zend_long len = 1024; - zend_bool len_is_null = 1; + bool len_is_null = 1; char *buf = NULL; size_t line_len = 0; zend_string *str; @@ -1133,7 +1133,7 @@ PHPAPI PHP_FUNCTION(fwrite) ssize_t ret; size_t num_bytes; zend_long maxlen = 0; - zend_bool maxlen_is_null = 1; + bool maxlen_is_null = 1; php_stream *stream; ZEND_PARSE_PARAMETERS_START(2, 3) @@ -1278,7 +1278,7 @@ PHP_FUNCTION(mkdir) size_t dir_len; zval *zcontext = NULL; zend_long mode = 0777; - zend_bool recursive = 0; + bool recursive = 0; php_stream_context *context; ZEND_PARSE_PARAMETERS_START(1, 4) @@ -1321,7 +1321,7 @@ PHP_FUNCTION(readfile) char *filename; size_t filename_len; size_t size = 0; - zend_bool use_include_path = 0; + bool use_include_path = 0; zval *zcontext = NULL; php_stream *stream; php_stream_context *context = NULL; @@ -1350,7 +1350,7 @@ PHP_FUNCTION(readfile) PHP_FUNCTION(umask) { zend_long mask = 0; - zend_bool mask_is_null = 1; + bool mask_is_null = 1; int oldumask; ZEND_PARSE_PARAMETERS_START(0, 1) @@ -1923,7 +1923,7 @@ PHP_FUNCTION(fgetcsv) { zval *fd; - zend_bool len_is_null = 1; + bool len_is_null = 1; char *delimiter_str = NULL; size_t delimiter_str_len = 0; char *enclosure_str = NULL; @@ -2005,7 +2005,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, int char *temp, *tptr, *bptr, *line_end, *limit; size_t temp_len, line_end_len; int inc_len; - zend_bool first_field = 1; + bool first_field = 1; ZEND_ASSERT((escape_char >= 0 && escape_char <= UCHAR_MAX) || escape_char == PHP_CSV_NO_ESCAPE); diff --git a/ext/standard/file.h b/ext/standard/file.h index c51a953086..f9d153a52a 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -86,7 +86,7 @@ php_meta_tags_token php_next_meta_token(php_meta_tags_data *); typedef struct { int pclose_ret; size_t def_chunk_size; - zend_bool auto_detect_line_endings; + bool auto_detect_line_endings; zend_long default_socket_timeout; char *user_agent; /* for the http wrapper */ char *from_address; /* for the ftp and http wrappers */ diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 303e919c19..0f39116676 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -594,7 +594,7 @@ PHP_FUNCTION(touch) char *filename; size_t filename_len; zend_long filetime = 0, fileatime = 0; - zend_bool filetime_is_null = 1, fileatime_is_null = 1; + bool filetime_is_null = 1, fileatime_is_null = 1; int ret; FILE *file; struct utimbuf newtimebuf; @@ -674,7 +674,7 @@ PHP_FUNCTION(touch) #endif /* {{{ php_clear_stat_cache() */ -PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, size_t filename_len) +PHPAPI void php_clear_stat_cache(bool clear_realpath_cache, const char *filename, size_t filename_len) { /* always clear CurrentStatFile and CurrentLStatFile even if filename is not NULL * as it may contain outdated data (e.g. "nlink" for a directory when deleting a file @@ -700,7 +700,7 @@ PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *fil /* {{{ Clear file stat cache */ PHP_FUNCTION(clearstatcache) { - zend_bool clear_realpath_cache = 0; + bool clear_realpath_cache = 0; char *filename = NULL; size_t filename_len = 0; diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index a9c3cb0bf5..a4c5d6fe66 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -32,7 +32,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) zend_long port = -1; zval *zerrno = NULL, *zerrstr = NULL; double timeout; - zend_bool timeout_is_null = 1; + bool timeout_is_null = 1; #ifndef PHP_WIN32 time_t conv; #else diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index 4dd38c4cba..896473b2d4 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -415,7 +415,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa php_stream *reuseid=NULL; size_t file_size = 0; zval *tmpzval; - zend_bool allow_overwrite = 0; + bool allow_overwrite = 0; int8_t read_write = 0; char *transport; int transport_len; diff --git a/ext/standard/head.c b/ext/standard/head.c index 36f64fcb4d..19ed36c52c 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -31,7 +31,7 @@ /* {{{ Sends a raw HTTP header */ PHP_FUNCTION(header) { - zend_bool rep = 1; + bool rep = 1; sapi_header_line ctr = {0}; char *line; size_t len; @@ -193,7 +193,7 @@ PHPAPI zend_result php_setcookie(zend_string *name, zend_string *value, time_t e } static zend_result php_head_parse_cookie_options_array(HashTable *options, zend_long *expires, zend_string **path, - zend_string **domain, zend_bool *secure, zend_bool *httponly, zend_string **samesite) + zend_string **domain, bool *secure, bool *httponly, zend_string **samesite) { zend_string *key; zval *value; @@ -228,7 +228,7 @@ static void php_setcookie_common(INTERNAL_FUNCTION_PARAMETERS, bool is_raw) HashTable *options = NULL; zend_long expires = 0; zend_string *name, *value = NULL, *path = NULL, *domain = NULL, *samesite = NULL; - zend_bool secure = 0, httponly = 0; + bool secure = 0, httponly = 0; ZEND_PARSE_PARAMETERS_START(1, 7) Z_PARAM_STR(name) diff --git a/ext/standard/hrtime.c b/ext/standard/hrtime.c index 29a1132209..20604baa1d 100644 --- a/ext/standard/hrtime.c +++ b/ext/standard/hrtime.c @@ -34,12 +34,6 @@ static double _timer_scale = .0; -#elif PHP_HRTIME_PLATFORM_APPLE - -# include <mach/mach_time.h> -# include <string.h> -static mach_timebase_info_data_t _timerlib_info; - #elif PHP_HRTIME_PLATFORM_HPUX # include <sys/time.h> @@ -66,9 +60,7 @@ static int _timer_init() #elif PHP_HRTIME_PLATFORM_APPLE - if (mach_timebase_info(&_timerlib_info)) { - return -1; - } + /* pass */ #elif PHP_HRTIME_PLATFORM_POSIX @@ -115,7 +107,8 @@ static zend_always_inline php_hrtime_t _timer_current(void) QueryPerformanceCounter(<); return (php_hrtime_t)((php_hrtime_t)lt.QuadPart * _timer_scale); #elif PHP_HRTIME_PLATFORM_APPLE - return (php_hrtime_t)mach_absolute_time() * _timerlib_info.numer / _timerlib_info.denom; + /* the value is of php_hrtime_t type already */ + return clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW); #elif PHP_HRTIME_PLATFORM_POSIX struct timespec ts = { .tv_sec = 0, .tv_nsec = 0 }; if (0 == clock_gettime(CLOCK_MONOTONIC, &ts)) { @@ -163,7 +156,7 @@ static zend_always_inline php_hrtime_t _timer_current(void) PHP_FUNCTION(hrtime) { #if HRTIME_AVAILABLE - zend_bool get_as_num = 0; + bool get_as_num = 0; php_hrtime_t t = _timer_current(); ZEND_PARSE_PARAMETERS_START(0, 1) diff --git a/ext/standard/html.c b/ext/standard/html.c index c949e058c1..b5e2cc4e66 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -365,7 +365,7 @@ static inline unsigned int get_next_char( /* {{{ entity_charset determine_charset * Returns the charset identifier based on an explicitly provided charset, * the internal_encoding and default_charset ini settings, or UTF-8 by default. */ -static enum entity_charset determine_charset(const char *charset_hint, zend_bool quiet) +static enum entity_charset determine_charset(const char *charset_hint, bool quiet) { if (!charset_hint || !*charset_hint) { charset_hint = get_default_charset(); @@ -1100,7 +1100,7 @@ static inline void find_entity_for_char_basic( /* }}} */ /* {{{ php_escape_html_entities */ -PHPAPI zend_string *php_escape_html_entities_ex(const unsigned char *old, size_t oldlen, int all, int flags, const char *hint_charset, zend_bool double_encode, zend_bool quiet) +PHPAPI zend_string *php_escape_html_entities_ex(const unsigned char *old, size_t oldlen, int all, int flags, const char *hint_charset, bool double_encode, bool quiet) { size_t cursor, maxlen, len; zend_string *replaced; @@ -1316,15 +1316,15 @@ encode_amp: static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) { zend_string *str, *hint_charset = NULL; - zend_long flags = ENT_COMPAT; + zend_long flags = ENT_QUOTES|ENT_SUBSTITUTE; zend_string *replaced; - zend_bool double_encode = 1; + bool double_encode = 1; ZEND_PARSE_PARAMETERS_START(1, 4) Z_PARAM_STR(str) Z_PARAM_OPTIONAL Z_PARAM_LONG(flags) - Z_PARAM_STR_EX(hint_charset, 1, 0) + Z_PARAM_STR_OR_NULL(hint_charset) Z_PARAM_BOOL(double_encode); ZEND_PARSE_PARAMETERS_END(); @@ -1367,7 +1367,7 @@ PHP_FUNCTION(htmlspecialchars) PHP_FUNCTION(htmlspecialchars_decode) { zend_string *str; - zend_long quote_style = ENT_COMPAT; + zend_long quote_style = ENT_QUOTES|ENT_SUBSTITUTE; zend_string *replaced; ZEND_PARSE_PARAMETERS_START(1, 2) @@ -1385,7 +1385,7 @@ PHP_FUNCTION(htmlspecialchars_decode) PHP_FUNCTION(html_entity_decode) { zend_string *str, *hint_charset = NULL; - zend_long quote_style = ENT_COMPAT; + zend_long quote_style = ENT_QUOTES|ENT_SUBSTITUTE; zend_string *replaced; ZEND_PARSE_PARAMETERS_START(1, 3) @@ -1468,7 +1468,7 @@ static inline void write_s3row_data( PHP_FUNCTION(get_html_translation_table) { zend_long all = HTML_SPECIALCHARS, - flags = ENT_COMPAT; + flags = ENT_QUOTES|ENT_SUBSTITUTE; int doctype; entity_table_opt entity_table; const enc_to_uni *to_uni_table = NULL; diff --git a/ext/standard/html.h b/ext/standard/html.h index 3aee85cd87..63067e72ee 100644 --- a/ext/standard/html.h +++ b/ext/standard/html.h @@ -45,7 +45,7 @@ void register_html_constants(INIT_FUNC_ARGS); PHPAPI zend_string *php_escape_html_entities(const unsigned char *old, size_t oldlen, int all, int flags, const char *hint_charset); -PHPAPI zend_string *php_escape_html_entities_ex(const unsigned char *old, size_t oldlen, int all, int flags, const char *hint_charset, zend_bool double_encode, zend_bool quiet); +PHPAPI zend_string *php_escape_html_entities_ex(const unsigned char *old, size_t oldlen, int all, int flags, const char *hint_charset, bool double_encode, bool quiet); PHPAPI zend_string *php_unescape_html_entities(zend_string *str, int all, int flags, const char *hint_charset); PHPAPI unsigned int php_next_utf8_char(const unsigned char *str, size_t str_len, size_t *cursor, int *status); diff --git a/ext/standard/http.c b/ext/standard/http.c index 18b7c6070b..b9a1605e7e 100644 --- a/ext/standard/http.c +++ b/ext/standard/http.c @@ -49,7 +49,7 @@ PHPAPI void php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, arg_sep_len = strlen(arg_sep); ZEND_HASH_FOREACH_KEY_VAL(ht, idx, key, zdata) { - zend_bool is_dynamic = 1; + bool is_dynamic = 1; if (Z_TYPE_P(zdata) == IS_INDIRECT) { zdata = Z_INDIRECT_P(zdata); if (Z_ISUNDEF_P(zdata)) { diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index d865d7e2f9..4a1d2dd581 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -103,7 +103,7 @@ static inline void strip_header(char *header_bag, char *lc_header_bag, } } -static zend_bool check_has_header(const char *headers, const char *header) { +static bool check_has_header(const char *headers, const char *header) { const char *s = headers; while ((s = strstr(s, header))) { if (s == headers || *(s-1) == '\n') { @@ -136,16 +136,16 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, zend_string *errstr = NULL; size_t transport_len; int have_header = 0; - zend_bool request_fulluri = 0, ignore_errors = 0; + bool request_fulluri = 0, ignore_errors = 0; struct timeval timeout; char *user_headers = NULL; int header_init = ((flags & HTTP_WRAPPER_HEADER_INIT) != 0); int redirected = ((flags & HTTP_WRAPPER_REDIRECTED) != 0); - zend_bool follow_location = 1; + bool follow_location = 1; php_stream_filter *transfer_encoding = NULL; int response_code; smart_str req_buf = {0}; - zend_bool custom_request_method; + bool custom_request_method; tmp_line[0] = '\0'; diff --git a/ext/standard/image.c b/ext/standard/image.c index f34f14a7aa..2154f8e322 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -1207,7 +1207,7 @@ PHP_FUNCTION(image_type_to_mime_type) PHP_FUNCTION(image_type_to_extension) { zend_long image_type; - zend_bool inc_dot=1; + bool inc_dot=1; const char *imgext = NULL; ZEND_PARSE_PARAMETERS_START(1, 2) @@ -1465,17 +1465,16 @@ static void php_getimagesize_from_stream(php_stream *stream, char *input, zval * static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) { /* {{{ */ zval *info = NULL; php_stream *stream = NULL; - char *input; - size_t input_len; + zend_string *input; const int argc = ZEND_NUM_ARGS(); ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STRING(input, input_len) + Z_PARAM_STR(input) Z_PARAM_OPTIONAL Z_PARAM_ZVAL(info) ZEND_PARSE_PARAMETERS_END(); - if (mode == FROM_PATH && CHECK_NULL_PATH(input, input_len)) { + if (mode == FROM_PATH && CHECK_NULL_PATH(ZSTR_VAL(input), ZSTR_LEN(input))) { zend_argument_value_error(1, "must not contain any null bytes"); RETURN_THROWS(); } @@ -1488,16 +1487,16 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) { } if (mode == FROM_PATH) { - stream = php_stream_open_wrapper(input, "rb", STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH, NULL); + stream = php_stream_open_wrapper(ZSTR_VAL(input), "rb", STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH, NULL); } else { - stream = php_stream_memory_open(TEMP_STREAM_READONLY, input, input_len); + stream = php_stream_memory_open(TEMP_STREAM_READONLY, input); } if (!stream) { RETURN_FALSE; } - php_getimagesize_from_stream(stream, input, info, INTERNAL_FUNCTION_PARAM_PASSTHRU); + php_getimagesize_from_stream(stream, ZSTR_VAL(input), info, INTERNAL_FUNCTION_PARAM_PASSTHRU); php_stream_close(stream); } /* }}} */ diff --git a/ext/standard/info.c b/ext/standard/info.c index 153cb6cde0..8ceef31d9f 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -798,11 +798,11 @@ PHPAPI ZEND_COLD void php_print_info(int flag) #ifdef PHP_BUILD_PROVIDER php_info_print_table_row(2, "Build Provider", PHP_BUILD_PROVIDER); #endif -#ifdef COMPILER - php_info_print_table_row(2, "Compiler", COMPILER); +#ifdef PHP_BUILD_COMPILER + php_info_print_table_row(2, "Compiler", PHP_BUILD_COMPILER); #endif -#ifdef ARCHITECTURE - php_info_print_table_row(2, "Architecture", ARCHITECTURE); +#ifdef PHP_BUILD_ARCH + php_info_print_table_row(2, "Architecture", PHP_BUILD_ARCH); #endif #ifdef CONFIGURE_COMMAND php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND ); diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index b4890238f8..8bdb04bf67 100644 --- a/ext/standard/iptc.c +++ b/ext/standard/iptc.c @@ -179,7 +179,7 @@ PHP_FUNCTION(iptcembed) zend_string *spoolbuf = NULL; unsigned char *poi = NULL; zend_stat_t sb; - zend_bool written = 0; + bool written = 0; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STRING(iptcdata, iptcdata_len) diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 3080a3957b..9301d22ab7 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -57,7 +57,7 @@ extern zend_long php_getuid(void); -static zend_bool php_mail_build_headers_check_field_value(zval *val) +static bool php_mail_build_headers_check_field_value(zval *val) { size_t len = 0; zend_string *value = Z_STR_P(val); @@ -83,7 +83,7 @@ static zend_bool php_mail_build_headers_check_field_value(zval *val) } -static zend_bool php_mail_build_headers_check_field_name(zend_string *key) +static bool php_mail_build_headers_check_field_name(zend_string *key) { size_t len = 0; @@ -371,7 +371,7 @@ void php_mail_log_to_syslog(char *message) { void php_mail_log_to_file(char *filename, char *message, size_t message_size) { /* Write 'message' to the given file. */ - uint32_t flags = IGNORE_URL_WIN | REPORT_ERRORS | STREAM_DISABLE_OPEN_BASEDIR; + uint32_t flags = REPORT_ERRORS | STREAM_DISABLE_OPEN_BASEDIR; php_stream *stream = php_stream_open_wrapper(filename, "a", flags, NULL); if (stream) { php_stream_write(stream, message, message_size); diff --git a/ext/standard/md5.c b/ext/standard/md5.c index ec07ae2ed3..1452d57afb 100644 --- a/ext/standard/md5.c +++ b/ext/standard/md5.c @@ -42,7 +42,7 @@ PHPAPI void make_digest_ex(char *md5str, const unsigned char *digest, int len) / PHP_FUNCTION(md5) { zend_string *arg; - zend_bool raw_output = 0; + bool raw_output = 0; PHP_MD5_CTX context; unsigned char digest[16]; @@ -70,7 +70,7 @@ PHP_FUNCTION(md5_file) { char *arg; size_t arg_len; - zend_bool raw_output = 0; + bool raw_output = 0; unsigned char buf[1024]; unsigned char digest[16]; PHP_MD5_CTX context; @@ -290,7 +290,7 @@ static const void *body(PHP_MD5_CTX *ctx, const void *data, size_t size) return ptr; } -PHPAPI void PHP_MD5Init(PHP_MD5_CTX *ctx) +PHPAPI void PHP_MD5InitArgs(PHP_MD5_CTX *ctx, ZEND_ATTRIBUTE_UNUSED HashTable *args) { ctx->a = 0x67452301; ctx->b = 0xefcdab89; diff --git a/ext/standard/md5.h b/ext/standard/md5.h index ac60d7fca4..09bcff1cf1 100644 --- a/ext/standard/md5.h +++ b/ext/standard/md5.h @@ -42,7 +42,8 @@ typedef struct { } PHP_MD5_CTX; #define PHP_MD5_SPEC "llllllb64l16." -PHPAPI void PHP_MD5Init(PHP_MD5_CTX *ctx); +#define PHP_MD5Init(ctx) PHP_MD5InitArgs(ctx, NULL) +PHPAPI void PHP_MD5InitArgs(PHP_MD5_CTX *context, ZEND_ATTRIBUTE_UNUSED HashTable *args); PHPAPI void PHP_MD5Update(PHP_MD5_CTX *ctx, const void *data, size_t size); PHPAPI void PHP_MD5Final(unsigned char *result, PHP_MD5_CTX *ctx); diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c index 1817da00bf..592e1fd4fb 100644 --- a/ext/standard/microtime.c +++ b/ext/standard/microtime.c @@ -45,7 +45,7 @@ #ifdef HAVE_GETTIMEOFDAY static void _php_gettimeofday(INTERNAL_FUNCTION_PARAMETERS, int mode) { - zend_bool get_as_float = 0; + bool get_as_float = 0; struct timeval tp = {0}; ZEND_PARSE_PARAMETERS_START(0, 1) diff --git a/ext/standard/mt_rand.c b/ext/standard/mt_rand.c index 3c33a42df3..d49740d40e 100644 --- a/ext/standard/mt_rand.c +++ b/ext/standard/mt_rand.c @@ -24,6 +24,7 @@ #include "php.h" #include "php_rand.h" +#include "php_random.h" #include "php_mt_rand.h" /* MT RAND FUNCTIONS */ @@ -161,7 +162,11 @@ PHPAPI uint32_t php_mt_rand(void) register uint32_t s1; if (UNEXPECTED(!BG(mt_rand_is_seeded))) { - php_mt_srand(GENERATE_SEED()); + zend_long bytes; + if (php_random_bytes_silent(&bytes, sizeof(zend_long)) == FAILURE) { + bytes = GENERATE_SEED(); + } + php_mt_srand(bytes); } if (BG(left) == 0) { @@ -189,8 +194,11 @@ PHP_FUNCTION(mt_srand) Z_PARAM_LONG(mode) ZEND_PARSE_PARAMETERS_END(); - if (ZEND_NUM_ARGS() == 0) - seed = GENERATE_SEED(); + if (ZEND_NUM_ARGS() == 0) { + if (php_random_bytes_silent(&seed, sizeof(zend_long)) == FAILURE) { + seed = GENERATE_SEED(); + } + } switch (mode) { case MT_RAND_PHP: diff --git a/ext/standard/pack.c b/ext/standard/pack.c index e14bbbcedb..b14eb64d29 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -84,7 +84,7 @@ static void php_pack(zval *val, size_t size, int *map, char *output) size_t i; char *v; - convert_to_long_ex(val); + convert_to_long(val); v = (char *) &Z_LVAL_P(val); for (i = 0; i < size; i++) { diff --git a/ext/standard/password.c b/ext/standard/password.c index c108f8d71a..a14dc8dff4 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -117,7 +117,7 @@ static zend_string* php_password_get_salt(zval *unused_, size_t required_salt_le /* bcrypt implementation */ -static zend_bool php_password_bcrypt_valid(const zend_string *hash) { +static bool php_password_bcrypt_valid(const zend_string *hash) { const char *h = ZSTR_VAL(hash); return (ZSTR_LEN(hash) == 60) && (h[0] == '$') && (h[1] == '2') && (h[2] == 'y'); @@ -137,7 +137,7 @@ static int php_password_bcrypt_get_info(zval *return_value, const zend_string *h return SUCCESS; } -static zend_bool php_password_bcrypt_needs_rehash(const zend_string *hash, zend_array *options) { +static bool php_password_bcrypt_needs_rehash(const zend_string *hash, zend_array *options) { zval *znew_cost; zend_long old_cost = PHP_PASSWORD_BCRYPT_COST; zend_long new_cost = PHP_PASSWORD_BCRYPT_COST; @@ -155,7 +155,7 @@ static zend_bool php_password_bcrypt_needs_rehash(const zend_string *hash, zend_ return old_cost != new_cost; } -static zend_bool php_password_bcrypt_verify(const zend_string *password, const zend_string *hash) { +static bool php_password_bcrypt_verify(const zend_string *password, const zend_string *hash) { size_t i; int status = 0; zend_string *ret = php_crypt(ZSTR_VAL(password), (int)ZSTR_LEN(password), ZSTR_VAL(hash), (int)ZSTR_LEN(hash), 1); @@ -276,7 +276,7 @@ static int php_password_argon2_get_info(zval *return_value, const zend_string *h return SUCCESS; } -static zend_bool php_password_argon2_needs_rehash(const zend_string *hash, zend_array *options) { +static bool php_password_argon2_needs_rehash(const zend_string *hash, zend_array *options) { zend_long v = 0; zend_long new_memory_cost = PHP_PASSWORD_ARGON2_MEMORY_COST, memory_cost = 0; zend_long new_time_cost = PHP_PASSWORD_ARGON2_TIME_COST, time_cost = 0; @@ -384,7 +384,7 @@ static zend_string *php_password_argon2_hash(const zend_string *password, zend_a /* argon2i specific methods */ -static zend_bool php_password_argon2i_verify(const zend_string *password, const zend_string *hash) { +static bool php_password_argon2i_verify(const zend_string *password, const zend_string *hash) { return ARGON2_OK == argon2_verify(ZSTR_VAL(hash), ZSTR_VAL(password), ZSTR_LEN(password), Argon2_i); } @@ -403,7 +403,7 @@ const php_password_algo php_password_algo_argon2i = { /* argon2id specific methods */ -static zend_bool php_password_argon2id_verify(const zend_string *password, const zend_string *hash) { +static bool php_password_argon2id_verify(const zend_string *password, const zend_string *hash) { return ARGON2_OK == argon2_verify(ZSTR_VAL(hash), ZSTR_VAL(password), ZSTR_LEN(password), Argon2_id); } @@ -487,7 +487,7 @@ const php_password_algo* php_password_algo_find(const zend_string *ident) { return Z_PTR_P(tmp); } -static const php_password_algo* php_password_algo_find_zval(zend_string *arg_str, zend_long arg_long, zend_bool arg_is_null) { +static const php_password_algo* php_password_algo_find_zval(zend_string *arg_str, zend_long arg_long, bool arg_is_null) { if (arg_is_null) { return php_password_algo_default(); } @@ -598,7 +598,7 @@ PHP_FUNCTION(password_needs_rehash) zend_string *hash; zend_string *new_algo_str; zend_long new_algo_long; - zend_bool new_algo_is_null; + bool new_algo_is_null; zend_array *options = 0; ZEND_PARSE_PARAMETERS_START(2, 3) @@ -646,7 +646,7 @@ PHP_FUNCTION(password_hash) zend_string *password, *digest = NULL; zend_string *algo_str; zend_long algo_long; - zend_bool algo_is_null; + bool algo_is_null; const php_password_algo *algo; zend_array *options = NULL; diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h index a49e12488f..e1e43b5aaf 100644 --- a/ext/standard/php_array.h +++ b/ext/standard/php_array.h @@ -46,7 +46,7 @@ PHPAPI zend_long php_count_recursive(HashTable *ht); ZEND_BEGIN_MODULE_GLOBALS(array) bucket_compare_func_t *multisort_func; - zend_bool compare_deprecation_thrown; + bool compare_deprecation_thrown; ZEND_END_MODULE_GLOBALS(array) #define ARRAYG(v) ZEND_MODULE_GLOBALS_ACCESSOR(array, v) diff --git a/ext/standard/php_crypt.h b/ext/standard/php_crypt.h index a7eabbdd66..572248655e 100644 --- a/ext/standard/php_crypt.h +++ b/ext/standard/php_crypt.h @@ -19,7 +19,7 @@ #ifndef PHP_CRYPT_H #define PHP_CRYPT_H -PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const char *salt, int salt_len, zend_bool quiet); +PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const char *salt, int salt_len, bool quiet); PHP_MINIT_FUNCTION(crypt); PHP_MSHUTDOWN_FUNCTION(crypt); PHP_RINIT_FUNCTION(crypt); diff --git a/ext/standard/php_filestat.h b/ext/standard/php_filestat.h index 13b79a4e07..4f76fc39c3 100644 --- a/ext/standard/php_filestat.h +++ b/ext/standard/php_filestat.h @@ -40,7 +40,7 @@ PHP_RSHUTDOWN_FUNCTION(filestat); /* Compatibility. */ typedef size_t php_stat_len; -PHPAPI void php_clear_stat_cache(zend_bool clear_realpath_cache, const char *filename, size_t filename_len); +PHPAPI void php_clear_stat_cache(bool clear_realpath_cache, const char *filename, size_t filename_len); PHPAPI void php_stat(const char *filename, size_t filename_length, int type, zval *return_value); /* Switches for various filestat functions: */ diff --git a/ext/standard/php_http.h b/ext/standard/php_http.h index 1df941ee00..3f764c18a6 100644 --- a/ext/standard/php_http.h +++ b/ext/standard/php_http.h @@ -25,6 +25,5 @@ PHPAPI void php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, const char *key_prefix, size_t key_prefix_len, const char *key_suffix, size_t key_suffix_len, zval *type, const char *arg_sep, int enc_type); -#define php_url_encode_hash(ht, formstr) php_url_encode_hash_ex((ht), (formstr), NULL, 0, NULL, 0, NULL, 0, NULL) #endif diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h index f36fd43cfc..fc2caaa62c 100644 --- a/ext/standard/php_incomplete_class.h +++ b/ext/standard/php_incomplete_class.h @@ -40,7 +40,7 @@ extern PHPAPI zend_class_entry *php_ce_incomplete_class; #define PHP_CLASS_ATTRIBUTES \ zend_string *class_name; \ - zend_bool incomplete_class ZEND_ATTRIBUTE_UNUSED = 0 + bool incomplete_class ZEND_ATTRIBUTE_UNUSED = 0 #define INCOMPLETE_CLASS "__PHP_Incomplete_Class" #define MAGIC_MEMBER "__PHP_Incomplete_Class_Name" diff --git a/ext/standard/php_password.h b/ext/standard/php_password.h index 45a21c5c34..2f40e18a34 100644 --- a/ext/standard/php_password.h +++ b/ext/standard/php_password.h @@ -37,10 +37,10 @@ PHP_MSHUTDOWN_FUNCTION(password); typedef struct _php_password_algo { const char *name; zend_string *(*hash)(const zend_string *password, zend_array *options); - zend_bool (*verify)(const zend_string *password, const zend_string *hash); - zend_bool (*needs_rehash)(const zend_string *password, zend_array *options); + bool (*verify)(const zend_string *password, const zend_string *hash); + bool (*needs_rehash)(const zend_string *password, zend_array *options); int (*get_info)(zval *return_value, const zend_string *hash); - zend_bool (*valid)(const zend_string *hash); + bool (*valid)(const zend_string *hash); } php_password_algo; extern const php_password_algo php_password_algo_bcrypt; diff --git a/ext/standard/php_random.h b/ext/standard/php_random.h index 290b37873d..0732e74031 100644 --- a/ext/standard/php_random.h +++ b/ext/standard/php_random.h @@ -34,8 +34,8 @@ typedef struct { #define php_random_int_silent(min, max, result) \ php_random_int((min), (max), (result), 0) -PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw); -PHPAPI int php_random_int(zend_long min, zend_long max, zend_long *result, zend_bool should_throw); +PHPAPI int php_random_bytes(void *bytes, size_t size, bool should_throw); +PHPAPI int php_random_int(zend_long min, zend_long max, zend_long *result, bool should_throw); #ifdef ZTS # define RANDOM_G(v) ZEND_TSRMG(random_globals_id, php_random_globals *, v) diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h index 43e50dffc1..fa1ebe4411 100644 --- a/ext/standard/php_string.h +++ b/ext/standard/php_string.h @@ -52,14 +52,14 @@ PHPAPI zend_string *php_str_to_str(const char *haystack, size_t length, const ch size_t needle_len, const char *str, size_t str_len); PHPAPI zend_string *php_trim(zend_string *str, const char *what, size_t what_len, int mode); PHPAPI size_t php_strip_tags(char *rbuf, size_t len, const char *allow, size_t allow_len); -PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, const char *allow, size_t allow_len, zend_bool allow_tag_spaces); +PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, const char *allow, size_t allow_len, bool allow_tag_spaces); PHPAPI void php_implode(const zend_string *delim, HashTable *arr, zval *return_value); PHPAPI void php_explode(const zend_string *delim, zend_string *str, zval *return_value, zend_long limit); PHPAPI size_t php_strspn(const char *s1, const char *s2, const char *s1_end, const char *s2_end); PHPAPI size_t php_strcspn(const char *s1, const char *s2, const char *s1_end, const char *s2_end); -PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensitive); +PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2, bool case_insensitive); PHPAPI int string_natural_compare_function(zval *result, zval *op1, zval *op2); PHPAPI int string_natural_case_compare_function(zval *result, zval *op1, zval *op2); diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 03b55c3eac..bcf4a3a35d 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -520,7 +520,7 @@ static char *create_win_command_from_args(HashTable *args) { smart_string str = {0}; zval *arg_zv; - zend_bool is_prog_name = 1; + bool is_prog_name = 1; int elem_num = 0; ZEND_HASH_FOREACH_VAL(args, arg_zv) { diff --git a/ext/standard/random.c b/ext/standard/random.c index 526347f565..8ab637af7d 100644 --- a/ext/standard/random.c +++ b/ext/standard/random.c @@ -84,7 +84,7 @@ PHP_MSHUTDOWN_FUNCTION(random) /* }}} */ /* {{{ php_random_bytes */ -PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw) +PHPAPI int php_random_bytes(void *bytes, size_t size, bool should_throw) { #ifdef PHP_WIN32 /* Defer to CryptGenRandom on Windows */ @@ -222,7 +222,7 @@ PHP_FUNCTION(random_bytes) /* }}} */ /* {{{ */ -PHPAPI int php_random_int(zend_long min, zend_long max, zend_long *result, zend_bool should_throw) +PHPAPI int php_random_int(zend_long min, zend_long max, zend_long *result, bool should_throw) { zend_ulong umax; zend_ulong trial; diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c index 58bd91385c..810871212c 100644 --- a/ext/standard/sha1.c +++ b/ext/standard/sha1.c @@ -30,7 +30,7 @@ PHPAPI void make_sha1_digest(char *sha1str, const unsigned char *digest) PHP_FUNCTION(sha1) { zend_string *arg; - zend_bool raw_output = 0; + bool raw_output = 0; PHP_SHA1_CTX context; unsigned char digest[20]; @@ -60,7 +60,7 @@ PHP_FUNCTION(sha1_file) { char *arg; size_t arg_len; - zend_bool raw_output = 0; + bool raw_output = 0; unsigned char buf[1024]; unsigned char digest[20]; PHP_SHA1_CTX context; @@ -152,7 +152,7 @@ static const unsigned char PADDING[64] = /* {{{ PHP_SHA1Init * SHA1 initialization. Begins an SHA1 operation, writing a new context. */ -PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX * context) +PHPAPI void PHP_SHA1InitArgs(PHP_SHA1_CTX * context, ZEND_ATTRIBUTE_UNUSED HashTable *args) { context->count[0] = context->count[1] = 0; /* Load magic initialization constants. diff --git a/ext/standard/sha1.h b/ext/standard/sha1.h index ef98ecc29c..3ae3ec219e 100644 --- a/ext/standard/sha1.h +++ b/ext/standard/sha1.h @@ -27,7 +27,8 @@ typedef struct { } PHP_SHA1_CTX; #define PHP_SHA1_SPEC "l5l2b64." -PHPAPI void PHP_SHA1Init(PHP_SHA1_CTX *); +#define PHP_SHA1Init(ctx) PHP_SHA1InitArgs(ctx, NULL) +PHPAPI void PHP_SHA1InitArgs(PHP_SHA1_CTX *, ZEND_ATTRIBUTE_UNUSED HashTable *); PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX *, const unsigned char *, size_t); PHPAPI void PHP_SHA1Final(unsigned char[20], PHP_SHA1_CTX *); PHPAPI void make_sha1_digest(char *sha1str, const unsigned char *digest); diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index fb4911bcbe..83471fcb62 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -89,7 +89,7 @@ PHP_FUNCTION(stream_socket_client) zend_string *host; zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL; double timeout; - zend_bool timeout_is_null = 1; + bool timeout_is_null = 1; php_timeout_ull conv; struct timeval tv; char *hashkey = NULL; @@ -244,7 +244,7 @@ PHP_FUNCTION(stream_socket_server) PHP_FUNCTION(stream_socket_accept) { double timeout; - zend_bool timeout_is_null = 1; + bool timeout_is_null = 1; zval *zpeername = NULL; zend_string *peername = NULL; php_timeout_ull conv; @@ -305,7 +305,7 @@ PHP_FUNCTION(stream_socket_get_name) { php_stream *stream; zval *zstream; - zend_bool want_peer; + bool want_peer; zend_string *name = NULL; ZEND_PARSE_PARAMETERS_START(2, 2) @@ -419,7 +419,7 @@ PHP_FUNCTION(stream_get_contents) php_stream *stream; zval *zsrc; zend_long maxlen, desiredpos = -1L; - zend_bool maxlen_is_null = 1; + bool maxlen_is_null = 1; zend_string *contents; ZEND_PARSE_PARAMETERS_START(1, 3) @@ -472,7 +472,7 @@ PHP_FUNCTION(stream_copy_to_stream) php_stream *src, *dest; zval *zsrc, *zdest; zend_long maxlen, pos = 0; - zend_bool maxlen_is_null = 1; + bool maxlen_is_null = 1; size_t len; int ret; @@ -744,7 +744,7 @@ PHP_FUNCTION(stream_select) php_socket_t max_fd = 0; int retval, sets = 0; zend_long sec, usec = 0; - zend_bool secnull; + bool secnull; int set_count, max_set_count = 0; ZEND_PARSE_PARAMETERS_START(4, 5) @@ -1309,7 +1309,7 @@ PHP_FUNCTION(stream_get_line) PHP_FUNCTION(stream_set_blocking) { zval *zstream; - zend_bool block; + bool block; php_stream *stream; ZEND_PARSE_PARAMETERS_START(2, 2) @@ -1474,7 +1474,7 @@ PHP_FUNCTION(stream_socket_enable_crypto) zend_long cryptokind = 0; zval *zstream, *zsessstream = NULL; php_stream *stream, *sessstream = NULL; - zend_bool enable, cryptokindnull = 1; + bool enable, cryptokindnull = 1; int ret; ZEND_PARSE_PARAMETERS_START(2, 4) @@ -1637,7 +1637,7 @@ PHP_FUNCTION(sapi_windows_vt100_support) { zval *zsrc; php_stream *stream; - zend_bool enable, enable_is_null = 1; + bool enable, enable_is_null = 1; zend_long fileno; ZEND_PARSE_PARAMETERS_START(1, 2) diff --git a/ext/standard/string.c b/ext/standard/string.c index cf77435f80..f6af763fd3 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -248,7 +248,7 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) / { zend_string *s11, *s22; zend_long start = 0, len = 0; - zend_bool len_is_null = 1; + bool len_is_null = 1; ZEND_PARSE_PARAMETERS_START(2, 4) Z_PARAM_STR(s11) @@ -886,7 +886,7 @@ PHP_FUNCTION(wordwrap) size_t alloced; zend_long current = 0, laststart = 0, lastspace = 0; zend_long linelength = 75; - zend_bool docut = 0; + bool docut = 0; zend_string *newtext; ZEND_PARSE_PARAMETERS_START(1, 4) @@ -1151,14 +1151,14 @@ PHPAPI void php_implode(const zend_string *glue, HashTable *pieces, zval *return RETURN_EMPTY_STRING(); } else if (numelems == 1) { /* loop to search the first not undefined element... */ - ZEND_HASH_FOREACH_VAL_IND(pieces, tmp) { + ZEND_HASH_FOREACH_VAL(pieces, tmp) { RETURN_STR(zval_get_string(tmp)); } ZEND_HASH_FOREACH_END(); } ptr = strings = do_alloca((sizeof(*strings)) * numelems, use_heap); - ZEND_HASH_FOREACH_VAL_IND(pieces, tmp) { + ZEND_HASH_FOREACH_VAL(pieces, tmp) { if (EXPECTED(Z_TYPE_P(tmp) == IS_STRING)) { ptr->str = Z_STR_P(tmp); len += ZSTR_LEN(ptr->str); @@ -1739,7 +1739,7 @@ PHP_FUNCTION(stristr) size_t found_offset; char *haystack_dup; char *orig_needle; - zend_bool part = 0; + bool part = 0; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) @@ -1774,7 +1774,7 @@ PHP_FUNCTION(strstr) zend_string *haystack, *needle; const char *found = NULL; zend_long found_offset; - zend_bool part = 0; + bool part = 0; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) @@ -2164,7 +2164,7 @@ PHP_FUNCTION(substr) { zend_string *str; zend_long l = 0, f; - zend_bool len_is_null = 1; + bool len_is_null = 1; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(str) @@ -2220,7 +2220,7 @@ PHP_FUNCTION(substr_replace) zend_long from_long; HashTable *len_ht = NULL; zend_long len_long; - zend_bool len_is_null = 1; + bool len_is_null = 1; zend_long l = 0; zend_long f; zend_string *result; @@ -2329,7 +2329,7 @@ PHP_FUNCTION(substr_replace) from_idx = len_idx = repl_idx = 0; - ZEND_HASH_FOREACH_KEY_VAL_IND(str_ht, num_index, str_index, tmp_str) { + ZEND_HASH_FOREACH_KEY_VAL(str_ht, num_index, str_index, tmp_str) { zend_string *tmp_orig_str; zend_string *orig_str = zval_get_tmp_string(tmp_str, &tmp_orig_str); @@ -2770,7 +2770,7 @@ static void php_strtr_array(zval *return_value, zend_string *input, HashTable *p zend_string *key_used; /* we have to rebuild HashTable with numeric keys */ zend_hash_init(&str_hash, zend_hash_num_elements(pats), NULL, NULL, 0); - ZEND_HASH_FOREACH_KEY_VAL_IND(pats, num_key, str_key, entry) { + ZEND_HASH_FOREACH_KEY_VAL(pats, num_key, str_key, entry) { if (UNEXPECTED(!str_key)) { key_used = zend_long_to_str(num_key); len = ZSTR_LEN(key_used); @@ -3203,7 +3203,7 @@ PHP_FUNCTION(strtr) zend_string *str_key, *tmp_str, *replace, *tmp_replace; zval *entry; - ZEND_HASH_FOREACH_KEY_VAL_IND(from_ht, num_key, str_key, entry) { + ZEND_HASH_FOREACH_KEY_VAL(from_ht, num_key, str_key, entry) { tmp_str = NULL; if (UNEXPECTED(!str_key)) { str_key = tmp_str = zend_long_to_str(num_key); @@ -4083,7 +4083,7 @@ static zend_long php_str_replace_in_subject( } /* For each entry in the search array, get the entry */ - ZEND_HASH_FOREACH_VAL_IND(search_ht, search_entry) { + ZEND_HASH_FOREACH_VAL(search_ht, search_entry) { /* Make sure we're dealing with strings. */ zend_string *tmp_search_str; zend_string *search_str = zval_get_tmp_string(search_entry, &tmp_search_str); @@ -4241,7 +4241,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit /* For each subject entry, convert it to string, then perform replacement and add the result to the return_value array. */ - ZEND_HASH_FOREACH_KEY_VAL_IND(subject_ht, num_key, string_key, subject_entry) { + ZEND_HASH_FOREACH_KEY_VAL(subject_ht, num_key, string_key, subject_entry) { zend_string *tmp_subject_str; ZVAL_DEREF(subject_entry); subject_str = zval_get_tmp_string(subject_entry, &tmp_subject_str); @@ -4451,7 +4451,7 @@ PHP_FUNCTION(nl2br) zend_string *str; char *target; size_t repl_cnt = 0; - zend_bool is_xhtml = 1; + bool is_xhtml = 1; zend_string *result; ZEND_PARSE_PARAMETERS_START(1, 2) @@ -4658,7 +4658,7 @@ PHP_FUNCTION(setlocale) for (uint32_t i = 0; i < num_args; i++) { if (Z_TYPE(args[i]) == IS_ARRAY) { zval *elem; - ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL(args[i]), elem) { + ZEND_HASH_FOREACH_VAL(Z_ARRVAL(args[i]), elem) { zend_string *result = try_setlocale_zval(cat, elem); if (EG(exception)) { RETURN_THROWS(); @@ -4798,7 +4798,7 @@ PHPAPI size_t php_strip_tags(char *rbuf, size_t len, const char *allow, size_t a swm: Added ability to strip <?xml tags without assuming it PHP code. */ -PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, const char *allow, size_t allow_len, zend_bool allow_tag_spaces) +PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, const char *allow, size_t allow_len, bool allow_tag_spaces) { char *tbuf, *tp, *rp, c, lc; const char *buf, *p, *end; @@ -5286,7 +5286,7 @@ static void php_strnatcmp(INTERNAL_FUNCTION_PARAMETERS, int fold_case) } /* }}} */ -PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensitive) /* {{{ */ +PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2, bool case_insensitive) /* {{{ */ { zend_string *tmp_str1, *tmp_str2; zend_string *str1 = zval_get_tmp_string(op1, &tmp_str1); @@ -5385,7 +5385,7 @@ PHP_FUNCTION(substr_count) { char *haystack, *needle; zend_long offset = 0, length = 0; - zend_bool length_is_null = 1; + bool length_is_null = 1; zend_long count = 0; size_t haystack_len, needle_len; const char *p, *endp; @@ -5859,8 +5859,8 @@ PHP_FUNCTION(substr_compare) { zend_string *s1, *s2; zend_long offset, len=0; - zend_bool len_is_default=1; - zend_bool cs=0; + bool len_is_default=1; + bool cs=0; size_t cmp_len; ZEND_PARSE_PARAMETERS_START(3, 5) diff --git a/ext/standard/tests/array/005.phpt b/ext/standard/tests/array/005.phpt index 29deed8a12..40e9eac265 100644 --- a/ext/standard/tests/array/005.phpt +++ b/ext/standard/tests/array/005.phpt @@ -2,7 +2,6 @@ Test array_shift() function --FILE-- <?php -array_shift($GLOBALS); $empty_array = array(); $number = 5; @@ -18,12 +17,12 @@ $mixed_array = array( array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ), array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), - array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", - "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), array( 12, "name", 'age', '45' ), array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, - 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 ) + 5 => 57, "5.4" => 554, "5.7" => 557 ) ); /* Testing Error Conditions */ @@ -37,8 +36,8 @@ echo "\n*** Testing with various array inputs ***\n"; $counter = 1; foreach( $mixed_array as $sub_array ) { - echo "\n-- Input Array for Iteration $counter is -- \n"; - print_r( $sub_array ); + echo "\n-- Input Array for Iteration $counter is --\n"; + var_dump( $sub_array ); echo "\nOutput after shift is :\n"; var_dump( array_shift($sub_array) ); $counter++; @@ -48,19 +47,19 @@ foreach( $mixed_array as $sub_array ) { echo"\n*** Checking for internal array pointer being reset when shift is called ***\n"; -echo "\nCurrent Element is : "; +echo "\nCurrent Element is :"; var_dump( current($mixed_array[1]) ); -echo "\nNext Element is : "; +echo "\nNext Element is :"; var_dump( next($mixed_array[1]) ); -echo "\nNext Element is : "; +echo "\nNext Element is :"; var_dump( next($mixed_array[1]) ); -echo "\nshifted Element is : "; +echo "\nshifted Element is :"; var_dump( array_shift($mixed_array[1]) ); -echo "\nCurrent Element after shift operation is: "; +echo "\nCurrent Element after shift operation is:"; var_dump( current($mixed_array[1]) ); echo"Done"; @@ -71,155 +70,203 @@ NULL *** Testing with various array inputs *** --- Input Array for Iteration 1 is -- -Array -( -) +-- Input Array for Iteration 1 is -- +array(0) { +} Output after shift is : NULL --- Input Array for Iteration 2 is -- -Array -( - [0] => 1 - [1] => 2 - [2] => 3 - [3] => 4 - [4] => 5 - [5] => 6 - [6] => 7 - [7] => 8 - [8] => 9 -) +-- Input Array for Iteration 2 is -- +array(9) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) +} Output after shift is : int(1) --- Input Array for Iteration 3 is -- -Array -( - [0] => One - [1] => _Two - [2] => Three - [3] => Four - [4] => Five -) +-- Input Array for Iteration 3 is -- +array(5) { + [0]=> + string(3) "One" + [1]=> + string(4) "_Two" + [2]=> + string(5) "Three" + [3]=> + string(4) "Four" + [4]=> + string(4) "Five" +} Output after shift is : string(3) "One" --- Input Array for Iteration 4 is -- -Array -( - [0] => 6 - [1] => six - [2] => 7 - [3] => seven - [4] => 8 - [5] => eight - [6] => 9 - [7] => nine -) +-- Input Array for Iteration 4 is -- +array(8) { + [0]=> + int(6) + [1]=> + string(3) "six" + [2]=> + int(7) + [3]=> + string(5) "seven" + [4]=> + int(8) + [5]=> + string(5) "eight" + [6]=> + int(9) + [7]=> + string(4) "nine" +} Output after shift is : int(6) --- Input Array for Iteration 5 is -- -Array -( - [a] => aaa - [A] => AAA - [c] => ccc - [d] => ddd - [e] => eee -) +-- Input Array for Iteration 5 is -- +array(5) { + ["a"]=> + string(3) "aaa" + ["A"]=> + string(3) "AAA" + ["c"]=> + string(3) "ccc" + ["d"]=> + string(3) "ddd" + ["e"]=> + string(3) "eee" +} Output after shift is : string(3) "aaa" --- Input Array for Iteration 6 is -- -Array -( - [1] => one - [2] => two - [3] => three - [4] => four - [5] => five -) +-- Input Array for Iteration 6 is -- +array(5) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" + [4]=> + string(4) "four" + [5]=> + string(4) "five" +} Output after shift is : string(3) "one" --- Input Array for Iteration 7 is -- -Array -( - [1] => one - [2] => two - [3] => 7 - [4] => four - [5] => five -) +-- Input Array for Iteration 7 is -- +array(5) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + int(7) + [4]=> + string(4) "four" + [5]=> + string(4) "five" +} Output after shift is : string(3) "one" --- Input Array for Iteration 8 is -- -Array -( - [f] => fff - [1] => one - [4] => 6 - [] => 3 - [2] => float - [F] => FFF - [blank] => - [3] => 3.7 - [5] => Five - [6] => 8.6 - [4name] => jonny - [a] => -) +-- Input Array for Iteration 8 is -- +array(12) { + ["f"]=> + string(3) "fff" + [1]=> + string(3) "one" + [4]=> + int(6) + [""]=> + int(3) + [2]=> + string(5) "float" + ["F"]=> + string(3) "FFF" + ["blank"]=> + string(0) "" + [3]=> + float(3.7) + [5]=> + string(4) "Five" + [6]=> + float(8.6) + ["4name"]=> + string(5) "jonny" + ["a"]=> + NULL +} Output after shift is : string(3) "fff" --- Input Array for Iteration 9 is -- -Array -( - [0] => 12 - [1] => name - [2] => age - [3] => 45 -) +-- Input Array for Iteration 9 is -- +array(4) { + [0]=> + int(12) + [1]=> + string(4) "name" + [2]=> + string(3) "age" + [3]=> + string(2) "45" +} Output after shift is : int(12) --- Input Array for Iteration 10 is -- -Array -( - [0] => Array - ( - [0] => oNe - [1] => tWo - [2] => 4 - ) - - [1] => Array - ( - [0] => 10 - [1] => 20 - [2] => 30 - [3] => 40 - [4] => 50 - ) - - [2] => Array - ( - ) - -) +-- Input Array for Iteration 10 is -- +array(3) { + [0]=> + array(3) { + [0]=> + string(3) "oNe" + [1]=> + string(3) "tWo" + [2]=> + int(4) + } + [1]=> + array(5) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + [3]=> + int(40) + [4]=> + int(50) + } + [2]=> + array(0) { + } +} Output after shift is : array(3) { @@ -231,33 +278,42 @@ array(3) { int(4) } --- Input Array for Iteration 11 is -- -Array -( - [one] => 2 - [three] => 3 - [0] => 3 - [1] => 4 - [3] => 33 - [4] => 44 - [5] => 57 - [6] => 6 - [5.4] => 554 - [5.7] => 557 -) +-- Input Array for Iteration 11 is -- +array(10) { + ["one"]=> + int(2) + ["three"]=> + int(3) + [0]=> + int(3) + [1]=> + int(4) + [3]=> + int(33) + [4]=> + int(44) + [5]=> + int(57) + [6]=> + int(6) + ["5.4"]=> + int(554) + ["5.7"]=> + int(557) +} Output after shift is : int(2) *** Checking for internal array pointer being reset when shift is called *** -Current Element is : int(1) +Current Element is :int(1) -Next Element is : int(2) +Next Element is :int(2) -Next Element is : int(3) +Next Element is :int(3) -shifted Element is : int(1) +shifted Element is :int(1) -Current Element after shift operation is: int(2) +Current Element after shift operation is:int(2) Done diff --git a/ext/standard/tests/array/006.phpt b/ext/standard/tests/array/006.phpt index 4893ad3f06..c7eb528bfb 100644 --- a/ext/standard/tests/array/006.phpt +++ b/ext/standard/tests/array/006.phpt @@ -3,8 +3,6 @@ Test array_pop behaviour --FILE-- <?php -array_pop($GLOBALS); - $a = array("foo", "bar", "fubar"); $b = array("3" => "foo", "4" => "bar", "5" => "fubar"); $c = array("a" => "foo", "b" => "bar", "c" => "fubar"); diff --git a/ext/standard/tests/array/009.phpt b/ext/standard/tests/array/009.phpt index 42cecc51ea..f4aab2fa93 100644 --- a/ext/standard/tests/array/009.phpt +++ b/ext/standard/tests/array/009.phpt @@ -20,7 +20,7 @@ $varient_arrays = array ( array(NULL),// array with NULL array(null),// array with null array(NULL, true, null, "", 1), // mixed array - array(-1.5 => "test", -2 => "rest", 2.5 => "two", + array(-1 => "test", -2 => "rest", 2 => "two", "" => "string", 0 => "zero", "" => "" ) // mixed array ); diff --git a/ext/standard/tests/array/array_change_key_case_variation3.phpt b/ext/standard/tests/array/array_change_key_case_variation3.phpt index bd5ad8557b..0c3ed4eb0d 100644 --- a/ext/standard/tests/array/array_change_key_case_variation3.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation3.phpt @@ -29,18 +29,6 @@ $inputs = array( -2345 => 'negative', ), - // float data -/*2*/ 'float' => array( - 10.5 => 'positive', - -10.5 => 'negative', - .5 => 'half', - ), - - 'extreme floats' => array( - 12.3456789000e6 => 'large', - 12.3456789000E-10 => 'small', - ), - // null data /*3*/ 'null uppercase' => array( NULL => 'null 1', @@ -110,37 +98,19 @@ array(4) { string(8) "negative" } --- Iteration 2 : float data -- -array(3) { - [10]=> - string(8) "positive" - [-10]=> - string(8) "negative" - [0]=> - string(4) "half" -} - --- Iteration 3 : extreme floats data -- -array(2) { - [12345678]=> - string(5) "large" - [0]=> - string(5) "small" -} - --- Iteration 4 : null uppercase data -- +-- Iteration 2 : null uppercase data -- array(1) { [""]=> string(6) "null 1" } --- Iteration 5 : null lowercase data -- +-- Iteration 3 : null lowercase data -- array(1) { [""]=> string(6) "null 2" } --- Iteration 6 : bool lowercase data -- +-- Iteration 4 : bool lowercase data -- array(2) { [1]=> string(6) "lowert" @@ -148,7 +118,7 @@ array(2) { string(6) "lowerf" } --- Iteration 7 : bool uppercase data -- +-- Iteration 5 : bool uppercase data -- array(2) { [1]=> string(6) "uppert" @@ -156,19 +126,19 @@ array(2) { string(6) "upperf" } --- Iteration 8 : empty double quotes data -- +-- Iteration 6 : empty double quotes data -- array(1) { [""]=> string(6) "emptyd" } --- Iteration 9 : empty single quotes data -- +-- Iteration 7 : empty single quotes data -- array(1) { [""]=> string(6) "emptys" } --- Iteration 10 : string data -- +-- Iteration 8 : string data -- array(3) { ["STRINGD"]=> string(7) "stringd" @@ -178,13 +148,13 @@ array(3) { string(7) "stringh" } --- Iteration 11 : undefined data -- +-- Iteration 9 : undefined data -- array(1) { [""]=> string(9) "undefined" } --- Iteration 12 : unset data -- +-- Iteration 10 : unset data -- array(1) { [""]=> string(5) "unset" diff --git a/ext/standard/tests/array/array_chunk_variation5.phpt b/ext/standard/tests/array/array_chunk_variation5.phpt index 24123b0370..dfae48974d 100644 --- a/ext/standard/tests/array/array_chunk_variation5.phpt +++ b/ext/standard/tests/array/array_chunk_variation5.phpt @@ -16,7 +16,7 @@ echo "*** Testing array_chunk() : usage variations ***\n"; $input_array = array(1, 2, 3); // different magnitude's -$sizes = array(-1, count($input_array) + 1, 0, 1.5); +$sizes = array(-1, count($input_array) + 1, 0, 1); // loop through the array for size argument foreach ($sizes as $size){ @@ -86,7 +86,7 @@ array_chunk(): Argument #2 ($length) must be greater than 0 array_chunk(): Argument #2 ($length) must be greater than 0 array_chunk(): Argument #2 ($length) must be greater than 0 --- Testing array_chunk() when size = 1.5 -- +-- Testing array_chunk() when size = 1 -- array(3) { [0]=> array(1) { diff --git a/ext/standard/tests/array/array_combine_variation4.phpt b/ext/standard/tests/array/array_combine_variation4.phpt index e853d9e2fe..ae4d54a626 100644 --- a/ext/standard/tests/array/array_combine_variation4.phpt +++ b/ext/standard/tests/array/array_combine_variation4.phpt @@ -40,12 +40,6 @@ $arrays = array ( array(1 => "1"), array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), - // arrays with float keys -/*5*/ array(2.3333 => "float"), - array(1.2 => "f1", 3.33 => "f2", - 4.89999922839999 => "f3", - 33333333.333333 => "f4"), - // arrays with string keys /*7*/ array('\tHello' => 111, 're\td' => "color", '\v\fworld' => 2.2, 'pen\n' => 33), @@ -112,22 +106,6 @@ array(4) { string(1) "4" } -- Iteration 5 -- -array(1) { - ["float"]=> - string(5) "float" -} --- Iteration 6 -- -array(4) { - ["f1"]=> - string(2) "f1" - ["f2"]=> - string(2) "f2" - ["f3"]=> - string(2) "f3" - ["f4"]=> - string(2) "f4" -} --- Iteration 7 -- array(4) { [111]=> int(111) @@ -138,7 +116,7 @@ array(4) { [33]=> int(33) } --- Iteration 8 -- +-- Iteration 6 -- array(4) { [111]=> int(111) @@ -149,21 +127,21 @@ array(4) { [33]=> int(33) } --- Iteration 9 -- +-- Iteration 7 -- array(2) { ["hello"]=> string(5) "hello" ["string"]=> string(6) "string" } --- Iteration 10 -- +-- Iteration 8 -- array(2) { ["hello"]=> string(5) "hello" ["resource"]=> string(8) "resource" } --- Iteration 11 -- +-- Iteration 9 -- array(7) { [1]=> int(1) diff --git a/ext/standard/tests/array/array_combine_variation5.phpt b/ext/standard/tests/array/array_combine_variation5.phpt index ec92352a07..ef0859373e 100644 --- a/ext/standard/tests/array/array_combine_variation5.phpt +++ b/ext/standard/tests/array/array_combine_variation5.phpt @@ -46,8 +46,8 @@ $arrays = array ( array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333), // arrays with string values -/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), - array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), +/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3 => "pen\n"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3 => 'pen\n'), array(1 => "hello", "heredoc" => $heredoc), // array with object, unset variable and resource variable diff --git a/ext/standard/tests/array/array_diff_assoc_variation4.phpt b/ext/standard/tests/array/array_diff_assoc_variation4.phpt index 01b2e56a05..65b76dd9eb 100644 --- a/ext/standard/tests/array/array_diff_assoc_variation4.phpt +++ b/ext/standard/tests/array/array_diff_assoc_variation4.phpt @@ -31,13 +31,6 @@ $inputs = array( 12345 => 'positive', -2345 => 'negative'), - // float data -/*2*/ -'float' => array( - 10.5 => 'float 1', - -10.5 => 'float 2', - .5 => 'float 3'), - // null data /*3*/ 'null' => array( @@ -109,22 +102,12 @@ array(4) { } -- Iteration 2 -- -array(3) { - [10]=> - string(7) "float 1" - [-10]=> - string(7) "float 2" - [0]=> - string(7) "float 3" -} - --- Iteration 3 -- array(1) { [""]=> string(6) "null 2" } --- Iteration 4 -- +-- Iteration 3 -- array(2) { [1]=> string(5) "boolT" @@ -132,13 +115,13 @@ array(2) { string(5) "boolF" } --- Iteration 5 -- +-- Iteration 4 -- array(1) { [""]=> string(6) "emptys" } --- Iteration 6 -- +-- Iteration 5 -- array(2) { ["string"]=> string(7) "strings" @@ -146,7 +129,7 @@ array(2) { string(7) "stringh" } --- Iteration 7 -- +-- Iteration 6 -- array(2) { ["binary1"]=> string(8) "binary 1" @@ -154,13 +137,13 @@ array(2) { string(8) "binary 2" } --- Iteration 8 -- +-- Iteration 7 -- array(1) { [""]=> string(9) "undefined" } --- Iteration 9 -- +-- Iteration 8 -- array(1) { [""]=> string(5) "unset" diff --git a/ext/standard/tests/array/array_diff_assoc_variation5.phpt b/ext/standard/tests/array/array_diff_assoc_variation5.phpt index df05e3db61..09af9cb4a5 100644 --- a/ext/standard/tests/array/array_diff_assoc_variation5.phpt +++ b/ext/standard/tests/array/array_diff_assoc_variation5.phpt @@ -8,7 +8,7 @@ Test array_diff_assoc() function : usage variations - compare integers, floats a echo "*** Testing array_diff_assoc() : usage variations ***\n"; $arr_default_int = array(1, 2, 3, 'a'); -$arr_float = array(0 => 1.00, 1.00 => 2.00, 2.00 => 3.00, 'b'); +$arr_float = array(0 => 1.00, 1 => 2.00, 2 => 3.00, 'b'); $arr_string = array('1', '2', '3', 'c'); $arr_string_float = array('0' => '1.00', '1.00' => '2.00', '2.00' => '3.00', 'd'); diff --git a/ext/standard/tests/array/array_diff_key_variation5.phpt b/ext/standard/tests/array/array_diff_key_variation5.phpt deleted file mode 100644 index 2ba1da22b9..0000000000 --- a/ext/standard/tests/array/array_diff_key_variation5.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Test array_diff_key() function : usage variation - Passing float indexed array ---FILE-- -<?php -echo "*** Testing array_diff_key() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$input_array = array(0 => '0', 10 => '10', -10 => '-10', 20 =>'20', -20 => '-20'); -$float_indx_array = array(0.0 => '0.0', 10.5 => '10.5', -10.5 => '-10.5', 0.5 => '0.5'); - -echo "\n-- Testing array_diff_key() function with float indexed array --\n"; -// loop through each element of the array for arr1 -var_dump( array_diff_key($input_array, $float_indx_array) ); -var_dump( array_diff_key($float_indx_array, $input_array) ); -?> ---EXPECT-- -*** Testing array_diff_key() : usage variation *** - --- Testing array_diff_key() function with float indexed array -- -array(2) { - [20]=> - string(2) "20" - [-20]=> - string(3) "-20" -} -array(0) { -} diff --git a/ext/standard/tests/array/array_diff_uassoc_variation10.phpt b/ext/standard/tests/array/array_diff_uassoc_variation10.phpt deleted file mode 100644 index 79e5a202c6..0000000000 --- a/ext/standard/tests/array/array_diff_uassoc_variation10.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -Test array_diff_uassoc() function : usage variation - Passing float indexed array ---FILE-- -<?php -echo "*** Testing array_diff_uassoc() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$input_array = array(0 => '0', 10 => '10', -10 => '-10', 20 =>'20', -20 => '-20'); -$float_indx_array = array(0.0 => '0.0', 10.5 => '10.5', -10.5 => '-10.5', 0.5 => '0.5'); - -echo "\n-- Testing array_diff_key() function with float indexed array --\n"; -var_dump( array_diff_uassoc($input_array, $float_indx_array, "strcasecmp") ); -var_dump( array_diff_uassoc($float_indx_array, $input_array, "strcasecmp") ); - -?> ---EXPECT-- -*** Testing array_diff_uassoc() : usage variation *** - --- Testing array_diff_key() function with float indexed array -- -array(5) { - [0]=> - string(1) "0" - [10]=> - string(2) "10" - [-10]=> - string(3) "-10" - [20]=> - string(2) "20" - [-20]=> - string(3) "-20" -} -array(3) { - [0]=> - string(3) "0.5" - [10]=> - string(4) "10.5" - [-10]=> - string(5) "-10.5" -} diff --git a/ext/standard/tests/array/array_diff_uassoc_variation5.phpt b/ext/standard/tests/array/array_diff_uassoc_variation5.phpt index d2500113de..ee7b96d4e3 100644 --- a/ext/standard/tests/array/array_diff_uassoc_variation5.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_variation5.phpt @@ -6,7 +6,7 @@ echo "*** Testing array_diff_uassoc() : usage variation ***\n"; //Initialize variables $arr_default_int = array(1, 2, 3, 4); -$arr_float = array(0 => 1.00, 1.00 => 2.00, 2.00 => 3.00, 3.00 => 4.00); +$arr_float = array(0 => 1.00, 1 => 2.00, 2 => 3.00, 3 => 4.00); function key_compare_func($key1, $key2) diff --git a/ext/standard/tests/array/array_diff_uassoc_variation6.phpt b/ext/standard/tests/array/array_diff_uassoc_variation6.phpt index 9e21fa0de3..177f7522e4 100644 --- a/ext/standard/tests/array/array_diff_uassoc_variation6.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_variation6.phpt @@ -5,7 +5,7 @@ Test array_diff_uassoc() function : usage variation - Comparing floating points echo "*** Testing array_diff_uassoc() : usage variation ***\n"; //Initialize variables -$arr_float = array(0 => 1.00, 1.00 => 2.00); +$arr_float = array(0 => 1.00, 1 => 2.00); $arr_string_int = array('1', '2'); $arr_string_float = array('0' => '1.00', '1.00' => '2.00'); diff --git a/ext/standard/tests/array/array_diff_ukey_variation7.phpt b/ext/standard/tests/array/array_diff_ukey_variation7.phpt deleted file mode 100644 index c534c2b36e..0000000000 --- a/ext/standard/tests/array/array_diff_ukey_variation7.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -Test array_diff_ukey() function : usage variation - Passing float indexed array ---FILE-- -<?php -echo "*** Testing array_diff_ukey() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$input_array = array(0 => '0', 10 => '10', -10 => '-10', 20 =>'20'); -$float_indx_array = array(0.0 => '0.0', 10.5 => '10.5', -30.5 => '-30.5'); - -function key_compare_func($key1, $key2) -{ - return strcasecmp($key1, $key2); -} - -echo "\n-- Testing array_diff_ukey() function with float indexed array --\n"; - -var_dump( array_diff_ukey($float_indx_array, $input_array, 'key_compare_func') ); -var_dump( array_diff_ukey($input_array, $float_indx_array, 'key_compare_func') ); - -?> ---EXPECT-- -*** Testing array_diff_ukey() : usage variation *** - --- Testing array_diff_ukey() function with float indexed array -- -array(1) { - [-30]=> - string(5) "-30.5" -} -array(2) { - [-10]=> - string(3) "-10" - [20]=> - string(2) "20" -} diff --git a/ext/standard/tests/array/array_diff_variation8.phpt b/ext/standard/tests/array/array_diff_variation8.phpt index 80d3bf87ec..5a1b2c4f30 100644 --- a/ext/standard/tests/array/array_diff_variation8.phpt +++ b/ext/standard/tests/array/array_diff_variation8.phpt @@ -41,8 +41,8 @@ $inputs = array ( array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 1.2), // arrays with string values -/*5*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "\tHello"), - array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => '\tHello'), +/*5*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3 => "\tHello"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3 => '\tHello'), array(1 => "hello", "heredoc" => $heredoc, $heredoc), // array with object, unset variable and resource variable diff --git a/ext/standard/tests/array/array_fill.phpt b/ext/standard/tests/array/array_fill.phpt index 4f2aa41b01..901b03b8b5 100644 --- a/ext/standard/tests/array/array_fill.phpt +++ b/ext/standard/tests/array/array_fill.phpt @@ -11,7 +11,7 @@ foreach($array1 as $start) foreach($array2 as $value) { echo '==========================='."\n"; - echo 'start: '.$start.' num: '.$num.' value: '.$value."\n"; + echo 'start: '.$start.' num: '.$num.' value: '. var_dump($value); $output = array_fill($start, $num, $value); var_dump($output); } @@ -20,324 +20,324 @@ foreach($array1 as $start) ?> --EXPECT-- =========================== -start: 0 num: 0 value: 1 -array(0) { +bool(true) +start: 0 num: 0 value: array(0) { } =========================== -start: 0 num: 0 value: -array(0) { +bool(false) +start: 0 num: 0 value: array(0) { } =========================== -start: 0 num: 0 value: -array(0) { +NULL +start: 0 num: 0 value: array(0) { } =========================== -start: 0 num: 0 value: d -array(0) { +string(1) "d" +start: 0 num: 0 value: array(0) { } =========================== -start: 0 num: 0 value: e -array(0) { +string(1) "e" +start: 0 num: 0 value: array(0) { } =========================== -start: 0 num: 0 value: f -array(0) { +string(1) "f" +start: 0 num: 0 value: array(0) { } =========================== -start: 0 num: 1 value: 1 -array(1) { +bool(true) +start: 0 num: 1 value: array(1) { [0]=> bool(true) } =========================== -start: 0 num: 1 value: -array(1) { +bool(false) +start: 0 num: 1 value: array(1) { [0]=> bool(false) } =========================== -start: 0 num: 1 value: -array(1) { +NULL +start: 0 num: 1 value: array(1) { [0]=> NULL } =========================== -start: 0 num: 1 value: d -array(1) { +string(1) "d" +start: 0 num: 1 value: array(1) { [0]=> string(1) "d" } =========================== -start: 0 num: 1 value: e -array(1) { +string(1) "e" +start: 0 num: 1 value: array(1) { [0]=> string(1) "e" } =========================== -start: 0 num: 1 value: f -array(1) { +string(1) "f" +start: 0 num: 1 value: array(1) { [0]=> string(1) "f" } =========================== -start: 0 num: 2.5 value: 1 -array(2) { +bool(true) +start: 0 num: 2.5 value: array(2) { [0]=> bool(true) [1]=> bool(true) } =========================== -start: 0 num: 2.5 value: -array(2) { +bool(false) +start: 0 num: 2.5 value: array(2) { [0]=> bool(false) [1]=> bool(false) } =========================== -start: 0 num: 2.5 value: -array(2) { +NULL +start: 0 num: 2.5 value: array(2) { [0]=> NULL [1]=> NULL } =========================== -start: 0 num: 2.5 value: d -array(2) { +string(1) "d" +start: 0 num: 2.5 value: array(2) { [0]=> string(1) "d" [1]=> string(1) "d" } =========================== -start: 0 num: 2.5 value: e -array(2) { +string(1) "e" +start: 0 num: 2.5 value: array(2) { [0]=> string(1) "e" [1]=> string(1) "e" } =========================== -start: 0 num: 2.5 value: f -array(2) { +string(1) "f" +start: 0 num: 2.5 value: array(2) { [0]=> string(1) "f" [1]=> string(1) "f" } =========================== -start: 1 num: 0 value: 1 -array(0) { +bool(true) +start: 1 num: 0 value: array(0) { } =========================== -start: 1 num: 0 value: -array(0) { +bool(false) +start: 1 num: 0 value: array(0) { } =========================== -start: 1 num: 0 value: -array(0) { +NULL +start: 1 num: 0 value: array(0) { } =========================== -start: 1 num: 0 value: d -array(0) { +string(1) "d" +start: 1 num: 0 value: array(0) { } =========================== -start: 1 num: 0 value: e -array(0) { +string(1) "e" +start: 1 num: 0 value: array(0) { } =========================== -start: 1 num: 0 value: f -array(0) { +string(1) "f" +start: 1 num: 0 value: array(0) { } =========================== -start: 1 num: 1 value: 1 -array(1) { +bool(true) +start: 1 num: 1 value: array(1) { [1]=> bool(true) } =========================== -start: 1 num: 1 value: -array(1) { +bool(false) +start: 1 num: 1 value: array(1) { [1]=> bool(false) } =========================== -start: 1 num: 1 value: -array(1) { +NULL +start: 1 num: 1 value: array(1) { [1]=> NULL } =========================== -start: 1 num: 1 value: d -array(1) { +string(1) "d" +start: 1 num: 1 value: array(1) { [1]=> string(1) "d" } =========================== -start: 1 num: 1 value: e -array(1) { +string(1) "e" +start: 1 num: 1 value: array(1) { [1]=> string(1) "e" } =========================== -start: 1 num: 1 value: f -array(1) { +string(1) "f" +start: 1 num: 1 value: array(1) { [1]=> string(1) "f" } =========================== -start: 1 num: 2.5 value: 1 -array(2) { +bool(true) +start: 1 num: 2.5 value: array(2) { [1]=> bool(true) [2]=> bool(true) } =========================== -start: 1 num: 2.5 value: -array(2) { +bool(false) +start: 1 num: 2.5 value: array(2) { [1]=> bool(false) [2]=> bool(false) } =========================== -start: 1 num: 2.5 value: -array(2) { +NULL +start: 1 num: 2.5 value: array(2) { [1]=> NULL [2]=> NULL } =========================== -start: 1 num: 2.5 value: d -array(2) { +string(1) "d" +start: 1 num: 2.5 value: array(2) { [1]=> string(1) "d" [2]=> string(1) "d" } =========================== -start: 1 num: 2.5 value: e -array(2) { +string(1) "e" +start: 1 num: 2.5 value: array(2) { [1]=> string(1) "e" [2]=> string(1) "e" } =========================== -start: 1 num: 2.5 value: f -array(2) { +string(1) "f" +start: 1 num: 2.5 value: array(2) { [1]=> string(1) "f" [2]=> string(1) "f" } =========================== -start: 2.5 num: 0 value: 1 -array(0) { +bool(true) +start: 2.5 num: 0 value: array(0) { } =========================== -start: 2.5 num: 0 value: -array(0) { +bool(false) +start: 2.5 num: 0 value: array(0) { } =========================== -start: 2.5 num: 0 value: -array(0) { +NULL +start: 2.5 num: 0 value: array(0) { } =========================== -start: 2.5 num: 0 value: d -array(0) { +string(1) "d" +start: 2.5 num: 0 value: array(0) { } =========================== -start: 2.5 num: 0 value: e -array(0) { +string(1) "e" +start: 2.5 num: 0 value: array(0) { } =========================== -start: 2.5 num: 0 value: f -array(0) { +string(1) "f" +start: 2.5 num: 0 value: array(0) { } =========================== -start: 2.5 num: 1 value: 1 -array(1) { +bool(true) +start: 2.5 num: 1 value: array(1) { [2]=> bool(true) } =========================== -start: 2.5 num: 1 value: -array(1) { +bool(false) +start: 2.5 num: 1 value: array(1) { [2]=> bool(false) } =========================== -start: 2.5 num: 1 value: -array(1) { +NULL +start: 2.5 num: 1 value: array(1) { [2]=> NULL } =========================== -start: 2.5 num: 1 value: d -array(1) { +string(1) "d" +start: 2.5 num: 1 value: array(1) { [2]=> string(1) "d" } =========================== -start: 2.5 num: 1 value: e -array(1) { +string(1) "e" +start: 2.5 num: 1 value: array(1) { [2]=> string(1) "e" } =========================== -start: 2.5 num: 1 value: f -array(1) { +string(1) "f" +start: 2.5 num: 1 value: array(1) { [2]=> string(1) "f" } =========================== -start: 2.5 num: 2.5 value: 1 -array(2) { +bool(true) +start: 2.5 num: 2.5 value: array(2) { [2]=> bool(true) [3]=> bool(true) } =========================== -start: 2.5 num: 2.5 value: -array(2) { +bool(false) +start: 2.5 num: 2.5 value: array(2) { [2]=> bool(false) [3]=> bool(false) } =========================== -start: 2.5 num: 2.5 value: -array(2) { +NULL +start: 2.5 num: 2.5 value: array(2) { [2]=> NULL [3]=> NULL } =========================== -start: 2.5 num: 2.5 value: d -array(2) { +string(1) "d" +start: 2.5 num: 2.5 value: array(2) { [2]=> string(1) "d" [3]=> string(1) "d" } =========================== -start: 2.5 num: 2.5 value: e -array(2) { +string(1) "e" +start: 2.5 num: 2.5 value: array(2) { [2]=> string(1) "e" [3]=> string(1) "e" } =========================== -start: 2.5 num: 2.5 value: f -array(2) { +string(1) "f" +start: 2.5 num: 2.5 value: array(2) { [2]=> string(1) "f" [3]=> diff --git a/ext/standard/tests/array/array_filter_variation3.phpt b/ext/standard/tests/array/array_filter_variation3.phpt index 087267f566..a81bb35951 100644 --- a/ext/standard/tests/array/array_filter_variation3.phpt +++ b/ext/standard/tests/array/array_filter_variation3.phpt @@ -27,7 +27,7 @@ $input_values = array( array(true, false, TRUE, FALSE), // bool values array(null, NULL), // null values array(1 => 'one', 'zero' => 0, -2 => "value"), //associative array - array("one" => 1, null => 'null', 5.2 => "float", true => 1, "" => 'empty'), // associative array with different keys + array("one" => 1, null => 'null', 5 => "float", true => 1, "" => 'empty'), // associative array with different keys array(1 => 'one', 2, "key" => 'value') // combinition of associative and non-associative array ); diff --git a/ext/standard/tests/array/array_filter_variation9.phpt b/ext/standard/tests/array/array_filter_variation9.phpt index f5158e337c..d9abf7dac1 100644 --- a/ext/standard/tests/array/array_filter_variation9.phpt +++ b/ext/standard/tests/array/array_filter_variation9.phpt @@ -8,7 +8,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, null); +$input = array(0, 1, -1, 10, 100, 1000); // using built-in function 'is_int' as 'callback' var_dump( array_filter($input, 'is_int') ); @@ -48,7 +48,7 @@ array(6) { [5]=> int(1000) } -array(7) { +array(6) { [0]=> int(0) [1]=> @@ -61,8 +61,6 @@ array(7) { int(100) [5]=> int(1000) - [6]=> - NULL } array_filter(): Argument #2 ($callback) must be a valid callback, function "echo" not found or invalid function name array_filter(): Argument #2 ($callback) must be a valid callback, function "exit" not found or invalid function name diff --git a/ext/standard/tests/array/array_flip_variation5.phpt b/ext/standard/tests/array/array_flip_variation5.phpt index 49be7de903..e7c47dffa5 100644 --- a/ext/standard/tests/array/array_flip_variation5.phpt +++ b/ext/standard/tests/array/array_flip_variation5.phpt @@ -9,7 +9,7 @@ Test array_flip() function : usage variations - 'input' argument with repeatitiv echo "*** Testing array_flip() : 'input' array with repeatitive keys/values ***\n"; // array with numeric key repeatition -$input = array(1 => 'value', 2 => 'VALUE', 1 => "VaLuE", 3.4 => 4, 3.4 => 5); +$input = array(1 => 'value', 2 => 'VALUE', 1 => "VaLuE", 3 => 4, 3 => 5); var_dump( array_flip($input) ); // array with string key repeatition diff --git a/ext/standard/tests/array/array_intersect_assoc_variation5.phpt b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt index 78b22b8ca6..ad0c29b6b5 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation5.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt @@ -30,12 +30,6 @@ $arrays = array ( array(1 => "1"), array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), - // arrays with float keys -/*5*/ array(2.3333 => "float"), - array(1.2 => "f1", 3.33 => "f2", - 4.89999922839999 => "f3", - 33333333.333333 => "f4"), - // arrays with string keys /*7*/ array('\tHello' => 111, 're\td' => "color", '\v\fworld' => 2.2, 'pen\n' => 33), @@ -100,33 +94,11 @@ array(0) { array(0) { } -- Iteration 5 -- -array(1) { - [2]=> - string(5) "float" -} -array(1) { - [2]=> - string(5) "float" -} --- Iteration 6 -- -array(2) { - [4]=> - string(2) "f3" - [33333333]=> - string(2) "f4" -} -array(2) { - [4]=> - string(2) "f3" - [33333333]=> - string(2) "f4" -} --- Iteration 7 -- array(0) { } array(0) { } --- Iteration 8 -- +-- Iteration 6 -- array(2) { [" Hello"]=> int(111) @@ -141,7 +113,7 @@ array(2) { "]=> int(33) } --- Iteration 9 -- +-- Iteration 7 -- array(1) { ["Hello world"]=> string(6) "string" @@ -150,12 +122,12 @@ array(1) { ["Hello world"]=> string(6) "string" } --- Iteration 10 -- +-- Iteration 8 -- array(0) { } array(0) { } --- Iteration 11 -- +-- Iteration 9 -- array(1) { [133]=> string(3) "int" diff --git a/ext/standard/tests/array/array_intersect_assoc_variation6.phpt b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt index 396fe1fadc..57c3843d1f 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation6.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt @@ -30,12 +30,6 @@ $arrays = array ( array(1 => "1"), array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), - // arrays with float keys -/*5*/ array(2.3333 => "float"), - array(1.2 => "f1", 3.33 => "f2", - 4.89999922839999 => "f3", - 33333333.333333 => "f4"), - // arrays with string keys /*7*/ array('\tHello' => 111, 're\td' => "color", '\v\fworld' => 2.2, 'pen\n' => 33), @@ -100,33 +94,11 @@ array(0) { array(0) { } -- Iteration 5 -- -array(1) { - [2]=> - string(5) "float" -} -array(1) { - [2]=> - string(5) "float" -} --- Iteration 6 -- -array(2) { - [4]=> - string(2) "f3" - [33333333]=> - string(2) "f4" -} -array(2) { - [4]=> - string(2) "f3" - [33333333]=> - string(2) "f4" -} --- Iteration 7 -- array(0) { } array(0) { } --- Iteration 8 -- +-- Iteration 6 -- array(2) { [" Hello"]=> int(111) @@ -141,7 +113,7 @@ array(2) { "]=> int(33) } --- Iteration 9 -- +-- Iteration 7 -- array(1) { ["Hello world"]=> string(6) "string" @@ -150,12 +122,12 @@ array(1) { ["Hello world"]=> string(6) "string" } --- Iteration 10 -- +-- Iteration 8 -- array(0) { } array(0) { } --- Iteration 11 -- +-- Iteration 9 -- array(1) { [133]=> string(3) "int" diff --git a/ext/standard/tests/array/array_intersect_assoc_variation7.phpt b/ext/standard/tests/array/array_intersect_assoc_variation7.phpt index f512bf497d..f971b356ba 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation7.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation7.phpt @@ -46,8 +46,8 @@ $arrays = array ( array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333), // arrays with string values -/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), - array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), +/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3 => "pen\n"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3 => 'pen\n'), array(1 => "hello", "heredoc" => $heredoc), // array with object, unset variable and resource variable @@ -61,7 +61,7 @@ $arrays = array ( // array to be passsed to $arr2 argument $arr2 = array(0 => "0", 1, "two" => 2, "float" => 2.3333, "f1" => 1.2, - "f4" => 33333333.333, 111 => "\tHello", 3.3 => 'pen\n', '\v\fworld', + "f4" => 33333333.333, 111 => "\tHello", 3 => 'pen\n', '\v\fworld', "heredoc" => "Hello world", 11 => new classA(), "resource" => $fp, "int" => 133, 222 => "fruit"); diff --git a/ext/standard/tests/array/array_intersect_assoc_variation8.phpt b/ext/standard/tests/array/array_intersect_assoc_variation8.phpt index 8f46864c89..c4a26c09d5 100644 --- a/ext/standard/tests/array/array_intersect_assoc_variation8.phpt +++ b/ext/standard/tests/array/array_intersect_assoc_variation8.phpt @@ -46,8 +46,8 @@ $arrays = array ( array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333), // arrays with string values -/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), - array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), +/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3 => "pen\n"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3 => 'pen\n'), array(1 => "hello", "heredoc" => $heredoc), // array with object, unset variable and resource variable @@ -61,7 +61,7 @@ $arrays = array ( // array to be passsed to $arr1 argument $arr1 = array(0 => "0", 1, "two" => 2, "float" => 2.3333, "f1" => 1.2, - "f4" => 33333333.333, 111 => "\tHello", 3.3 => 'pen\n', '\v\fworld', + "f4" => 33333333.333, 111 => "\tHello", 3 => 'pen\n', '\v\fworld', "heredoc" => "Hello world", 11 => new classA(), "resource" => $fp, "int" => 133, 222 => "fruit"); diff --git a/ext/standard/tests/array/array_intersect_key_variation5.phpt b/ext/standard/tests/array/array_intersect_key_variation5.phpt deleted file mode 100644 index 05788d7abb..0000000000 --- a/ext/standard/tests/array/array_intersect_key_variation5.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Test array_intersect_key() function : usage variation - Passing float indexed array ---FILE-- -<?php -echo "*** Testing array_intersect_key() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$input_array = array(0 => '0', 10 => '10' , -10 => '-10'); -$float_indx_array = array(0.0 => '0.0', 10.5 => '10.5' , -10.5 => '-10.5', 0.5 => '0.5'); - -echo "\n-- Testing array_intersect_key() function with float indexed array --\n"; -var_dump( array_intersect_key($input_array, $float_indx_array) ); -var_dump( array_intersect_key($float_indx_array,$input_array ) ); -?> ---EXPECT-- -*** Testing array_intersect_key() : usage variation *** - --- Testing array_intersect_key() function with float indexed array -- -array(3) { - [0]=> - string(1) "0" - [10]=> - string(2) "10" - [-10]=> - string(3) "-10" -} -array(3) { - [0]=> - string(3) "0.5" - [10]=> - string(4) "10.5" - [-10]=> - string(5) "-10.5" -} diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation5.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation5.phpt index e936f8a883..c46aaa3162 100644 --- a/ext/standard/tests/array/array_intersect_uassoc_variation5.phpt +++ b/ext/standard/tests/array/array_intersect_uassoc_variation5.phpt @@ -6,7 +6,7 @@ echo "*** Testing array_intersect_uassoc() : usage variation ***\n"; //Initialize variables $arr_default_int = array(1, 2 ); -$arr_float = array(0 => 1.00, 1.00 => 2.00, 2.00 => 3.00); +$arr_float = array(0 => 1.00, 1 => 2.00, 2 => 3.00); $arr_string = array('1', '2', '3'); $arr_string_float = array('1.00', '2.00'); diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation6.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation6.phpt index 7a6a2ea714..e286c8e9e7 100644 --- a/ext/standard/tests/array/array_intersect_uassoc_variation6.phpt +++ b/ext/standard/tests/array/array_intersect_uassoc_variation6.phpt @@ -5,7 +5,7 @@ Test array_intersect_uassoc() function : usage variation - Intersection of float echo "*** Testing array_intersect_uassoc() : usage variation ***\n"; //Initialize variables -$arr_float = array(0 => 1.00, 1.00 => 2.00); +$arr_float = array(0 => 1.00, 1 => 2.00); $arr_string = array('1', '2', '3'); $arr_string_float = array('1.00', '2.00'); diff --git a/ext/standard/tests/array/array_intersect_ukey_variation5.phpt b/ext/standard/tests/array/array_intersect_ukey_variation5.phpt index 1839e7b4ba..f3fd8abd5c 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation5.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation5.phpt @@ -6,7 +6,7 @@ echo "*** Testing array_intersect_ukey() : usage variation ***\n"; //Initialize variables $arr_default_int = array(1, 2 ); -$arr_float = array(0 => 1.00, 1.00 => 2.00, 2.00 => 3.00); +$arr_float = array(0 => 1.00, 1 => 2.00, 2 => 3.00); $arr_string = array('0' => '1', '1' => '2', '2' => '3'); $arr_string_float = array('0.00' => '1.00', '1.00' => '2.00'); diff --git a/ext/standard/tests/array/array_intersect_ukey_variation6.phpt b/ext/standard/tests/array/array_intersect_ukey_variation6.phpt index abdf7e96ad..e843da4277 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation6.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation6.phpt @@ -5,7 +5,7 @@ Test array_intersect_ukey() function : usage variation - Intersection of floatin echo "*** Testing array_intersect_ukey() : usage variation ***\n"; //Initialize variables -$arr_float = array(0.00 => 1.00, 1.00 => 2.00); +$arr_float = array(0 => 1.00, 1 => 2.00); $arr_string = array('0' => '1', '1' => '2', '2' => '3'); $arr_string_float = array('0.00' => '1.00', '1.00' => '2.00'); diff --git a/ext/standard/tests/array/array_intersect_variation5.phpt b/ext/standard/tests/array/array_intersect_variation5.phpt index 67efa2bf75..04eb9b43c3 100644 --- a/ext/standard/tests/array/array_intersect_variation5.phpt +++ b/ext/standard/tests/array/array_intersect_variation5.phpt @@ -30,12 +30,6 @@ $arrays = array ( array(1 => "1"), array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), - // arrays with float keys -/*5*/ array(2.3333 => "float"), - array(1.2 => "f1", 3.33 => "f2", - 4.89999922839999 => "f3", - 33333333.333333 => "f4"), - // arrays with string keys /*7*/ array('\tHello' => 111, 're\td' => "color", '\v\fworld' => 2.2, 'pen\n' => 33), @@ -102,24 +96,6 @@ array(1) { string(1) "1" } -- Iterator 5 -- -array(1) { - [2]=> - string(5) "float" -} -array(1) { - [2]=> - string(5) "float" -} --- Iterator 6 -- -array(1) { - [33333333]=> - string(2) "f4" -} -array(1) { - [33333333]=> - string(2) "f4" -} --- Iterator 7 -- array(2) { ["re\td"]=> string(5) "color" @@ -132,7 +108,7 @@ array(2) { ["\v\fworld"]=> float(2.2) } --- Iterator 8 -- +-- Iterator 6 -- array(2) { ["re d"]=> string(5) "color" @@ -145,7 +121,7 @@ array(2) { ["world"]=> float(2.2) } --- Iterator 9 -- +-- Iterator 7 -- array(2) { [0]=> string(5) "hello" @@ -158,7 +134,7 @@ array(2) { ["Hello world"]=> string(6) "string" } --- Iterator 10 -- +-- Iterator 8 -- array(1) { [""]=> string(5) "hello" @@ -167,7 +143,7 @@ array(1) { [""]=> string(5) "hello" } --- Iterator 11 -- +-- Iterator 9 -- array(3) { ["hello"]=> int(1) diff --git a/ext/standard/tests/array/array_intersect_variation6.phpt b/ext/standard/tests/array/array_intersect_variation6.phpt index 0dea24b7cb..b35a6ce076 100644 --- a/ext/standard/tests/array/array_intersect_variation6.phpt +++ b/ext/standard/tests/array/array_intersect_variation6.phpt @@ -30,12 +30,6 @@ $arrays = array ( array(1 => "1"), array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), - // arrays with float keys -/*5*/ array(2.3333 => "float"), - array(1.2 => "f1", 3.33 => "f2", - 4.89999922839999 => "f3", - 33333333.333333 => "f4"), - // arrays with string keys /*7*/ array('\tHello' => 111, 're\td' => "color", '\v\fworld' => 2.2, 'pen\n' => 33), @@ -102,24 +96,6 @@ array(1) { int(1) } -- Iterator 5 -- -array(1) { - [1]=> - string(5) "float" -} -array(1) { - [1]=> - string(5) "float" -} --- Iterator 6 -- -array(1) { - [2]=> - string(2) "f4" -} -array(1) { - [2]=> - string(2) "f4" -} --- Iterator 7 -- array(2) { [4]=> float(2.2) @@ -132,7 +108,7 @@ array(2) { [5]=> string(5) "color" } --- Iterator 8 -- +-- Iterator 6 -- array(2) { [4]=> float(2.2) @@ -145,7 +121,7 @@ array(2) { [5]=> string(5) "color" } --- Iterator 9 -- +-- Iterator 7 -- array(2) { [3]=> string(5) "hello" @@ -158,7 +134,7 @@ array(2) { [6]=> string(6) "string" } --- Iterator 10 -- +-- Iterator 8 -- array(1) { [3]=> string(5) "hello" @@ -167,7 +143,7 @@ array(1) { [3]=> string(5) "hello" } --- Iterator 11 -- +-- Iterator 9 -- array(3) { [0]=> int(1) diff --git a/ext/standard/tests/array/array_intersect_variation7.phpt b/ext/standard/tests/array/array_intersect_variation7.phpt index 5e3b19aac8..559783b96c 100644 --- a/ext/standard/tests/array/array_intersect_variation7.phpt +++ b/ext/standard/tests/array/array_intersect_variation7.phpt @@ -46,8 +46,8 @@ $arrays = array ( array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333333), // arrays with string values -/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), - array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), +/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3 => "pen\n"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3 => 'pen\n'), array(1 => "hello", "heredoc" => $heredoc), // array with object, unset variable and resource variable diff --git a/ext/standard/tests/array/array_intersect_variation8.phpt b/ext/standard/tests/array/array_intersect_variation8.phpt index bdd98d92a9..319804bbc7 100644 --- a/ext/standard/tests/array/array_intersect_variation8.phpt +++ b/ext/standard/tests/array/array_intersect_variation8.phpt @@ -46,8 +46,8 @@ $arrays = array ( array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333333), // arrays with string values -/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), - array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), +/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3 => "pen\n"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3 => 'pen\n'), array(1 => "hello", "heredoc" => $heredoc), // array with object, unset variable and resource variable diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt index 3e0e5ffaaa..d6f9ca13de 100644 --- a/ext/standard/tests/array/array_key_exists.phpt +++ b/ext/standard/tests/array/array_key_exists.phpt @@ -12,7 +12,6 @@ $search_arrays = array( array("Name" => "Jack", "Loc" => "Mars", "Id" => "MS123"), array('Red' => 'Rose', 'I' => 'You'), array(0 => 'Zero', 1 => 'One', 2 => 'Two', 3 => "Three" ), - array(0.1 => 'Zero', 1.1 => 'One', 2.2 => 'Two', 3.3 => "Three" ) ); /* keys to search in $search_arrays. $keys[0] is the key to be searched in $search_arrays[0] and so on */ @@ -99,8 +98,6 @@ bool(true) bool(true) -- Iteration 7 -- bool(true) --- Iteration 8 -- -bool(true) *** Testing possible variations *** @@ -161,14 +158,6 @@ bool(false) bool(false) bool(false) bool(true) --- Iteration 8 -- -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(true) ** Variation loop 2 ** -- Iteration 1 -- diff --git a/ext/standard/tests/array/array_key_exists_variation1.phpt b/ext/standard/tests/array/array_key_exists_variation1.phpt index eef48998fb..3a410258bb 100644 --- a/ext/standard/tests/array/array_key_exists_variation1.phpt +++ b/ext/standard/tests/array/array_key_exists_variation1.phpt @@ -40,13 +40,6 @@ $inputs = array( 12345, -2345, - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - // null data /*10*/ NULL, null, @@ -112,13 +105,13 @@ bool(false) bool(false) -- Iteration 5 -- -bool(true) +bool(false) -- Iteration 6 -- bool(false) -- Iteration 7 -- -bool(false) +bool(true) -- Iteration 8 -- bool(true) @@ -127,16 +120,16 @@ bool(true) bool(true) -- Iteration 10 -- -bool(false) +bool(true) -- Iteration 11 -- bool(false) -- Iteration 12 -- -bool(true) +bool(false) -- Iteration 13 -- -bool(true) +Illegal offset type -- Iteration 14 -- bool(true) @@ -145,33 +138,18 @@ bool(true) bool(true) -- Iteration 16 -- -bool(false) - --- Iteration 17 -- -bool(false) - --- Iteration 18 -- -Illegal offset type - --- Iteration 19 -- -bool(true) - --- Iteration 20 -- -bool(true) - --- Iteration 21 -- bool(true) --- Iteration 22 -- +-- Iteration 17 -- Illegal offset type --- Iteration 23 -- +-- Iteration 18 -- bool(false) --- Iteration 24 -- +-- Iteration 19 -- bool(false) --- Iteration 25 -- +-- Iteration 20 -- Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d bool(false) diff --git a/ext/standard/tests/array/array_key_exists_variation8.phpt b/ext/standard/tests/array/array_key_exists_variation8.phpt index 8aa4c74896..417b56aae8 100644 --- a/ext/standard/tests/array/array_key_exists_variation8.phpt +++ b/ext/standard/tests/array/array_key_exists_variation8.phpt @@ -30,18 +30,6 @@ $inputs = array( -2345 => 'negative', ), - // float data -/*2*/ 'float' => array( - 10.5 => 'positive', - -10.5 => 'negative', - .5 => 'half', - ), - - 'extreme floats' => array( - 12.3456789000e10 => 'large', - 12.3456789000E-10 => 'small', - ), - // null data /*3*/ 'null uppercase' => array( NULL => 'null 1', @@ -112,13 +100,6 @@ bool(true) bool(true) bool(true) bool(true) --- $key arguments are float data: -bool(false) -bool(false) -bool(true) --- $key arguments are extreme floats data: -bool(false) -bool(true) -- $key arguments are null uppercase data: bool(false) -- $key arguments are null lowercase data: @@ -142,91 +123,12 @@ bool(false) -- $key arguments are unset data: bool(false) --- Iteration 2: float data -- --- $key arguments are int data: -bool(true) -bool(false) -bool(false) -bool(false) --- $key arguments are float data: -bool(true) -bool(true) -bool(true) --- $key arguments are extreme floats data: -bool(false) -bool(true) --- $key arguments are null uppercase data: -bool(false) --- $key arguments are null lowercase data: -bool(false) --- $key arguments are bool lowercase data: -bool(false) -bool(true) --- $key arguments are bool uppercase data: -bool(false) -bool(true) --- $key arguments are empty double quotes data: -bool(false) --- $key arguments are empty single quotes data: -bool(false) --- $key arguments are string data: -bool(false) -bool(false) -bool(false) --- $key arguments are undefined data: -bool(false) --- $key arguments are unset data: -bool(false) - --- Iteration 3: extreme floats data -- --- $key arguments are int data: -bool(true) -bool(false) -bool(false) -bool(false) --- $key arguments are float data: -bool(false) -bool(false) -bool(true) --- $key arguments are extreme floats data: -bool(true) -bool(true) --- $key arguments are null uppercase data: -bool(false) --- $key arguments are null lowercase data: -bool(false) --- $key arguments are bool lowercase data: -bool(false) -bool(true) --- $key arguments are bool uppercase data: -bool(false) -bool(true) --- $key arguments are empty double quotes data: -bool(false) --- $key arguments are empty single quotes data: -bool(false) --- $key arguments are string data: -bool(false) -bool(false) -bool(false) --- $key arguments are undefined data: -bool(false) --- $key arguments are unset data: -bool(false) - --- Iteration 4: null uppercase data -- +-- Iteration 2: null uppercase data -- -- $key arguments are int data: bool(false) bool(false) bool(false) bool(false) --- $key arguments are float data: -bool(false) -bool(false) -bool(false) --- $key arguments are extreme floats data: -bool(false) -bool(false) -- $key arguments are null uppercase data: bool(true) -- $key arguments are null lowercase data: @@ -250,19 +152,12 @@ bool(true) -- $key arguments are unset data: bool(true) --- Iteration 5: null lowercase data -- +-- Iteration 3: null lowercase data -- -- $key arguments are int data: bool(false) bool(false) bool(false) bool(false) --- $key arguments are float data: -bool(false) -bool(false) -bool(false) --- $key arguments are extreme floats data: -bool(false) -bool(false) -- $key arguments are null uppercase data: bool(true) -- $key arguments are null lowercase data: @@ -286,19 +181,12 @@ bool(true) -- $key arguments are unset data: bool(true) --- Iteration 6: bool lowercase data -- +-- Iteration 4: bool lowercase data -- -- $key arguments are int data: bool(true) bool(true) bool(false) bool(false) --- $key arguments are float data: -bool(false) -bool(false) -bool(true) --- $key arguments are extreme floats data: -bool(false) -bool(true) -- $key arguments are null uppercase data: bool(false) -- $key arguments are null lowercase data: @@ -322,19 +210,12 @@ bool(false) -- $key arguments are unset data: bool(false) --- Iteration 7: bool uppercase data -- +-- Iteration 5: bool uppercase data -- -- $key arguments are int data: bool(true) bool(true) bool(false) bool(false) --- $key arguments are float data: -bool(false) -bool(false) -bool(true) --- $key arguments are extreme floats data: -bool(false) -bool(true) -- $key arguments are null uppercase data: bool(false) -- $key arguments are null lowercase data: @@ -358,19 +239,12 @@ bool(false) -- $key arguments are unset data: bool(false) --- Iteration 8: empty double quotes data -- +-- Iteration 6: empty double quotes data -- -- $key arguments are int data: bool(false) bool(false) bool(false) bool(false) --- $key arguments are float data: -bool(false) -bool(false) -bool(false) --- $key arguments are extreme floats data: -bool(false) -bool(false) -- $key arguments are null uppercase data: bool(true) -- $key arguments are null lowercase data: @@ -394,19 +268,12 @@ bool(true) -- $key arguments are unset data: bool(true) --- Iteration 9: empty single quotes data -- +-- Iteration 7: empty single quotes data -- -- $key arguments are int data: bool(false) bool(false) bool(false) bool(false) --- $key arguments are float data: -bool(false) -bool(false) -bool(false) --- $key arguments are extreme floats data: -bool(false) -bool(false) -- $key arguments are null uppercase data: bool(true) -- $key arguments are null lowercase data: @@ -430,19 +297,12 @@ bool(true) -- $key arguments are unset data: bool(true) --- Iteration 10: string data -- +-- Iteration 8: string data -- -- $key arguments are int data: bool(false) bool(false) bool(false) bool(false) --- $key arguments are float data: -bool(false) -bool(false) -bool(false) --- $key arguments are extreme floats data: -bool(false) -bool(false) -- $key arguments are null uppercase data: bool(false) -- $key arguments are null lowercase data: @@ -466,19 +326,12 @@ bool(false) -- $key arguments are unset data: bool(false) --- Iteration 11: undefined data -- +-- Iteration 9: undefined data -- -- $key arguments are int data: bool(false) bool(false) bool(false) bool(false) --- $key arguments are float data: -bool(false) -bool(false) -bool(false) --- $key arguments are extreme floats data: -bool(false) -bool(false) -- $key arguments are null uppercase data: bool(true) -- $key arguments are null lowercase data: @@ -502,19 +355,12 @@ bool(true) -- $key arguments are unset data: bool(true) --- Iteration 12: unset data -- +-- Iteration 10: unset data -- -- $key arguments are int data: bool(false) bool(false) bool(false) bool(false) --- $key arguments are float data: -bool(false) -bool(false) -bool(false) --- $key arguments are extreme floats data: -bool(false) -bool(false) -- $key arguments are null uppercase data: bool(true) -- $key arguments are null lowercase data: diff --git a/ext/standard/tests/array/array_key_first.phpt b/ext/standard/tests/array/array_key_first.phpt index 6235386004..d3360f6bfe 100644 --- a/ext/standard/tests/array/array_key_first.phpt +++ b/ext/standard/tests/array/array_key_first.phpt @@ -14,12 +14,12 @@ $mixed_array = array( array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ), array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), - array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", - "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), array( 12, "name", 'age', '45' ), array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, - 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 ), + 5 => 57, "5.4" => 554, "5.7" => 557 ), array( "foo" ), array( 1 => "42" ) ); @@ -31,7 +31,7 @@ $counter = 1; foreach( $mixed_array as $sub_array ) { echo "\n-- Input Array for Iteration $counter is --\n"; - print_r( $sub_array ); + var_dump( $sub_array ); echo "\nFirst key is :\n"; var_dump( array_key_first($sub_array) ); $counter++; @@ -43,190 +43,247 @@ echo"\nDone"; *** Normal testing with various array inputs *** -- Input Array for Iteration 1 is -- -Array -( -) +array(0) { +} First key is : NULL -- Input Array for Iteration 2 is -- -Array -( - [0] => 1 - [1] => 2 - [2] => 3 - [3] => 4 - [4] => 5 - [5] => 6 - [6] => 7 - [7] => 8 - [8] => 9 -) +array(9) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) +} First key is : int(0) -- Input Array for Iteration 3 is -- -Array -( - [0] => One - [1] => _Two - [2] => Three - [3] => Four - [4] => Five -) +array(5) { + [0]=> + string(3) "One" + [1]=> + string(4) "_Two" + [2]=> + string(5) "Three" + [3]=> + string(4) "Four" + [4]=> + string(4) "Five" +} First key is : int(0) -- Input Array for Iteration 4 is -- -Array -( - [0] => 6 - [1] => six - [2] => 7 - [3] => seven - [4] => 8 - [5] => eight - [6] => 9 - [7] => nine -) +array(8) { + [0]=> + int(6) + [1]=> + string(3) "six" + [2]=> + int(7) + [3]=> + string(5) "seven" + [4]=> + int(8) + [5]=> + string(5) "eight" + [6]=> + int(9) + [7]=> + string(4) "nine" +} First key is : int(0) -- Input Array for Iteration 5 is -- -Array -( - [a] => aaa - [A] => AAA - [c] => ccc - [d] => ddd - [e] => eee -) +array(5) { + ["a"]=> + string(3) "aaa" + ["A"]=> + string(3) "AAA" + ["c"]=> + string(3) "ccc" + ["d"]=> + string(3) "ddd" + ["e"]=> + string(3) "eee" +} First key is : string(1) "a" -- Input Array for Iteration 6 is -- -Array -( - [1] => one - [2] => two - [3] => three - [4] => four - [5] => five -) +array(5) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" + [4]=> + string(4) "four" + [5]=> + string(4) "five" +} First key is : int(1) -- Input Array for Iteration 7 is -- -Array -( - [1] => one - [2] => two - [3] => 7 - [4] => four - [5] => five -) +array(5) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + int(7) + [4]=> + string(4) "four" + [5]=> + string(4) "five" +} First key is : int(1) -- Input Array for Iteration 8 is -- -Array -( - [f] => fff - [1] => one - [4] => 6 - [] => 3 - [2] => float - [F] => FFF - [blank] => - [3] => 3.7 - [5] => Five - [6] => 8.6 - [4name] => jonny - [a] => -) +array(12) { + ["f"]=> + string(3) "fff" + [1]=> + string(3) "one" + [4]=> + int(6) + [""]=> + int(3) + [2]=> + string(5) "float" + ["F"]=> + string(3) "FFF" + ["blank"]=> + string(0) "" + [3]=> + float(3.7) + [5]=> + string(4) "Five" + [6]=> + float(8.6) + ["4name"]=> + string(5) "jonny" + ["a"]=> + NULL +} First key is : string(1) "f" -- Input Array for Iteration 9 is -- -Array -( - [0] => 12 - [1] => name - [2] => age - [3] => 45 -) +array(4) { + [0]=> + int(12) + [1]=> + string(4) "name" + [2]=> + string(3) "age" + [3]=> + string(2) "45" +} First key is : int(0) -- Input Array for Iteration 10 is -- -Array -( - [0] => Array - ( - [0] => oNe - [1] => tWo - [2] => 4 - ) - - [1] => Array - ( - [0] => 10 - [1] => 20 - [2] => 30 - [3] => 40 - [4] => 50 - ) - - [2] => Array - ( - ) - -) +array(3) { + [0]=> + array(3) { + [0]=> + string(3) "oNe" + [1]=> + string(3) "tWo" + [2]=> + int(4) + } + [1]=> + array(5) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + [3]=> + int(40) + [4]=> + int(50) + } + [2]=> + array(0) { + } +} First key is : int(0) -- Input Array for Iteration 11 is -- -Array -( - [one] => 2 - [three] => 3 - [0] => 3 - [1] => 4 - [3] => 33 - [4] => 44 - [5] => 57 - [6] => 6 - [5.4] => 554 - [5.7] => 557 -) +array(10) { + ["one"]=> + int(2) + ["three"]=> + int(3) + [0]=> + int(3) + [1]=> + int(4) + [3]=> + int(33) + [4]=> + int(44) + [5]=> + int(57) + [6]=> + int(6) + ["5.4"]=> + int(554) + ["5.7"]=> + int(557) +} First key is : string(3) "one" -- Input Array for Iteration 12 is -- -Array -( - [0] => foo -) +array(1) { + [0]=> + string(3) "foo" +} First key is : int(0) -- Input Array for Iteration 13 is -- -Array -( - [1] => 42 -) +array(1) { + [1]=> + string(2) "42" +} First key is : int(1) diff --git a/ext/standard/tests/array/array_key_last.phpt b/ext/standard/tests/array/array_key_last.phpt index 599d80eac4..c325be6560 100644 --- a/ext/standard/tests/array/array_key_last.phpt +++ b/ext/standard/tests/array/array_key_last.phpt @@ -14,12 +14,12 @@ $mixed_array = array( array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ), array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), - array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", - "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), array( 12, "name", 'age', '45' ), array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, - 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 ), + 5 => 57, "5.4" => 554, "5.7" => 557 ), array( "foo" ), array( 1 => "42" ) ); @@ -31,7 +31,7 @@ $counter = 1; foreach( $mixed_array as $sub_array ) { echo "\n-- Input Array for Iteration $counter is --\n"; - print_r( $sub_array ); + var_dump( $sub_array ); echo "\nLast key is :\n"; var_dump( array_key_last($sub_array) ); $counter++; @@ -43,190 +43,247 @@ echo"\nDone"; *** Normal testing with various array inputs *** -- Input Array for Iteration 1 is -- -Array -( -) +array(0) { +} Last key is : NULL -- Input Array for Iteration 2 is -- -Array -( - [0] => 1 - [1] => 2 - [2] => 3 - [3] => 4 - [4] => 5 - [5] => 6 - [6] => 7 - [7] => 8 - [8] => 9 -) +array(9) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) +} Last key is : int(8) -- Input Array for Iteration 3 is -- -Array -( - [0] => One - [1] => _Two - [2] => Three - [3] => Four - [4] => Five -) +array(5) { + [0]=> + string(3) "One" + [1]=> + string(4) "_Two" + [2]=> + string(5) "Three" + [3]=> + string(4) "Four" + [4]=> + string(4) "Five" +} Last key is : int(4) -- Input Array for Iteration 4 is -- -Array -( - [0] => 6 - [1] => six - [2] => 7 - [3] => seven - [4] => 8 - [5] => eight - [6] => 9 - [7] => nine -) +array(8) { + [0]=> + int(6) + [1]=> + string(3) "six" + [2]=> + int(7) + [3]=> + string(5) "seven" + [4]=> + int(8) + [5]=> + string(5) "eight" + [6]=> + int(9) + [7]=> + string(4) "nine" +} Last key is : int(7) -- Input Array for Iteration 5 is -- -Array -( - [a] => aaa - [A] => AAA - [c] => ccc - [d] => ddd - [e] => eee -) +array(5) { + ["a"]=> + string(3) "aaa" + ["A"]=> + string(3) "AAA" + ["c"]=> + string(3) "ccc" + ["d"]=> + string(3) "ddd" + ["e"]=> + string(3) "eee" +} Last key is : string(1) "e" -- Input Array for Iteration 6 is -- -Array -( - [1] => one - [2] => two - [3] => three - [4] => four - [5] => five -) +array(5) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" + [4]=> + string(4) "four" + [5]=> + string(4) "five" +} Last key is : int(5) -- Input Array for Iteration 7 is -- -Array -( - [1] => one - [2] => two - [3] => 7 - [4] => four - [5] => five -) +array(5) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + int(7) + [4]=> + string(4) "four" + [5]=> + string(4) "five" +} Last key is : int(5) -- Input Array for Iteration 8 is -- -Array -( - [f] => fff - [1] => one - [4] => 6 - [] => 3 - [2] => float - [F] => FFF - [blank] => - [3] => 3.7 - [5] => Five - [6] => 8.6 - [4name] => jonny - [a] => -) +array(12) { + ["f"]=> + string(3) "fff" + [1]=> + string(3) "one" + [4]=> + int(6) + [""]=> + int(3) + [2]=> + string(5) "float" + ["F"]=> + string(3) "FFF" + ["blank"]=> + string(0) "" + [3]=> + float(3.7) + [5]=> + string(4) "Five" + [6]=> + float(8.6) + ["4name"]=> + string(5) "jonny" + ["a"]=> + NULL +} Last key is : string(1) "a" -- Input Array for Iteration 9 is -- -Array -( - [0] => 12 - [1] => name - [2] => age - [3] => 45 -) +array(4) { + [0]=> + int(12) + [1]=> + string(4) "name" + [2]=> + string(3) "age" + [3]=> + string(2) "45" +} Last key is : int(3) -- Input Array for Iteration 10 is -- -Array -( - [0] => Array - ( - [0] => oNe - [1] => tWo - [2] => 4 - ) - - [1] => Array - ( - [0] => 10 - [1] => 20 - [2] => 30 - [3] => 40 - [4] => 50 - ) - - [2] => Array - ( - ) - -) +array(3) { + [0]=> + array(3) { + [0]=> + string(3) "oNe" + [1]=> + string(3) "tWo" + [2]=> + int(4) + } + [1]=> + array(5) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + [3]=> + int(40) + [4]=> + int(50) + } + [2]=> + array(0) { + } +} Last key is : int(2) -- Input Array for Iteration 11 is -- -Array -( - [one] => 2 - [three] => 3 - [0] => 3 - [1] => 4 - [3] => 33 - [4] => 44 - [5] => 57 - [6] => 6 - [5.4] => 554 - [5.7] => 557 -) +array(10) { + ["one"]=> + int(2) + ["three"]=> + int(3) + [0]=> + int(3) + [1]=> + int(4) + [3]=> + int(33) + [4]=> + int(44) + [5]=> + int(57) + [6]=> + int(6) + ["5.4"]=> + int(554) + ["5.7"]=> + int(557) +} Last key is : string(3) "5.7" -- Input Array for Iteration 12 is -- -Array -( - [0] => foo -) +array(1) { + [0]=> + string(3) "foo" +} Last key is : int(0) -- Input Array for Iteration 13 is -- -Array -( - [1] => 42 -) +array(1) { + [1]=> + string(2) "42" +} Last key is : int(1) diff --git a/ext/standard/tests/array/array_keys_basic.phpt b/ext/standard/tests/array/array_keys_basic.phpt index 0aa84d984d..dc54976d1d 100644 --- a/ext/standard/tests/array/array_keys_basic.phpt +++ b/ext/standard/tests/array/array_keys_basic.phpt @@ -4,7 +4,7 @@ Test array_keys() function (basic) <?php echo "*** Testing array_keys() on basic array operation ***\n"; -$basic_arr = array("a" => 1, "b" => 2, 2.0 => 2.0, -23.45 => "asdasd", +$basic_arr = array("a" => 1, "b" => 2, 2 => 2.0, -23 => "asdasd", array(1,2,3)); var_dump(array_keys($basic_arr)); diff --git a/ext/standard/tests/array/array_keys_variation_001.phpt b/ext/standard/tests/array/array_keys_variation_001.phpt index e9944ed112..fdba88afbd 100644 --- a/ext/standard/tests/array/array_keys_variation_001.phpt +++ b/ext/standard/tests/array/array_keys_variation_001.phpt @@ -13,7 +13,7 @@ $arrays = array( array(1,2,3, "d" => array(4,6, "d")), array("a" => 1, "b" => 2, "c" =>3, "d" => array()), array(0 => 0, 1 => 1, 2 => 2, 3 => 3), - array(0.001=>3.000, 1.002=>2, 1.999=>3, "a"=>3, 3=>5, "5"=>3.000), + array(0 =>3.000, 1 =>2, 1 =>3, "a"=>3, 3=>5, "5"=>3.000), array(TRUE => TRUE, FALSE => FALSE, NULL => NULL, "\x000", "\000"), array("a" => "abcd", "a" => "", "ab" => -6, "cd" => -0.5 ), array(0 => array(), 1=> array(0), 2 => array(1), ""=> array(),""=>"" ) diff --git a/ext/standard/tests/array/array_map_variation4.phpt b/ext/standard/tests/array/array_map_variation4.phpt index dadfbaafa1..ea495cbcd8 100644 --- a/ext/standard/tests/array/array_map_variation4.phpt +++ b/ext/standard/tests/array/array_map_variation4.phpt @@ -43,10 +43,6 @@ $arrays = array ( array(1 => "1"), array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), - // arrays with float keys -/*5*/ array(2.3333 => "float"), - array(1.2 => "f1", 3.33 => "f2", 4.89999922839999 => "f3", 33333333.333333 => "f4"), - // arrays with string keys array('\tHello' => 111, 're\td' => 'color', '\v\fworld' => 2.2, 'pen\n' => 33), /*8*/ array("\tHello" => 111, "re\td" => "color", "\v\fworld" => 2.2, "pen\n" => 33), @@ -102,22 +98,6 @@ array(4) { string(1) "4" } -- Iteration 5 -- -array(1) { - [2]=> - string(5) "float" -} --- Iteration 6 -- -array(4) { - [1]=> - string(2) "f1" - [3]=> - string(2) "f2" - [4]=> - string(2) "f3" - [33333333]=> - string(2) "f4" -} --- Iteration 7 -- array(4) { ["\tHello"]=> int(111) @@ -128,7 +108,7 @@ array(4) { ["pen\n"]=> int(33) } --- Iteration 8 -- +-- Iteration 6 -- array(4) { [" Hello"]=> int(111) @@ -140,21 +120,21 @@ array(4) { "]=> int(33) } --- Iteration 9 -- +-- Iteration 7 -- array(2) { [0]=> string(5) "hello" ["Hello world"]=> string(6) "string" } --- Iteration 10 -- +-- Iteration 8 -- array(2) { [""]=> string(5) "hello" [5]=> string(8) "resource" } --- Iteration 11 -- +-- Iteration 9 -- array(7) { ["hello"]=> int(1) diff --git a/ext/standard/tests/array/array_map_variation5.phpt b/ext/standard/tests/array/array_map_variation5.phpt index 9b6a896fa9..c7ff35d9b2 100644 --- a/ext/standard/tests/array/array_map_variation5.phpt +++ b/ext/standard/tests/array/array_map_variation5.phpt @@ -48,8 +48,8 @@ $arrays = array ( array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.3333), // arrays with string values - array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), -/*8*/ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), + array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3 => "pen\n"), +/*8*/ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3 => 'pen\n'), array(1 => "hello", "heredoc" => $heredoc), // array with object, unset variable and resource variable diff --git a/ext/standard/tests/array/array_merge.phpt b/ext/standard/tests/array/array_merge.phpt index b78da3082a..eced097818 100644 --- a/ext/standard/tests/array/array_merge.phpt +++ b/ext/standard/tests/array/array_merge.phpt @@ -9,10 +9,10 @@ $begin_array = array( array(), array( 1 => "string"), array( "" => "string"), - array( -2.44444 => 12), + array( -2 => 12), array( "a" => 1, "b" => -2.344, "b" => "string", "c" => NULL, "d" => -2.344), array( 4 => 1, 3 => -2.344, "3" => "string", "2" => NULL,1 => -2.344), - array( NULL, 1.23 => "Hi", "string" => "hello", + array( NULL, 1 => "Hi", "string" => "hello", array("" => "World", "-2.34" => "a", "0" => "b")) ); @@ -20,10 +20,10 @@ $end_array = array( array(), array( 1 => "string"), array( "" => "string"), - array( -2.44444 => 12), + array( -2 => 12), array( "a" => 1, "b" => -2.344, "b" => "string", "c" => NULL, "d" => -2.344), array( 4 => 1, 3 => -2.344, "3" => "string", "2" => NULL, 1=> -2.344), - array( NULL, 1.23 => "Hi", "string" => "hello", + array( NULL, 1 => "Hi", "string" => "hello", array("" => "World", "-2.34" => "a", "0" => "b")) ); @@ -35,7 +35,7 @@ foreach($begin_array as $first) { foreach($end_array as $second) { echo "\n-- Inner iteration $count_inner of Iteration $count_outer --\n"; $result = array_merge($first, $second); - print_r($result); + var_dump($result); $count_inner++; } $count_outer++; @@ -84,549 +84,718 @@ echo "Done\n"; --- Iteration 0 --- -- Inner iteration 0 of Iteration 0 -- -Array -( -) +array(0) { +} -- Inner iteration 1 of Iteration 0 -- -Array -( - [0] => string -) +array(1) { + [0]=> + string(6) "string" +} -- Inner iteration 2 of Iteration 0 -- -Array -( - [] => string -) +array(1) { + [""]=> + string(6) "string" +} -- Inner iteration 3 of Iteration 0 -- -Array -( - [0] => 12 -) +array(1) { + [0]=> + int(12) +} -- Inner iteration 4 of Iteration 0 -- -Array -( - [a] => 1 - [b] => string - [c] => - [d] => -2.344 -) +array(4) { + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) +} -- Inner iteration 5 of Iteration 0 -- -Array -( - [0] => 1 - [1] => string - [2] => - [3] => -2.344 -) +array(4) { + [0]=> + int(1) + [1]=> + string(6) "string" + [2]=> + NULL + [3]=> + float(-2.344) +} -- Inner iteration 6 of Iteration 0 -- -Array -( - [0] => - [1] => Hi - [string] => hello - [2] => Array - ( - [] => World - [-2.34] => a - [0] => b - ) - -) +array(4) { + [0]=> + NULL + [1]=> + string(2) "Hi" + ["string"]=> + string(5) "hello" + [2]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } +} --- Iteration 1 --- -- Inner iteration 0 of Iteration 1 -- -Array -( - [0] => string -) +array(1) { + [0]=> + string(6) "string" +} -- Inner iteration 1 of Iteration 1 -- -Array -( - [0] => string - [1] => string -) +array(2) { + [0]=> + string(6) "string" + [1]=> + string(6) "string" +} -- Inner iteration 2 of Iteration 1 -- -Array -( - [0] => string - [] => string -) +array(2) { + [0]=> + string(6) "string" + [""]=> + string(6) "string" +} -- Inner iteration 3 of Iteration 1 -- -Array -( - [0] => string - [1] => 12 -) +array(2) { + [0]=> + string(6) "string" + [1]=> + int(12) +} -- Inner iteration 4 of Iteration 1 -- -Array -( - [0] => string - [a] => 1 - [b] => string - [c] => - [d] => -2.344 -) +array(5) { + [0]=> + string(6) "string" + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) +} -- Inner iteration 5 of Iteration 1 -- -Array -( - [0] => string - [1] => 1 - [2] => string - [3] => - [4] => -2.344 -) +array(5) { + [0]=> + string(6) "string" + [1]=> + int(1) + [2]=> + string(6) "string" + [3]=> + NULL + [4]=> + float(-2.344) +} -- Inner iteration 6 of Iteration 1 -- -Array -( - [0] => string - [1] => - [2] => Hi - [string] => hello - [3] => Array - ( - [] => World - [-2.34] => a - [0] => b - ) - -) +array(5) { + [0]=> + string(6) "string" + [1]=> + NULL + [2]=> + string(2) "Hi" + ["string"]=> + string(5) "hello" + [3]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } +} --- Iteration 2 --- -- Inner iteration 0 of Iteration 2 -- -Array -( - [] => string -) +array(1) { + [""]=> + string(6) "string" +} -- Inner iteration 1 of Iteration 2 -- -Array -( - [] => string - [0] => string -) +array(2) { + [""]=> + string(6) "string" + [0]=> + string(6) "string" +} -- Inner iteration 2 of Iteration 2 -- -Array -( - [] => string -) +array(1) { + [""]=> + string(6) "string" +} -- Inner iteration 3 of Iteration 2 -- -Array -( - [] => string - [0] => 12 -) +array(2) { + [""]=> + string(6) "string" + [0]=> + int(12) +} -- Inner iteration 4 of Iteration 2 -- -Array -( - [] => string - [a] => 1 - [b] => string - [c] => - [d] => -2.344 -) +array(5) { + [""]=> + string(6) "string" + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) +} -- Inner iteration 5 of Iteration 2 -- -Array -( - [] => string - [0] => 1 - [1] => string - [2] => - [3] => -2.344 -) +array(5) { + [""]=> + string(6) "string" + [0]=> + int(1) + [1]=> + string(6) "string" + [2]=> + NULL + [3]=> + float(-2.344) +} -- Inner iteration 6 of Iteration 2 -- -Array -( - [] => string - [0] => - [1] => Hi - [string] => hello - [2] => Array - ( - [] => World - [-2.34] => a - [0] => b - ) - -) +array(5) { + [""]=> + string(6) "string" + [0]=> + NULL + [1]=> + string(2) "Hi" + ["string"]=> + string(5) "hello" + [2]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } +} --- Iteration 3 --- -- Inner iteration 0 of Iteration 3 -- -Array -( - [0] => 12 -) +array(1) { + [0]=> + int(12) +} -- Inner iteration 1 of Iteration 3 -- -Array -( - [0] => 12 - [1] => string -) +array(2) { + [0]=> + int(12) + [1]=> + string(6) "string" +} -- Inner iteration 2 of Iteration 3 -- -Array -( - [0] => 12 - [] => string -) +array(2) { + [0]=> + int(12) + [""]=> + string(6) "string" +} -- Inner iteration 3 of Iteration 3 -- -Array -( - [0] => 12 - [1] => 12 -) +array(2) { + [0]=> + int(12) + [1]=> + int(12) +} -- Inner iteration 4 of Iteration 3 -- -Array -( - [0] => 12 - [a] => 1 - [b] => string - [c] => - [d] => -2.344 -) +array(5) { + [0]=> + int(12) + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) +} -- Inner iteration 5 of Iteration 3 -- -Array -( - [0] => 12 - [1] => 1 - [2] => string - [3] => - [4] => -2.344 -) +array(5) { + [0]=> + int(12) + [1]=> + int(1) + [2]=> + string(6) "string" + [3]=> + NULL + [4]=> + float(-2.344) +} -- Inner iteration 6 of Iteration 3 -- -Array -( - [0] => 12 - [1] => - [2] => Hi - [string] => hello - [3] => Array - ( - [] => World - [-2.34] => a - [0] => b - ) - -) +array(5) { + [0]=> + int(12) + [1]=> + NULL + [2]=> + string(2) "Hi" + ["string"]=> + string(5) "hello" + [3]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } +} --- Iteration 4 --- -- Inner iteration 0 of Iteration 4 -- -Array -( - [a] => 1 - [b] => string - [c] => - [d] => -2.344 -) +array(4) { + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) +} -- Inner iteration 1 of Iteration 4 -- -Array -( - [a] => 1 - [b] => string - [c] => - [d] => -2.344 - [0] => string -) +array(5) { + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) + [0]=> + string(6) "string" +} -- Inner iteration 2 of Iteration 4 -- -Array -( - [a] => 1 - [b] => string - [c] => - [d] => -2.344 - [] => string -) +array(5) { + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) + [""]=> + string(6) "string" +} -- Inner iteration 3 of Iteration 4 -- -Array -( - [a] => 1 - [b] => string - [c] => - [d] => -2.344 - [0] => 12 -) +array(5) { + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) + [0]=> + int(12) +} -- Inner iteration 4 of Iteration 4 -- -Array -( - [a] => 1 - [b] => string - [c] => - [d] => -2.344 -) +array(4) { + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) +} -- Inner iteration 5 of Iteration 4 -- -Array -( - [a] => 1 - [b] => string - [c] => - [d] => -2.344 - [0] => 1 - [1] => string - [2] => - [3] => -2.344 -) +array(8) { + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) + [0]=> + int(1) + [1]=> + string(6) "string" + [2]=> + NULL + [3]=> + float(-2.344) +} -- Inner iteration 6 of Iteration 4 -- -Array -( - [a] => 1 - [b] => string - [c] => - [d] => -2.344 - [0] => - [1] => Hi - [string] => hello - [2] => Array - ( - [] => World - [-2.34] => a - [0] => b - ) - -) +array(8) { + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) + [0]=> + NULL + [1]=> + string(2) "Hi" + ["string"]=> + string(5) "hello" + [2]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } +} --- Iteration 5 --- -- Inner iteration 0 of Iteration 5 -- -Array -( - [0] => 1 - [1] => string - [2] => - [3] => -2.344 -) +array(4) { + [0]=> + int(1) + [1]=> + string(6) "string" + [2]=> + NULL + [3]=> + float(-2.344) +} -- Inner iteration 1 of Iteration 5 -- -Array -( - [0] => 1 - [1] => string - [2] => - [3] => -2.344 - [4] => string -) +array(5) { + [0]=> + int(1) + [1]=> + string(6) "string" + [2]=> + NULL + [3]=> + float(-2.344) + [4]=> + string(6) "string" +} -- Inner iteration 2 of Iteration 5 -- -Array -( - [0] => 1 - [1] => string - [2] => - [3] => -2.344 - [] => string -) +array(5) { + [0]=> + int(1) + [1]=> + string(6) "string" + [2]=> + NULL + [3]=> + float(-2.344) + [""]=> + string(6) "string" +} -- Inner iteration 3 of Iteration 5 -- -Array -( - [0] => 1 - [1] => string - [2] => - [3] => -2.344 - [4] => 12 -) +array(5) { + [0]=> + int(1) + [1]=> + string(6) "string" + [2]=> + NULL + [3]=> + float(-2.344) + [4]=> + int(12) +} -- Inner iteration 4 of Iteration 5 -- -Array -( - [0] => 1 - [1] => string - [2] => - [3] => -2.344 - [a] => 1 - [b] => string - [c] => - [d] => -2.344 -) +array(8) { + [0]=> + int(1) + [1]=> + string(6) "string" + [2]=> + NULL + [3]=> + float(-2.344) + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) +} -- Inner iteration 5 of Iteration 5 -- -Array -( - [0] => 1 - [1] => string - [2] => - [3] => -2.344 - [4] => 1 - [5] => string - [6] => - [7] => -2.344 -) +array(8) { + [0]=> + int(1) + [1]=> + string(6) "string" + [2]=> + NULL + [3]=> + float(-2.344) + [4]=> + int(1) + [5]=> + string(6) "string" + [6]=> + NULL + [7]=> + float(-2.344) +} -- Inner iteration 6 of Iteration 5 -- -Array -( - [0] => 1 - [1] => string - [2] => - [3] => -2.344 - [4] => - [5] => Hi - [string] => hello - [6] => Array - ( - [] => World - [-2.34] => a - [0] => b - ) - -) +array(8) { + [0]=> + int(1) + [1]=> + string(6) "string" + [2]=> + NULL + [3]=> + float(-2.344) + [4]=> + NULL + [5]=> + string(2) "Hi" + ["string"]=> + string(5) "hello" + [6]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } +} --- Iteration 6 --- -- Inner iteration 0 of Iteration 6 -- -Array -( - [0] => - [1] => Hi - [string] => hello - [2] => Array - ( - [] => World - [-2.34] => a - [0] => b - ) - -) +array(4) { + [0]=> + NULL + [1]=> + string(2) "Hi" + ["string"]=> + string(5) "hello" + [2]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } +} -- Inner iteration 1 of Iteration 6 -- -Array -( - [0] => - [1] => Hi - [string] => hello - [2] => Array - ( - [] => World - [-2.34] => a - [0] => b - ) - - [3] => string -) +array(5) { + [0]=> + NULL + [1]=> + string(2) "Hi" + ["string"]=> + string(5) "hello" + [2]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } + [3]=> + string(6) "string" +} -- Inner iteration 2 of Iteration 6 -- -Array -( - [0] => - [1] => Hi - [string] => hello - [2] => Array - ( - [] => World - [-2.34] => a - [0] => b - ) - - [] => string -) +array(5) { + [0]=> + NULL + [1]=> + string(2) "Hi" + ["string"]=> + string(5) "hello" + [2]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } + [""]=> + string(6) "string" +} -- Inner iteration 3 of Iteration 6 -- -Array -( - [0] => - [1] => Hi - [string] => hello - [2] => Array - ( - [] => World - [-2.34] => a - [0] => b - ) - - [3] => 12 -) +array(5) { + [0]=> + NULL + [1]=> + string(2) "Hi" + ["string"]=> + string(5) "hello" + [2]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } + [3]=> + int(12) +} -- Inner iteration 4 of Iteration 6 -- -Array -( - [0] => - [1] => Hi - [string] => hello - [2] => Array - ( - [] => World - [-2.34] => a - [0] => b - ) - - [a] => 1 - [b] => string - [c] => - [d] => -2.344 -) +array(8) { + [0]=> + NULL + [1]=> + string(2) "Hi" + ["string"]=> + string(5) "hello" + [2]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } + ["a"]=> + int(1) + ["b"]=> + string(6) "string" + ["c"]=> + NULL + ["d"]=> + float(-2.344) +} -- Inner iteration 5 of Iteration 6 -- -Array -( - [0] => - [1] => Hi - [string] => hello - [2] => Array - ( - [] => World - [-2.34] => a - [0] => b - ) - - [3] => 1 - [4] => string - [5] => - [6] => -2.344 -) +array(8) { + [0]=> + NULL + [1]=> + string(2) "Hi" + ["string"]=> + string(5) "hello" + [2]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } + [3]=> + int(1) + [4]=> + string(6) "string" + [5]=> + NULL + [6]=> + float(-2.344) +} -- Inner iteration 6 of Iteration 6 -- -Array -( - [0] => - [1] => Hi - [string] => hello - [2] => Array - ( - [] => World - [-2.34] => a - [0] => b - ) - - [3] => - [4] => Hi - [5] => Array - ( - [] => World - [-2.34] => a - [0] => b - ) - -) +array(7) { + [0]=> + NULL + [1]=> + string(2) "Hi" + ["string"]=> + string(5) "hello" + [2]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } + [3]=> + NULL + [4]=> + string(2) "Hi" + [5]=> + array(3) { + [""]=> + string(5) "World" + ["-2.34"]=> + string(1) "a" + [0]=> + string(1) "b" + } +} *** Testing array_merge() with three or more arrays *** array(12) { diff --git a/ext/standard/tests/array/array_merge_recursive_variation4.phpt b/ext/standard/tests/array/array_merge_recursive_variation4.phpt index 6208adabed..71f4a4d66f 100644 --- a/ext/standard/tests/array/array_merge_recursive_variation4.phpt +++ b/ext/standard/tests/array/array_merge_recursive_variation4.phpt @@ -35,10 +35,6 @@ $arrays = array ( array(0 => "0", 1 => array(1 => "one")), array(1 => "1", 2 => array(1 => "one", 2 => "two", 3 => 1, 4 => "4")), - // arrays with float keys -/*3*/ array(2.3333 => "float", 44.44 => array(1.1 => "float")), - array(1.2 => "f1", 3.33 => "f2", 4.89999922839999 => array(1.1 => "f1"), 3333333.333333 => "f4"), - // arrays with string keys /*5*/ array('\tHello' => array("hello", 'world'), '\v\fworld' => 2.2, 'pen\n' => 111), array("\tHello" => array("hello", 'world'), "\v\fworld" => 2.2, "pen\n" => 111), @@ -162,86 +158,6 @@ array(6) { } -- Iteration 3 -- -- With default argument -- -array(2) { - [0]=> - string(5) "float" - [1]=> - array(1) { - [1]=> - string(5) "float" - } -} --- With more arguments -- -array(6) { - [0]=> - string(5) "float" - [1]=> - array(1) { - [1]=> - string(5) "float" - } - [2]=> - string(3) "one" - [3]=> - int(2) - ["string"]=> - string(5) "hello" - ["array"]=> - array(3) { - [0]=> - string(1) "a" - [1]=> - string(1) "b" - [2]=> - string(1) "c" - } -} --- Iteration 4 -- --- With default argument -- -array(4) { - [0]=> - string(2) "f1" - [1]=> - string(2) "f2" - [2]=> - array(1) { - [1]=> - string(2) "f1" - } - [3]=> - string(2) "f4" -} --- With more arguments -- -array(8) { - [0]=> - string(2) "f1" - [1]=> - string(2) "f2" - [2]=> - array(1) { - [1]=> - string(2) "f1" - } - [3]=> - string(2) "f4" - [4]=> - string(3) "one" - [5]=> - int(2) - ["string"]=> - string(5) "hello" - ["array"]=> - array(3) { - [0]=> - string(1) "a" - [1]=> - string(1) "b" - [2]=> - string(1) "c" - } -} --- Iteration 5 -- --- With default argument -- array(3) { ["\tHello"]=> array(2) { @@ -284,7 +200,7 @@ array(7) { string(1) "c" } } --- Iteration 6 -- +-- Iteration 4 -- -- With default argument -- array(3) { [" Hello"]=> @@ -330,7 +246,7 @@ array(7) { string(1) "c" } } --- Iteration 7 -- +-- Iteration 5 -- -- With default argument -- array(3) { [0]=> @@ -374,7 +290,7 @@ array(7) { string(1) "c" } } --- Iteration 8 -- +-- Iteration 6 -- -- With default argument -- array(4) { [""]=> diff --git a/ext/standard/tests/array/array_merge_recursive_variation5.phpt b/ext/standard/tests/array/array_merge_recursive_variation5.phpt index 701817730c..617811b5f6 100644 --- a/ext/standard/tests/array/array_merge_recursive_variation5.phpt +++ b/ext/standard/tests/array/array_merge_recursive_variation5.phpt @@ -40,8 +40,8 @@ $arrays = array ( array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => array(1.2, 'f4' => 1.2)), // arrays with string values -/*5*/ array(111 => "\tHello", "array" => "col\tor", 2 => "\v\fworld", 3.3 => "\tHello"), - array(111 => '\tHello', 'array' => 'col\tor', 2 => '\v\fworld', 3.3 => '\tHello'), +/*5*/ array(111 => "\tHello", "array" => "col\tor", 2 => "\v\fworld", 3 => "\tHello"), + array(111 => '\tHello', 'array' => 'col\tor', 2 => '\v\fworld', 3 => '\tHello'), array(1 => "hello", "string" => $heredoc, $heredoc), // array with object, unset variable and resource variable diff --git a/ext/standard/tests/array/array_merge_variation4.phpt b/ext/standard/tests/array/array_merge_variation4.phpt index 456d80a2c7..e34bf73526 100644 --- a/ext/standard/tests/array/array_merge_variation4.phpt +++ b/ext/standard/tests/array/array_merge_variation4.phpt @@ -32,18 +32,6 @@ $inputs = array( -2345 => 'negative', ), - // float data -/*2*/ 'float' => array( - 10.5 => 'positive', - -10.5 => 'negative', - .5 => 'half', - ), - -/*3*/ 'extreme floats' => array( - 12.3456789000e10 => 'large', - 12.3456789000E-10 => 'small', - ), - // null data /*4*/ 'null uppercase' => array( NULL => 'null 1', @@ -135,55 +123,7 @@ array(6) { string(8) "negative" } --- Iteration 2: float data -- -array(5) { - [0]=> - string(8) "positive" - [1]=> - string(8) "negative" - [2]=> - string(4) "half" - ["one"]=> - int(1) - ["two"]=> - int(2) -} -array(5) { - ["one"]=> - int(1) - ["two"]=> - int(2) - [0]=> - string(8) "positive" - [1]=> - string(8) "negative" - [2]=> - string(4) "half" -} - --- Iteration 3: extreme floats data -- -array(4) { - [0]=> - string(5) "large" - [1]=> - string(5) "small" - ["one"]=> - int(1) - ["two"]=> - int(2) -} -array(4) { - ["one"]=> - int(1) - ["two"]=> - int(2) - [0]=> - string(5) "large" - [1]=> - string(5) "small" -} - --- Iteration 4: null uppercase data -- +-- Iteration 2: null uppercase data -- array(3) { [""]=> string(6) "null 1" @@ -201,7 +141,7 @@ array(3) { string(6) "null 1" } --- Iteration 5: null lowercase data -- +-- Iteration 3: null lowercase data -- array(3) { [""]=> string(6) "null 2" @@ -219,7 +159,7 @@ array(3) { string(6) "null 2" } --- Iteration 6: bool lowercase data -- +-- Iteration 4: bool lowercase data -- array(4) { [0]=> string(6) "lowert" @@ -241,7 +181,7 @@ array(4) { string(6) "lowerf" } --- Iteration 7: bool uppercase data -- +-- Iteration 5: bool uppercase data -- array(4) { [0]=> string(6) "uppert" @@ -263,7 +203,7 @@ array(4) { string(6) "upperf" } --- Iteration 8: empty double quotes data -- +-- Iteration 6: empty double quotes data -- array(3) { [""]=> string(6) "emptyd" @@ -281,7 +221,7 @@ array(3) { string(6) "emptyd" } --- Iteration 9: empty single quotes data -- +-- Iteration 7: empty single quotes data -- array(3) { [""]=> string(6) "emptys" @@ -299,7 +239,7 @@ array(3) { string(6) "emptys" } --- Iteration 10: string data -- +-- Iteration 8: string data -- array(5) { ["stringd"]=> string(7) "stringd" @@ -325,7 +265,7 @@ array(5) { string(7) "stringh" } --- Iteration 11: undefined data -- +-- Iteration 9: undefined data -- array(3) { [""]=> string(9) "undefined" @@ -343,7 +283,7 @@ array(3) { string(9) "undefined" } --- Iteration 12: unset data -- +-- Iteration 10: unset data -- array(3) { [""]=> string(5) "unset" diff --git a/ext/standard/tests/array/array_merge_variation7.phpt b/ext/standard/tests/array/array_merge_variation7.phpt index 60642fc43e..a196effc75 100644 --- a/ext/standard/tests/array/array_merge_variation7.phpt +++ b/ext/standard/tests/array/array_merge_variation7.phpt @@ -11,7 +11,7 @@ echo "*** Testing array_merge() : usage variations ***\n"; //mixed keys $arr1 = array('zero', 20 => 'twenty', 'thirty' => 30, true => 'bool'); -$arr2 = array(0, 1, 2, null => 'null', 1.234E-10 => 'float'); +$arr2 = array(0, 1, 2, null => 'null', 0 => 'float'); var_dump(array_merge($arr1, $arr2)); var_dump(array_merge($arr2, $arr1)); diff --git a/ext/standard/tests/array/array_pop.phpt b/ext/standard/tests/array/array_pop.phpt index 843a618f2e..2066f1acb6 100644 --- a/ext/standard/tests/array/array_pop.phpt +++ b/ext/standard/tests/array/array_pop.phpt @@ -3,8 +3,6 @@ Test array_pop() function --FILE-- <?php -array_pop($GLOBALS); - $empty_array = array(); $number = 5; $str = "abc"; @@ -19,12 +17,12 @@ $mixed_array = array( array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ), array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), - array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", - "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), array( 12, "name", 'age', '45' ), array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, - 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 ) + 5 => 57, "5.4" => 554, "5.7" => 557 ) ); /* Loop to test normal functionality with different arrays inputs */ @@ -34,7 +32,7 @@ $counter = 1; foreach( $mixed_array as $sub_array ) { echo "\n-- Input Array for Iteration $counter is --\n"; - print_r( $sub_array ); + var_dump( $sub_array ); echo "\nOutput after Pop is :\n"; var_dump( array_pop($sub_array) ); $counter++; @@ -46,173 +44,230 @@ echo"\nDone"; *** Normal testing with various array inputs *** -- Input Array for Iteration 1 is -- -Array -( -) +array(0) { +} Output after Pop is : NULL -- Input Array for Iteration 2 is -- -Array -( - [0] => 1 - [1] => 2 - [2] => 3 - [3] => 4 - [4] => 5 - [5] => 6 - [6] => 7 - [7] => 8 - [8] => 9 -) +array(9) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) +} Output after Pop is : int(9) -- Input Array for Iteration 3 is -- -Array -( - [0] => One - [1] => _Two - [2] => Three - [3] => Four - [4] => Five -) +array(5) { + [0]=> + string(3) "One" + [1]=> + string(4) "_Two" + [2]=> + string(5) "Three" + [3]=> + string(4) "Four" + [4]=> + string(4) "Five" +} Output after Pop is : string(4) "Five" -- Input Array for Iteration 4 is -- -Array -( - [0] => 6 - [1] => six - [2] => 7 - [3] => seven - [4] => 8 - [5] => eight - [6] => 9 - [7] => nine -) +array(8) { + [0]=> + int(6) + [1]=> + string(3) "six" + [2]=> + int(7) + [3]=> + string(5) "seven" + [4]=> + int(8) + [5]=> + string(5) "eight" + [6]=> + int(9) + [7]=> + string(4) "nine" +} Output after Pop is : string(4) "nine" -- Input Array for Iteration 5 is -- -Array -( - [a] => aaa - [A] => AAA - [c] => ccc - [d] => ddd - [e] => eee -) +array(5) { + ["a"]=> + string(3) "aaa" + ["A"]=> + string(3) "AAA" + ["c"]=> + string(3) "ccc" + ["d"]=> + string(3) "ddd" + ["e"]=> + string(3) "eee" +} Output after Pop is : string(3) "eee" -- Input Array for Iteration 6 is -- -Array -( - [1] => one - [2] => two - [3] => three - [4] => four - [5] => five -) +array(5) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" + [4]=> + string(4) "four" + [5]=> + string(4) "five" +} Output after Pop is : string(4) "five" -- Input Array for Iteration 7 is -- -Array -( - [1] => one - [2] => two - [3] => 7 - [4] => four - [5] => five -) +array(5) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + int(7) + [4]=> + string(4) "four" + [5]=> + string(4) "five" +} Output after Pop is : string(4) "five" -- Input Array for Iteration 8 is -- -Array -( - [f] => fff - [1] => one - [4] => 6 - [] => 3 - [2] => float - [F] => FFF - [blank] => - [3] => 3.7 - [5] => Five - [6] => 8.6 - [4name] => jonny - [a] => -) +array(12) { + ["f"]=> + string(3) "fff" + [1]=> + string(3) "one" + [4]=> + int(6) + [""]=> + int(3) + [2]=> + string(5) "float" + ["F"]=> + string(3) "FFF" + ["blank"]=> + string(0) "" + [3]=> + float(3.7) + [5]=> + string(4) "Five" + [6]=> + float(8.6) + ["4name"]=> + string(5) "jonny" + ["a"]=> + NULL +} Output after Pop is : NULL -- Input Array for Iteration 9 is -- -Array -( - [0] => 12 - [1] => name - [2] => age - [3] => 45 -) +array(4) { + [0]=> + int(12) + [1]=> + string(4) "name" + [2]=> + string(3) "age" + [3]=> + string(2) "45" +} Output after Pop is : string(2) "45" -- Input Array for Iteration 10 is -- -Array -( - [0] => Array - ( - [0] => oNe - [1] => tWo - [2] => 4 - ) - - [1] => Array - ( - [0] => 10 - [1] => 20 - [2] => 30 - [3] => 40 - [4] => 50 - ) - - [2] => Array - ( - ) - -) +array(3) { + [0]=> + array(3) { + [0]=> + string(3) "oNe" + [1]=> + string(3) "tWo" + [2]=> + int(4) + } + [1]=> + array(5) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + [3]=> + int(40) + [4]=> + int(50) + } + [2]=> + array(0) { + } +} Output after Pop is : array(0) { } -- Input Array for Iteration 11 is -- -Array -( - [one] => 2 - [three] => 3 - [0] => 3 - [1] => 4 - [3] => 33 - [4] => 44 - [5] => 57 - [6] => 6 - [5.4] => 554 - [5.7] => 557 -) +array(10) { + ["one"]=> + int(2) + ["three"]=> + int(3) + [0]=> + int(3) + [1]=> + int(4) + [3]=> + int(33) + [4]=> + int(44) + [5]=> + int(57) + [6]=> + int(6) + ["5.4"]=> + int(554) + ["5.7"]=> + int(557) +} Output after Pop is : int(557) diff --git a/ext/standard/tests/array/array_pop_variation.phpt b/ext/standard/tests/array/array_pop_variation.phpt index c2e30cb7a3..af8b0cc0f9 100644 --- a/ext/standard/tests/array/array_pop_variation.phpt +++ b/ext/standard/tests/array/array_pop_variation.phpt @@ -12,12 +12,12 @@ $mixed_array = array( array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ), array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), - array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", - "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), array( 12, "name", 'age', '45' ), array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, - 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 ) + 5 => 57, "5.4" => 554, "5.7" => 557 ) ); echo"\n*** Checking for internal array pointer being reset when pop is called ***\n"; diff --git a/ext/standard/tests/array/array_push.phpt b/ext/standard/tests/array/array_push.phpt index 67a2f2019b..1c560adc51 100644 --- a/ext/standard/tests/array/array_push.phpt +++ b/ext/standard/tests/array/array_push.phpt @@ -17,12 +17,12 @@ $mixed_array = array( array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ), array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ), array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), - array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", - "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), array( 12, "name", 'age', '45' ), array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, - 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 ) + 5 => 57, "5.4" => 554, "5.7" => 557 ) ); /* Error Conditions */ @@ -42,7 +42,7 @@ $counter = 1; foreach( $mixed_array as $sub_array ) { echo "\n-- Input Array for Iteration $counter is --\n"; - print_r( $sub_array ); + var_dump( $sub_array ); echo "\nOutput after push is :\n"; var_dump( array_push($sub_array, 22, "abc") ); $counter++; @@ -63,174 +63,233 @@ int(1) *** Testing with various array inputs *** -- Input Array for Iteration 1 is -- -Array -( -) +array(0) { +} Output after push is : int(2) -- Input Array for Iteration 2 is -- -Array -( - [0] => 1 - [1] => 2 - [2] => 3 - [3] => 4 - [4] => 5 - [5] => 6 - [6] => 7 - [7] => 8 - [8] => 9 - [9] => 1 - [10] => 2 -) +array(11) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) + [8]=> + int(9) + [9]=> + int(1) + [10]=> + int(2) +} Output after push is : int(13) -- Input Array for Iteration 3 is -- -Array -( - [0] => One - [1] => _Two - [2] => Three - [3] => Four - [4] => Five -) +array(5) { + [0]=> + string(3) "One" + [1]=> + string(4) "_Two" + [2]=> + string(5) "Three" + [3]=> + string(4) "Four" + [4]=> + string(4) "Five" +} Output after push is : int(7) -- Input Array for Iteration 4 is -- -Array -( - [0] => 6 - [1] => six - [2] => 7 - [3] => seven - [4] => 8 - [5] => eight - [6] => 9 - [7] => nine -) +array(8) { + [0]=> + int(6) + [1]=> + string(3) "six" + [2]=> + int(7) + [3]=> + string(5) "seven" + [4]=> + int(8) + [5]=> + string(5) "eight" + [6]=> + int(9) + [7]=> + string(4) "nine" +} Output after push is : int(10) -- Input Array for Iteration 5 is -- -Array -( - [a] => aaa - [A] => AAA - [c] => ccc - [d] => ddd - [e] => eee -) +array(5) { + ["a"]=> + string(3) "aaa" + ["A"]=> + string(3) "AAA" + ["c"]=> + string(3) "ccc" + ["d"]=> + string(3) "ddd" + ["e"]=> + string(3) "eee" +} Output after push is : int(7) -- Input Array for Iteration 6 is -- -Array -( - [1] => one - [2] => two - [3] => three - [4] => four - [5] => five -) +array(5) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + string(5) "three" + [4]=> + string(4) "four" + [5]=> + string(4) "five" +} Output after push is : int(7) -- Input Array for Iteration 7 is -- -Array -( - [1] => one - [2] => two - [3] => 7 - [4] => four - [5] => five -) +array(5) { + [1]=> + string(3) "one" + [2]=> + string(3) "two" + [3]=> + int(7) + [4]=> + string(4) "four" + [5]=> + string(4) "five" +} Output after push is : int(7) -- Input Array for Iteration 8 is -- -Array -( - [f] => fff - [1] => one - [4] => 6 - [] => 3 - [2] => float - [F] => FFF - [blank] => - [3] => 3.7 - [5] => Five - [6] => 8.6 - [4name] => jonny - [a] => -) +array(12) { + ["f"]=> + string(3) "fff" + [1]=> + string(3) "one" + [4]=> + int(6) + [""]=> + int(3) + [2]=> + string(5) "float" + ["F"]=> + string(3) "FFF" + ["blank"]=> + string(0) "" + [3]=> + float(3.7) + [5]=> + string(4) "Five" + [6]=> + float(8.6) + ["4name"]=> + string(5) "jonny" + ["a"]=> + NULL +} Output after push is : int(14) -- Input Array for Iteration 9 is -- -Array -( - [0] => 12 - [1] => name - [2] => age - [3] => 45 -) +array(4) { + [0]=> + int(12) + [1]=> + string(4) "name" + [2]=> + string(3) "age" + [3]=> + string(2) "45" +} Output after push is : int(6) -- Input Array for Iteration 10 is -- -Array -( - [0] => Array - ( - [0] => oNe - [1] => tWo - [2] => 4 - ) - - [1] => Array - ( - [0] => 10 - [1] => 20 - [2] => 30 - [3] => 40 - [4] => 50 - ) - - [2] => Array - ( - ) - -) +array(3) { + [0]=> + array(3) { + [0]=> + string(3) "oNe" + [1]=> + string(3) "tWo" + [2]=> + int(4) + } + [1]=> + array(5) { + [0]=> + int(10) + [1]=> + int(20) + [2]=> + int(30) + [3]=> + int(40) + [4]=> + int(50) + } + [2]=> + array(0) { + } +} Output after push is : int(5) -- Input Array for Iteration 11 is -- -Array -( - [one] => 2 - [three] => 3 - [0] => 3 - [1] => 4 - [3] => 33 - [4] => 44 - [5] => 57 - [6] => 6 - [5.4] => 554 - [5.7] => 557 -) +array(10) { + ["one"]=> + int(2) + ["three"]=> + int(3) + [0]=> + int(3) + [1]=> + int(4) + [3]=> + int(33) + [4]=> + int(44) + [5]=> + int(57) + [6]=> + int(6) + ["5.4"]=> + int(554) + ["5.7"]=> + int(557) +} Output after push is : int(12) diff --git a/ext/standard/tests/array/array_push_variation6.phpt b/ext/standard/tests/array/array_push_variation6.phpt index b8cce79821..610e4efaa0 100644 --- a/ext/standard/tests/array/array_push_variation6.phpt +++ b/ext/standard/tests/array/array_push_variation6.phpt @@ -31,18 +31,6 @@ $inputs = array( -2345 => 'negative', ), - // float data -/*2*/ 'float' => array( - 10.5 => 'positive', - -10.5 => 'negative', - .5 => 'half', - ), - - 'extreme floats' => array( - 12.3456789000e10 => 'large', - 12.3456789000E-10 => 'small', - ), - // null data /*3*/ 'null uppercase' => array( NULL => 'null 1', @@ -107,47 +95,39 @@ echo "Done"; Before : int(4) After : int(5) --- Iteration 2 : float data -- -Before : int(3) -After : int(4) - --- Iteration 3 : extreme floats data -- -Before : int(2) -After : int(3) - --- Iteration 4 : null uppercase data -- +-- Iteration 2 : null uppercase data -- Before : int(1) After : int(2) --- Iteration 5 : null lowercase data -- +-- Iteration 3 : null lowercase data -- Before : int(1) After : int(2) --- Iteration 6 : bool lowercase data -- +-- Iteration 4 : bool lowercase data -- Before : int(2) After : int(3) --- Iteration 7 : bool uppercase data -- +-- Iteration 5 : bool uppercase data -- Before : int(2) After : int(3) --- Iteration 8 : empty double quotes data -- +-- Iteration 6 : empty double quotes data -- Before : int(1) After : int(2) --- Iteration 9 : empty single quotes data -- +-- Iteration 7 : empty single quotes data -- Before : int(1) After : int(2) --- Iteration 10 : string data -- +-- Iteration 8 : string data -- Before : int(3) After : int(4) --- Iteration 11 : undefined data -- +-- Iteration 9 : undefined data -- Before : int(1) After : int(2) --- Iteration 12 : unset data -- +-- Iteration 10 : unset data -- Before : int(1) After : int(2) Done diff --git a/ext/standard/tests/array/array_rand_variation4.phpt b/ext/standard/tests/array/array_rand_variation4.phpt index 1ddcec1933..a714244766 100644 --- a/ext/standard/tests/array/array_rand_variation4.phpt +++ b/ext/standard/tests/array/array_rand_variation4.phpt @@ -14,8 +14,7 @@ $asso_arrays = array( // array with numeric keys /*1*/ array(1 => 'one', 2 => 2, 1234567890 => 'big', -1 => 'negative key', - 2.3 => 'float key', 0 => "zero key", 0.2 => 'decimal key', - 2e2 => 'exp key1', -2e3 => 'negative exp key'), + 0 => "zero key"), // array with string keys array('one' => 1, "two" => 2.0, "three" => 'three', diff --git a/ext/standard/tests/array/array_rand_variation5.phpt b/ext/standard/tests/array/array_rand_variation5.phpt index 4a4295c615..57f5ee03af 100644 --- a/ext/standard/tests/array/array_rand_variation5.phpt +++ b/ext/standard/tests/array/array_rand_variation5.phpt @@ -12,8 +12,7 @@ echo "*** Testing array_rand() : with invalid values for 'req_num' ***\n"; // initialise associative arrays $input = array( - 1 => 'one', 2.2 => 'float key', 0.9 => 'decimal key', - 2e2 => 'exp key1', 2000e-3 => 'negative exp key', + 1 => 'one', 0xabc => 2748, 0x12f => '303', 0xff => "255", 0123 => 83, 012 => 10, 010 => "8" ); diff --git a/ext/standard/tests/array/array_reverse_variation4.phpt b/ext/standard/tests/array/array_reverse_variation4.phpt index 861b5972a4..9a4fcbffbb 100644 --- a/ext/standard/tests/array/array_reverse_variation4.phpt +++ b/ext/standard/tests/array/array_reverse_variation4.phpt @@ -39,10 +39,6 @@ $arrays = array ( array(1 => "1"), array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), - // arrays with float keys -/*5*/ array(2.3333 => "float"), - array(1.2 => "f1", 3.33 => "f2", 4.89999922839999 => "f3", 33333333.333333 => "f4"), - // arrays with string keys array("\tHello" => 111, "re\td" => "color", "\v\fworld" => 2.2, "pen\n" => 33), /*8*/ array("\tHello" => 111, "re\td" => "color", "\v\fworld" => 2.2, "pen\n" => 33), @@ -159,56 +155,6 @@ array(4) { } -- Iteration 5 -- - default argument - -array(1) { - [0]=> - string(5) "float" -} -- $preserve keys = true - -array(1) { - [2]=> - string(5) "float" -} -- $preserve_keys = false - -array(1) { - [0]=> - string(5) "float" -} --- Iteration 6 -- -- default argument - -array(4) { - [0]=> - string(2) "f4" - [1]=> - string(2) "f3" - [2]=> - string(2) "f2" - [3]=> - string(2) "f1" -} -- $preserve keys = true - -array(4) { - [33333333]=> - string(2) "f4" - [4]=> - string(2) "f3" - [3]=> - string(2) "f2" - [1]=> - string(2) "f1" -} -- $preserve_keys = false - -array(4) { - [0]=> - string(2) "f4" - [1]=> - string(2) "f3" - [2]=> - string(2) "f2" - [3]=> - string(2) "f1" -} --- Iteration 7 -- -- default argument - array(4) { ["pen "]=> @@ -244,7 +190,7 @@ array(4) { [" Hello"]=> int(111) } --- Iteration 8 -- +-- Iteration 6 -- - default argument - array(4) { ["pen @@ -281,7 +227,7 @@ array(4) { [" Hello"]=> int(111) } --- Iteration 9 -- +-- Iteration 7 -- - default argument - array(2) { ["Hello world"]=> @@ -303,7 +249,7 @@ array(2) { [0]=> string(5) "hello" } --- Iteration 10 -- +-- Iteration 8 -- - default argument - array(2) { [0]=> @@ -325,7 +271,7 @@ array(2) { [""]=> string(5) "hello" } --- Iteration 11 -- +-- Iteration 9 -- - default argument - array(7) { ["Hello world"]=> diff --git a/ext/standard/tests/array/array_reverse_variation5.phpt b/ext/standard/tests/array/array_reverse_variation5.phpt index d5651e4551..dcefab26a3 100644 --- a/ext/standard/tests/array/array_reverse_variation5.phpt +++ b/ext/standard/tests/array/array_reverse_variation5.phpt @@ -47,8 +47,8 @@ $arrays = array ( array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333333), // arrays with string values - array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), -/*8*/ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), + array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3 => "pen\n"), +/*8*/ array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3 => 'pen\n'), array(1 => "hello", "heredoc" => $heredoc), // array with object, unset variable and resource variable diff --git a/ext/standard/tests/array/array_search_variation1.phpt b/ext/standard/tests/array/array_search_variation1.phpt index d62501f418..a2838810a1 100644 --- a/ext/standard/tests/array/array_search_variation1.phpt +++ b/ext/standard/tests/array/array_search_variation1.phpt @@ -9,7 +9,7 @@ $arrays = array ( array(0), array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL, "b", "ab", "abcd"), array(4, array(1, 2 => 3), "one" => 1, "5" => 5 ), - array(-1, -2, -3, -4, -2.989888, "-0.005" => "neg0.005", 2.0 => "float2", "-.9" => -.9), + array(-1, -2, -3, -4, -2.989888, "-0.005" => "neg0.005", 2 => "float2", "-.9" => -.9), array(TRUE, FALSE), array("", array()), array("abcd\x00abcd\x00abcd"), diff --git a/ext/standard/tests/array/array_search_variation2.phpt b/ext/standard/tests/array/array_search_variation2.phpt index 84928c5922..c391989f32 100644 --- a/ext/standard/tests/array/array_search_variation2.phpt +++ b/ext/standard/tests/array/array_search_variation2.phpt @@ -12,7 +12,7 @@ $misc_array = array ( 3, ".001" =>-67, "-.051" =>"k", - 0.091 =>"-.08", + 0 =>"-.08", "e" =>"5", "y" =>NULL, NULL =>"", diff --git a/ext/standard/tests/array/array_shift_variation3.phpt b/ext/standard/tests/array/array_shift_variation3.phpt index bc06b41d01..e43bc86858 100644 --- a/ext/standard/tests/array/array_shift_variation3.phpt +++ b/ext/standard/tests/array/array_shift_variation3.phpt @@ -28,18 +28,6 @@ $inputs = array( -2345 => 'negative', ), - // float data -/*2*/ 'float' => array( - 10.5 => 'positive', - -10.5 => 'negative', - .5 => 'half', - ), - -/*3*/ 'extreme floats' => array( - 12.3456789000e10 => 'large', - 12.3456789000E-10 => 'small', - ), - // null data /*4*/ 'null uppercase' => array( NULL => 'null 1', @@ -112,57 +100,41 @@ array(3) { string(8) "negative" } --- Iteration 2 : float data -- -string(8) "positive" -array(2) { - [0]=> - string(8) "negative" - [1]=> - string(4) "half" -} - --- Iteration 3 : extreme floats data -- -string(5) "large" -array(1) { - [0]=> - string(5) "small" -} - --- Iteration 4 : null uppercase data -- +-- Iteration 2 : null uppercase data -- string(6) "null 1" array(0) { } --- Iteration 5 : null lowercase data -- +-- Iteration 3 : null lowercase data -- string(6) "null 2" array(0) { } --- Iteration 6 : bool lowercase data -- +-- Iteration 4 : bool lowercase data -- string(6) "lowert" array(1) { [0]=> string(6) "lowerf" } --- Iteration 7 : bool uppercase data -- +-- Iteration 5 : bool uppercase data -- string(6) "uppert" array(1) { [0]=> string(6) "upperf" } --- Iteration 8 : empty double quotes data -- +-- Iteration 6 : empty double quotes data -- string(6) "emptyd" array(0) { } --- Iteration 9 : empty single quotes data -- +-- Iteration 7 : empty single quotes data -- string(6) "emptys" array(0) { } --- Iteration 10 : string data -- +-- Iteration 8 : string data -- string(7) "stringd" array(2) { ["strings"]=> @@ -171,12 +143,12 @@ array(2) { string(7) "stringh" } --- Iteration 11 : undefined data -- +-- Iteration 9 : undefined data -- string(9) "undefined" array(0) { } --- Iteration 12 : unset data -- +-- Iteration 10 : unset data -- string(5) "unset" array(0) { } diff --git a/ext/standard/tests/array/array_slice.phpt b/ext/standard/tests/array/array_slice.phpt index a76277883a..f12f6d62fa 100644 --- a/ext/standard/tests/array/array_slice.phpt +++ b/ext/standard/tests/array/array_slice.phpt @@ -11,8 +11,8 @@ $var_array = array( array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee"), array("1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five"), array(1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five"), - array("f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", - "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five"), + array("f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five"), array(12, "name", 'age', '45'), array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array()) ); diff --git a/ext/standard/tests/array/array_slice_variation7.phpt b/ext/standard/tests/array/array_slice_variation7.phpt index a579f292ef..d0db376ad5 100644 --- a/ext/standard/tests/array/array_slice_variation7.phpt +++ b/ext/standard/tests/array/array_slice_variation7.phpt @@ -33,18 +33,6 @@ $inputs = array( -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', @@ -132,43 +120,7 @@ array(4) { string(8) "negative" } --- Iteration 2 : key type is float -- -$preserve_keys = TRUE -array(3) { - [10]=> - string(8) "positive" - [-10]=> - string(8) "negative" - [0]=> - string(4) "half" -} -$preserve_keys = FALSE -array(3) { - [0]=> - string(8) "positive" - [1]=> - string(8) "negative" - [2]=> - string(4) "half" -} - --- Iteration 3 : key type is extreme floats -- -$preserve_keys = TRUE -array(2) { - [12345678]=> - string(5) "large" - [0]=> - string(5) "small" -} -$preserve_keys = FALSE -array(2) { - [0]=> - string(5) "large" - [1]=> - string(5) "small" -} - --- Iteration 4 : key type is null uppercase -- +-- Iteration 2 : key type is null uppercase -- $preserve_keys = TRUE array(1) { [""]=> @@ -180,7 +132,7 @@ array(1) { string(6) "null 1" } --- Iteration 5 : key type is null lowercase -- +-- Iteration 3 : key type is null lowercase -- $preserve_keys = TRUE array(1) { [""]=> @@ -192,7 +144,7 @@ array(1) { string(6) "null 2" } --- Iteration 6 : key type is bool lowercase -- +-- Iteration 4 : key type is bool lowercase -- $preserve_keys = TRUE array(2) { [1]=> @@ -208,7 +160,7 @@ array(2) { string(6) "lowerf" } --- Iteration 7 : key type is bool uppercase -- +-- Iteration 5 : key type is bool uppercase -- $preserve_keys = TRUE array(2) { [1]=> @@ -224,7 +176,7 @@ array(2) { string(6) "upperf" } --- Iteration 8 : key type is empty double quotes -- +-- Iteration 6 : key type is empty double quotes -- $preserve_keys = TRUE array(1) { [""]=> @@ -236,7 +188,7 @@ array(1) { string(6) "emptyd" } --- Iteration 9 : key type is empty single quotes -- +-- Iteration 7 : key type is empty single quotes -- $preserve_keys = TRUE array(1) { [""]=> @@ -248,7 +200,7 @@ array(1) { string(6) "emptys" } --- Iteration 10 : key type is string -- +-- Iteration 8 : key type is string -- $preserve_keys = TRUE array(3) { ["stringd"]=> @@ -268,7 +220,7 @@ array(3) { string(7) "stringh" } --- Iteration 11 : key type is undefined -- +-- Iteration 9 : key type is undefined -- $preserve_keys = TRUE array(1) { [""]=> @@ -280,7 +232,7 @@ array(1) { string(9) "undefined" } --- Iteration 12 : key type is unset -- +-- Iteration 10 : key type is unset -- $preserve_keys = TRUE array(1) { [""]=> diff --git a/ext/standard/tests/array/array_udiff_assoc_variation.phpt b/ext/standard/tests/array/array_udiff_assoc_variation.phpt index 83af4bce95..9250f5957b 100644 --- a/ext/standard/tests/array/array_udiff_assoc_variation.phpt +++ b/ext/standard/tests/array/array_udiff_assoc_variation.phpt @@ -8,7 +8,7 @@ include('compare_function.inc'); $key_compare_function = 'compare_function'; // Initialise all required variables -$arr1 = array("one" => "one", "02" => "two", '3' => "three", "four", "0.5" => 5, 6.0 => 6, "seven" => "07"); +$arr1 = array("one" => "one", "02" => "two", '3' => "three", "four", "0.5" => 5, 6 => 6, "seven" => "07"); $arr2 = array("one" => "one", "02" => "two", '3' => "three"); $arr3 = array("four", "0.5" => "five", 6 => 6, "seven" => 7); $arr4 = array("four", "0.5" => "five", 6 => 6, "seven" => 7); diff --git a/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt b/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt index bd8163c82d..57a735b864 100644 --- a/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt +++ b/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt @@ -8,7 +8,7 @@ include('compare_function.inc'); $data_compare_function = 'compare_function'; // Initialise all required variables -$arr1 = array("one" => "one", "02" => "two", '3' => "three", "four", "0.5" => 5, 0.6 => 6, "0x7" => "seven"); +$arr1 = array("one" => "one", "02" => "two", '3' => "three", "four", "0.5" => 5, 0 => 6, "0x7" => "seven"); $arr2 = array("one" => "one", "02" => "two", '3' => "three"); $arr3 = array("one" => "one", '3' => "three", "0.5" => 5); $arr4 = array("one" => "one", '3' => "three", "0.5" => 5); diff --git a/ext/standard/tests/array/array_unique_variation3.phpt b/ext/standard/tests/array/array_unique_variation3.phpt index fb38929909..b412a19a42 100644 --- a/ext/standard/tests/array/array_unique_variation3.phpt +++ b/ext/standard/tests/array/array_unique_variation3.phpt @@ -35,10 +35,6 @@ $inputs = array ( array(0 => "0", 1 => "0"), array(1 => "1", 2 => "2", 3 => 1, 4 => "4"), - // arrays with float keys -/*3*/ array(2.3333 => "float", 44.44 => "float"), - array(1.2 => "f1", 3.33 => "f2", 4.89999922839999 => "f1", 3333333.333333 => "f4"), - // arrays with string keys /*5*/ array('\tHello' => 111, 're\td' => "color", '\v\fworld' => 2.2, 'pen\n' => 111), array("\tHello" => 111, "re\td" => "color", "\v\fworld" => 2.2, "pen\n" => 111), @@ -79,20 +75,6 @@ array(3) { string(1) "4" } -- Iteration 3 -- -array(1) { - [2]=> - string(5) "float" -} --- Iteration 4 -- -array(3) { - [1]=> - string(2) "f1" - [3]=> - string(2) "f2" - [3333333]=> - string(2) "f4" -} --- Iteration 5 -- array(3) { ["\tHello"]=> int(111) @@ -101,7 +83,7 @@ array(3) { ["\v\fworld"]=> float(2.2) } --- Iteration 6 -- +-- Iteration 4 -- array(3) { [" Hello"]=> int(111) @@ -110,14 +92,14 @@ array(3) { ["world"]=> float(2.2) } --- Iteration 7 -- +-- Iteration 5 -- array(2) { [0]=> string(5) "hello" ["Hello world"]=> string(6) "string" } --- Iteration 8 -- +-- Iteration 6 -- array(3) { [""]=> string(5) "hello" diff --git a/ext/standard/tests/array/array_unique_variation4.phpt b/ext/standard/tests/array/array_unique_variation4.phpt index 1912fe26ac..7b4f8bd443 100644 --- a/ext/standard/tests/array/array_unique_variation4.phpt +++ b/ext/standard/tests/array/array_unique_variation4.phpt @@ -35,13 +35,9 @@ $inputs = array ( /*1*/ array('0' => 0, '1' => 0), array("one" => 1, 'two' => 2, "three" => 1, 4 => 1), - // arrays with float values -/*3*/ array("float1" => 2.3333, "float2" => 2.3333), - array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 1.2), - // arrays with string values -/*5*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "\tHello"), - array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => '\tHello'), +/*5*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3 => "\tHello"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3 => '\tHello'), array(1 => "hello", "heredoc" => $heredoc, $heredoc), // array with object, unset variable and resource variable @@ -75,20 +71,6 @@ array(2) { int(2) } -- Iteration 3 -- -array(1) { - ["float1"]=> - float(2.3333) -} --- Iteration 4 -- -array(3) { - ["f1"]=> - float(1.2) - ["f2"]=> - float(3.33) - [3]=> - float(4.89999922839999) -} --- Iteration 5 -- array(3) { [111]=> string(6) " Hello" @@ -97,7 +79,7 @@ array(3) { [2]=> string(7) "world" } --- Iteration 6 -- +-- Iteration 4 -- array(3) { [111]=> string(7) "\tHello" @@ -106,14 +88,14 @@ array(3) { [2]=> string(9) "\v\fworld" } --- Iteration 7 -- +-- Iteration 5 -- array(2) { [1]=> string(5) "hello" ["heredoc"]=> string(11) "Hello world" } --- Iteration 8 -- +-- Iteration 6 -- array(3) { [11]=> object(classA)#%d (0) { diff --git a/ext/standard/tests/array/array_unshift_variation4.phpt b/ext/standard/tests/array/array_unshift_variation4.phpt index 0be7ab18e2..4a5c53c472 100644 --- a/ext/standard/tests/array/array_unshift_variation4.phpt +++ b/ext/standard/tests/array/array_unshift_variation4.phpt @@ -44,12 +44,6 @@ $arrays = array ( array(1 => "1"), array(1 => "1", 2 => "2", 3 => "3", 4 => "4"), - // arrays with float keys -/*5*/ array(2.3333 => "float"), - array(1.2 => "f1", 3.33 => "f2", - 4.89999922839999 => "f3", - 33333333.333333 => "f4"), - // arrays with string keys /*7*/ array('\tHello' => 111, 're\td' => "color", '\v\fworld' => 2.2, 'pen\n' => 33), @@ -184,56 +178,6 @@ array(7) { string(1) "4" } -- Iteration 5 -- -int(2) -array(2) { - [0]=> - int(10) - [1]=> - string(5) "float" -} -int(4) -array(4) { - [0]=> - int(10) - [1]=> - string(5) "hello" - [2]=> - string(5) "world" - [3]=> - string(5) "float" -} --- Iteration 6 -- -int(5) -array(5) { - [0]=> - int(10) - [1]=> - string(2) "f1" - [2]=> - string(2) "f2" - [3]=> - string(2) "f3" - [4]=> - string(2) "f4" -} -int(7) -array(7) { - [0]=> - int(10) - [1]=> - string(5) "hello" - [2]=> - string(5) "world" - [3]=> - string(2) "f1" - [4]=> - string(2) "f2" - [5]=> - string(2) "f3" - [6]=> - string(2) "f4" -} --- Iteration 7 -- int(5) array(5) { [0]=> @@ -264,7 +208,7 @@ array(7) { ["pen\n"]=> int(33) } --- Iteration 8 -- +-- Iteration 6 -- int(5) array(5) { [0]=> @@ -297,7 +241,7 @@ array(7) { "]=> int(33) } --- Iteration 9 -- +-- Iteration 7 -- int(3) array(3) { [0]=> @@ -320,7 +264,7 @@ array(5) { ["Hello world"]=> string(6) "string" } --- Iteration 10 -- +-- Iteration 8 -- int(3) array(3) { [0]=> @@ -343,7 +287,7 @@ array(5) { [3]=> string(8) "resource" } --- Iteration 11 -- +-- Iteration 9 -- int(8) array(8) { [0]=> diff --git a/ext/standard/tests/array/array_unshift_variation5.phpt b/ext/standard/tests/array/array_unshift_variation5.phpt index 6f642ed53e..ed3087cb57 100644 --- a/ext/standard/tests/array/array_unshift_variation5.phpt +++ b/ext/standard/tests/array/array_unshift_variation5.phpt @@ -51,8 +51,8 @@ $arrays = array ( array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333333), // arrays with string values -/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"), - array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'), +/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3 => "pen\n"), + array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3 => 'pen\n'), array(1 => "hello", "heredoc" => $heredoc), // array with object, unset variable and resource variable diff --git a/ext/standard/tests/array/array_values_variation3.phpt b/ext/standard/tests/array/array_values_variation3.phpt index 9d5f322404..4d09a31fb8 100644 --- a/ext/standard/tests/array/array_values_variation3.phpt +++ b/ext/standard/tests/array/array_values_variation3.phpt @@ -29,18 +29,6 @@ $inputs = array( -2345 => 'negative', ), - // float data -/*2*/ 'float' => array( - 10.5 => 'positive', - -10.5 => 'negative', - .5 => 'half', - ), - -/*3*/ 'extreme floats' => array( - 12.3456789000e10 => 'large', - 12.3456789000E-10 => 'small', - ), - // null data /*4*/ 'null uppercase' => array( NULL => 'null 1', @@ -112,37 +100,19 @@ array(4) { string(8) "negative" } --- Iteration 2: float data -- -array(3) { - [0]=> - string(8) "positive" - [1]=> - string(8) "negative" - [2]=> - string(4) "half" -} - --- Iteration 3: extreme floats data -- -array(2) { - [0]=> - string(5) "large" - [1]=> - string(5) "small" -} - --- Iteration 4: null uppercase data -- +-- Iteration 2: null uppercase data -- array(1) { [0]=> string(6) "null 1" } --- Iteration 5: null lowercase data -- +-- Iteration 3: null lowercase data -- array(1) { [0]=> string(6) "null 2" } --- Iteration 6: bool lowercase data -- +-- Iteration 4: bool lowercase data -- array(2) { [0]=> string(6) "lowert" @@ -150,7 +120,7 @@ array(2) { string(6) "lowerf" } --- Iteration 7: bool uppercase data -- +-- Iteration 5: bool uppercase data -- array(2) { [0]=> string(6) "uppert" @@ -158,19 +128,19 @@ array(2) { string(6) "upperf" } --- Iteration 8: empty double quotes data -- +-- Iteration 6: empty double quotes data -- array(1) { [0]=> string(6) "emptyd" } --- Iteration 9: empty single quotes data -- +-- Iteration 7: empty single quotes data -- array(1) { [0]=> string(6) "emptys" } --- Iteration 10: string data -- +-- Iteration 8: string data -- array(3) { [0]=> string(7) "stringd" @@ -180,13 +150,13 @@ array(3) { string(7) "stringh" } --- Iteration 11: undefined data -- +-- Iteration 9: undefined data -- array(1) { [0]=> string(9) "undefined" } --- Iteration 12: unset data -- +-- Iteration 10: unset data -- array(1) { [0]=> string(5) "unset" diff --git a/ext/standard/tests/array/arsort_variation11.phpt b/ext/standard/tests/array/arsort_variation11.phpt Binary files differindex 10958375d9..2da7a6fce3 100644 --- a/ext/standard/tests/array/arsort_variation11.phpt +++ b/ext/standard/tests/array/arsort_variation11.phpt diff --git a/ext/standard/tests/array/asort_variation11.phpt b/ext/standard/tests/array/asort_variation11.phpt Binary files differindex e614d15433..e6112672a6 100644 --- a/ext/standard/tests/array/asort_variation11.phpt +++ b/ext/standard/tests/array/asort_variation11.phpt diff --git a/ext/standard/tests/array/bug24766.phpt b/ext/standard/tests/array/bug24766.phpt index 2b5f8e0830..ebe2f3928f 100644 --- a/ext/standard/tests/array/bug24766.phpt +++ b/ext/standard/tests/array/bug24766.phpt @@ -7,35 +7,35 @@ error_reporting(E_ALL); $a = unpack('C2', "\0224V"); $b = array(1 => 18, 2 => 52); -debug_zval_dump($a, $b); +var_dump($a, $b); $k = array_keys($a); $l = array_keys($b); -debug_zval_dump($k, $l); +var_dump($k, $l); $i=$k[0]; var_dump($a[$i]); $i=$l[0]; var_dump($b[$i]); ?> ---EXPECTF-- -array(2) refcount(%d){ +--EXPECT-- +array(2) { [1]=> int(18) [2]=> int(52) } -array(2) refcount(%d){ +array(2) { [1]=> int(18) [2]=> int(52) } -array(2) refcount(%d){ +array(2) { [0]=> int(1) [1]=> int(2) } -array(2) refcount(%d){ +array(2) { [0]=> int(1) [1]=> diff --git a/ext/standard/tests/array/bug25708.phpt b/ext/standard/tests/array/bug25708.phpt index 0e695b69c9..89cb1f2dbf 100644 --- a/ext/standard/tests/array/bug25708.phpt +++ b/ext/standard/tests/array/bug25708.phpt @@ -21,7 +21,7 @@ function foo($ref, $alt) { $b = NULL; } - debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); + var_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); echo "--\n"; if ($alt) { $a = &$GLOBALS['a']; @@ -29,25 +29,25 @@ function foo($ref, $alt) { } else { extract($GLOBALS, EXTR_REFS); } - debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); + var_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); echo "--\n"; $a = &$GLOBALS['a']; $b = &$GLOBALS['b']; - debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); + var_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); echo "--\n"; $GLOBALS['b'] = 3; - debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); + var_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); echo "--\n"; $a = 4; - debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); + var_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']); echo "--\n"; $c = $b; - debug_zval_dump($b, $GLOBALS['b'], $c); + var_dump($b, $GLOBALS['b'], $c); echo "--\n"; $b = 'x'; - debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b'], $c); + var_dump($a, $b, $GLOBALS['a'], $GLOBALS['b'], $c); echo "--\n"; - debug_zval_dump($org_a, $org_b); + var_dump($org_a, $org_b); echo "----"; if ($ref) echo 'r'; if ($alt) echo 'a'; @@ -64,9 +64,9 @@ foo(true, true); foo(false, false); foo(true, false); -debug_zval_dump($_a, $_b); +var_dump($_a, $_b); ?> ---EXPECTF-- +--EXPECT-- NULL NULL int(1) @@ -97,9 +97,9 @@ int(3) int(3) -- int(4) -string(1) "x" refcount(%d) +string(1) "x" int(4) -string(1) "x" refcount(%d) +string(1) "x" int(3) -- int(1) @@ -135,9 +135,9 @@ int(3) int(3) -- int(4) -string(1) "x" refcount(%d) +string(1) "x" int(4) -string(1) "x" refcount(%d) +string(1) "x" int(3) -- int(1) @@ -173,9 +173,9 @@ int(3) int(3) -- int(4) -string(1) "x" refcount(%d) +string(1) "x" int(4) -string(1) "x" refcount(%d) +string(1) "x" int(3) -- int(1) @@ -211,13 +211,13 @@ int(3) int(3) -- int(4) -string(1) "x" refcount(%d) +string(1) "x" int(4) -string(1) "x" refcount(%d) +string(1) "x" int(3) -- int(1) int(2) ----r -string(2) "ok" refcount(%d) -string(2) "ok" refcount(%d) +string(2) "ok" +string(2) "ok" diff --git a/ext/standard/tests/array/bug26458.phpt b/ext/standard/tests/array/bug26458.phpt Binary files differindex 455ab2b345..87c8b519bf 100644 --- a/ext/standard/tests/array/bug26458.phpt +++ b/ext/standard/tests/array/bug26458.phpt diff --git a/ext/standard/tests/array/bug29253.phpt b/ext/standard/tests/array/bug29253.phpt index 4a1a90ebea..f97b1673ff 100644 --- a/ext/standard/tests/array/bug29253.phpt +++ b/ext/standard/tests/array/bug29253.phpt @@ -7,7 +7,11 @@ $gg = 'afad'; var_dump(@array_diff_assoc($GLOBALS, $zz)); var_dump($gg); ?> ---EXPECT-- -array(0) { +--EXPECTF-- +array(2) { + ["zz"]=> + %A + ["gg"]=> + string(4) "afad" } string(4) "afad" diff --git a/ext/standard/tests/array/bug31158.phpt b/ext/standard/tests/array/bug31158.phpt index 02d74875d3..9c4ddad338 100644 --- a/ext/standard/tests/array/bug31158.phpt +++ b/ext/standard/tests/array/bug31158.phpt @@ -14,7 +14,8 @@ __(); echo "ok\n"; ?> --EXPECTF-- -Warning: Undefined variable $GLOBALS in %s on line %d - -Warning: Trying to access array offset on value of type null in %s on line %d -ok +Fatal error: Uncaught Error: array_splice(): Argument #1 ($array) cannot be passed by reference in %s:%d +Stack trace: +#0 %s(%d): __() +#1 {main} + thrown in %s on line %d diff --git a/ext/standard/tests/array/bug65251.phpt b/ext/standard/tests/array/bug65251.phpt index 3e0f3a1e27..6d9cded21c 100644 --- a/ext/standard/tests/array/bug65251.phpt +++ b/ext/standard/tests/array/bug65251.phpt @@ -3,6 +3,7 @@ Bug #65251: array_merge_recursive() recursion detection broken --FILE-- <?php +/* This no longer involves any recursion. */ try { array_merge_recursive($GLOBALS, $GLOBALS); } catch (\Error $e) { @@ -10,5 +11,6 @@ try { } ?> +===DONE=== --EXPECT-- -Recursion detected +===DONE=== diff --git a/ext/standard/tests/array/bug72369.phpt b/ext/standard/tests/array/bug72369.phpt index 63bb5625de..87d9aac357 100644 --- a/ext/standard/tests/array/bug72369.phpt +++ b/ext/standard/tests/array/bug72369.phpt @@ -12,5 +12,5 @@ debug_zval_dump($a); --EXPECTF-- array(1) refcount(%d){ ["test"]=> - string(3) "xxx" refcount(%d) + string(3) "xxx" interned } diff --git a/ext/standard/tests/array/count_invalid_mode.phpt b/ext/standard/tests/array/count_invalid_mode.phpt index 4f7950e727..be39690e85 100644 --- a/ext/standard/tests/array/count_invalid_mode.phpt +++ b/ext/standard/tests/array/count_invalid_mode.phpt @@ -9,11 +9,9 @@ $modes = [ 0, 1, -1, - -1.45, 2, TRUE, FALSE, - NULL, ]; foreach ($modes as $mode) { @@ -31,7 +29,5 @@ int(0) int(0) count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE -count(): Argument #2 ($mode) must be either COUNT_NORMAL or COUNT_RECURSIVE -int(0) int(0) int(0) diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt index 321706bc24..278307aca0 100644 --- a/ext/standard/tests/array/count_recursive.phpt +++ b/ext/standard/tests/array/count_recursive.phpt @@ -27,15 +27,15 @@ echo "\n*** Testing possible variations of count() function on arrays ***"; $count_array = array( array(), array( 1 => "string"), - array( "" => "string", 0 => "a", NULL => "b", -1.00 => "c", + array( "" => "string", 0 => "a", NULL => "b", -1 => "c", array(array(array(NULL)))), - array( -2.44444 => 12, array(array(1, 2, array(array("0"))))), + array( -2 => 12, array(array(1, 2, array(array("0"))))), array( "a" => 1, "b" => -2.344, "b" => "string", "c" => NULL, "d" => -2.344), array( 4 => 1, 3 => -2.344, "3" => "string", "2" => NULL, 1 => -2.344, array()), array( TRUE => TRUE, FALSE => FALSE, "" => "", " " => " ", NULL => NULL, "\x000" => "\x000", "\000" => "\000"), - array( NULL, 1.23 => "Hi", "string" => "hello", + array( NULL, 1 => "Hi", "string" => "hello", array("" => "World", "-2.34" => "a", "0" => "b")) ); diff --git a/ext/standard/tests/array/end_64bit.phpt b/ext/standard/tests/array/end_64bit.phpt index d4bc3c143e..5069c34629 100644 --- a/ext/standard/tests/array/end_64bit.phpt +++ b/ext/standard/tests/array/end_64bit.phpt @@ -14,7 +14,7 @@ $arrays = array ( range('a', 'z', 2 ), array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL ), array(1, array(1, 2 => 3 ), "one" => 1, "5" => 5 ), - array(-1, -2, -3, -4, "-0.005" => "neg0.005", 2.0 => "float2", "neg.9" => -.9 ), + array(-1, -2, -3, -4, "-0.005" => "neg0.005", 2 => "float2", "neg.9" => -.9 ), array(1.0005, 2.000000, -3.000000, -4.9999999 ), array(true, false), array("PHP", "Web2.0", "SOA"), diff --git a/ext/standard/tests/array/extract_safety.phpt b/ext/standard/tests/array/extract_safety.phpt index bebbaa1988..a9200d25c4 100644 --- a/ext/standard/tests/array/extract_safety.phpt +++ b/ext/standard/tests/array/extract_safety.phpt @@ -3,7 +3,7 @@ Test extract() for overwrite of GLOBALS --FILE-- <?php $str = "John"; -debug_zval_dump($GLOBALS["str"]); +var_dump($GLOBALS["str"]); /* Extracting Global Variables */ $splat = array("foo" => "bar"); @@ -11,13 +11,13 @@ var_dump(extract(array("GLOBALS" => $splat, EXTR_OVERWRITE))); unset ($splat); -debug_zval_dump($GLOBALS["str"]); +var_dump($GLOBALS["str"]); echo "\nDone"; ?> ---EXPECTF-- -string(4) "John" refcount(%d) -int(0) -string(4) "John" refcount(%d) +--EXPECT-- +string(4) "John" +int(1) +string(4) "John" Done diff --git a/ext/standard/tests/array/extract_variation1.phpt b/ext/standard/tests/array/extract_variation1.phpt index a1f1faa303..a629ae0360 100644 --- a/ext/standard/tests/array/extract_variation1.phpt +++ b/ext/standard/tests/array/extract_variation1.phpt @@ -6,21 +6,21 @@ Test extract() function (variation 1) $val = 4; $str = "John"; -debug_zval_dump($val); -debug_zval_dump($str); +var_dump($val); +var_dump($str); /* Extracting Global Variables */ var_dump(extract($GLOBALS, EXTR_REFS)); -debug_zval_dump($val); -debug_zval_dump($str); +var_dump($val); +var_dump($str); echo "\nDone"; ?> --EXPECTF-- int(4) -string(4) "John" refcount(%d) +string(4) "John" int(%d) int(4) -string(4) "John" refcount(%d) +string(4) "John" Done diff --git a/ext/standard/tests/array/extract_variation4.phpt b/ext/standard/tests/array/extract_variation4.phpt index d755a6a214..cdbbce225c 100644 --- a/ext/standard/tests/array/extract_variation4.phpt +++ b/ext/standard/tests/array/extract_variation4.phpt @@ -5,8 +5,8 @@ Test extract() function (variation 4) $mixed_array = array( array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ), - array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", - "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), + array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ), array( 12, "name", 'age', '45' ), ); diff --git a/ext/standard/tests/array/extract_variation5.phpt b/ext/standard/tests/array/extract_variation5.phpt index 91867b1112..9ddefd4aaa 100644 --- a/ext/standard/tests/array/extract_variation5.phpt +++ b/ext/standard/tests/array/extract_variation5.phpt @@ -6,7 +6,7 @@ Test extract() function (variation 5) $mixed_array = array( array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ), array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6, - 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 ) + 5 => 57, "5.4" => 554, "5.7" => 557 ) ); $counter = 0; diff --git a/ext/standard/tests/array/extract_variation7.phpt b/ext/standard/tests/array/extract_variation7.phpt index eb5171bfc7..268a247736 100644 --- a/ext/standard/tests/array/extract_variation7.phpt +++ b/ext/standard/tests/array/extract_variation7.phpt @@ -8,8 +8,8 @@ echo "\n*** Testing for EXTR_PREFIX_ALL called twice with same prefix string *** $a = array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ); var_dump ( extract($a, EXTR_PREFIX_ALL, "same")); -$b = array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF", - "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ); +$b = array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2 => "float", "F" => "FFF", + "blank" => "", 3 => 3.7, 5 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ); var_dump ( extract($b, EXTR_PREFIX_ALL, "same")); var_dump ( extract($b, EXTR_PREFIX_ALL, "diff")); diff --git a/ext/standard/tests/array/in_array_variation1.phpt b/ext/standard/tests/array/in_array_variation1.phpt index 6bb0b36d34..0c88a45332 100644 --- a/ext/standard/tests/array/in_array_variation1.phpt +++ b/ext/standard/tests/array/in_array_variation1.phpt @@ -9,7 +9,7 @@ $arrays = array ( array(0), array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL, "b", "ab", "abcd"), array(4, array(1, 2 => 3), "one" => 1, "5" => 5 ), - array(-1, -2, -3, -4, -2.989888, "-0.005" => "neg0.005", 2.0 => "float2", "-.9" => -.9), + array(-1, -2, -3, -4, -2.989888, "-0.005" => "neg0.005", 2 => "float2", "-.9" => -.9), array(TRUE, FALSE), array("", array()), array("abcd\x00abcd\x00abcd"), diff --git a/ext/standard/tests/array/in_array_variation2.phpt b/ext/standard/tests/array/in_array_variation2.phpt index af4191577a..3976232243 100644 --- a/ext/standard/tests/array/in_array_variation2.phpt +++ b/ext/standard/tests/array/in_array_variation2.phpt @@ -11,7 +11,7 @@ $misc_array = array ( 3, ".001" =>-67, "-.051" =>"k", - 0.091 =>"-.08", + 0 =>"-.08", "e" =>"5", "y" =>NULL, NULL =>"", diff --git a/ext/standard/tests/array/key_variation2.phpt b/ext/standard/tests/array/key_variation2.phpt index 1107999c10..d1eed890ff 100644 --- a/ext/standard/tests/array/key_variation2.phpt +++ b/ext/standard/tests/array/key_variation2.phpt @@ -28,18 +28,6 @@ $inputs = array( -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', @@ -107,42 +95,33 @@ int(1) int(12345) int(-2345) --- Iteration 2 : float data -- -int(10) -int(-10) -int(0) - --- Iteration 3 : extreme floats data -- -int(12345678) -int(0) - --- Iteration 4 : null uppercase data -- +-- Iteration 2 : null uppercase data -- string(0) "" --- Iteration 5 : null lowercase data -- +-- Iteration 3 : null lowercase data -- string(0) "" --- Iteration 6 : bool lowercase data -- +-- Iteration 4 : bool lowercase data -- int(1) int(0) --- Iteration 7 : bool uppercase data -- +-- Iteration 5 : bool uppercase data -- int(1) int(0) --- Iteration 8 : empty double quotes data -- +-- Iteration 6 : empty double quotes data -- string(0) "" --- Iteration 9 : empty single quotes data -- +-- Iteration 7 : empty single quotes data -- string(0) "" --- Iteration 10 : string data -- +-- Iteration 8 : string data -- string(7) "stringd" string(7) "strings" string(11) "hello world" --- Iteration 11 : undefined data -- +-- Iteration 9 : undefined data -- string(0) "" --- Iteration 12 : unset data -- +-- Iteration 10 : unset data -- string(0) "" diff --git a/ext/standard/tests/array/krsort_variation3.phpt b/ext/standard/tests/array/krsort_variation3.phpt index ffc6cc356e..979d38442e 100644 --- a/ext/standard/tests/array/krsort_variation3.phpt +++ b/ext/standard/tests/array/krsort_variation3.phpt @@ -14,12 +14,9 @@ echo "*** Testing krsort() : usage variations ***\n"; // diff. associative arrays to sort $various_arrays = array( - // negative/posative integer key value array + // negative/positive integer key value array array(1 => 11, -2 => -11, 3 => 21, -4 => -21, 5 => 31, -6 => -31, 7 => 0, 8 => 41, -10 =>-41), - // float key values - array(1.0 => 10.5, 0.2 => -10.5, 3.1 => 10.5e2, 4 => 10.6E-2, .5 => .5, 6 => .0001, -7 => -.1), - // mixed value array with different types of keys array(1 => .0001, 2 => .0021, -3 => -.01, 4 => -1, 5 => 0, 6 => .09, 7 => 2, -8 => -.9, 9 => 10.6E-2, -10 => -10.6E-2, 11 => 33) @@ -128,56 +125,6 @@ array(9) { -- Iteration 2 -- - With default sort flag - bool(true) -array(6) { - [6]=> - float(0.0001) - [4]=> - float(0.106) - [3]=> - float(1050) - [1]=> - float(10.5) - [0]=> - float(0.5) - [-7]=> - float(-0.1) -} -- Sort flag = SORT_REGULAR - -bool(true) -array(6) { - [6]=> - float(0.0001) - [4]=> - float(0.106) - [3]=> - float(1050) - [1]=> - float(10.5) - [0]=> - float(0.5) - [-7]=> - float(-0.1) -} -- Sort flag = SORT_NUMERIC - -bool(true) -array(6) { - [6]=> - float(0.0001) - [4]=> - float(0.106) - [3]=> - float(1050) - [1]=> - float(10.5) - [0]=> - float(0.5) - [-7]=> - float(-0.1) -} - --- Iteration 3 -- -- With default sort flag - -bool(true) array(11) { [11]=> int(33) diff --git a/ext/standard/tests/array/krsort_variation8.phpt b/ext/standard/tests/array/krsort_variation8.phpt Binary files differindex 1483e6fd1b..ff843f0b97 100644 --- a/ext/standard/tests/array/krsort_variation8.phpt +++ b/ext/standard/tests/array/krsort_variation8.phpt diff --git a/ext/standard/tests/array/ksort_variation3.phpt b/ext/standard/tests/array/ksort_variation3.phpt index db3d558be1..35954ba656 100644 --- a/ext/standard/tests/array/ksort_variation3.phpt +++ b/ext/standard/tests/array/ksort_variation3.phpt @@ -17,9 +17,6 @@ $various_arrays = array( // negative/posative integer key value array array(1 => 11, -2 => -11, 3 => 21, -4 => -21, 5 => 31, -6 => -31, 7 => 0, 8 => 41, -10 =>-41), - // float key values - array(1.0 => 10.5, 0.2 => -10.5, 3.1 => 10.5e2, 4 => 10.6E-2, .5 => .5, 6 => .0001, -7 => -.1), - // mixed value array with different types of keys array(1 => .0001, 2 => .0021, -3 => -.01, 4 => -1, 5 => 0, 6 => .09, 7 => 2, -8 => -.9, 9 => 10.6E-2, -10 => -10.6E-2, 11 => 33) @@ -128,56 +125,6 @@ array(9) { -- Iteration 2 -- - With default sort flag - bool(true) -array(6) { - [-7]=> - float(-0.1) - [0]=> - float(0.5) - [1]=> - float(10.5) - [3]=> - float(1050) - [4]=> - float(0.106) - [6]=> - float(0.0001) -} -- Sort flag = SORT_REGULAR - -bool(true) -array(6) { - [-7]=> - float(-0.1) - [0]=> - float(0.5) - [1]=> - float(10.5) - [3]=> - float(1050) - [4]=> - float(0.106) - [6]=> - float(0.0001) -} -- Sort flag = SORT_NUMERIC - -bool(true) -array(6) { - [-7]=> - float(-0.1) - [0]=> - float(0.5) - [1]=> - float(10.5) - [3]=> - float(1050) - [4]=> - float(0.106) - [6]=> - float(0.0001) -} - --- Iteration 3 -- -- With default sort flag - -bool(true) array(11) { [-10]=> float(-0.106) diff --git a/ext/standard/tests/array/ksort_variation8.phpt b/ext/standard/tests/array/ksort_variation8.phpt Binary files differindex 7b7e1c003e..fe27e6328d 100644 --- a/ext/standard/tests/array/ksort_variation8.phpt +++ b/ext/standard/tests/array/ksort_variation8.phpt diff --git a/ext/standard/tests/array/natcasesort_variation11.phpt b/ext/standard/tests/array/natcasesort_variation11.phpt index c47cda6ab3..5934b5230c 100644 --- a/ext/standard/tests/array/natcasesort_variation11.phpt +++ b/ext/standard/tests/array/natcasesort_variation11.phpt @@ -28,18 +28,6 @@ $inputs = array( -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', @@ -124,39 +112,19 @@ array(4) { -- Iteration 2 -- bool(true) -array(3) { - [0]=> - string(4) "half" - [-10]=> - string(8) "negative" - [10]=> - string(8) "positive" -} - --- Iteration 3 -- -bool(true) -array(2) { - [12345678]=> - string(5) "large" - [0]=> - string(5) "small" -} - --- Iteration 4 -- -bool(true) array(1) { [""]=> string(6) "null 1" } --- Iteration 5 -- +-- Iteration 3 -- bool(true) array(1) { [""]=> string(6) "null 2" } --- Iteration 6 -- +-- Iteration 4 -- bool(true) array(2) { [0]=> @@ -165,7 +133,7 @@ array(2) { string(6) "lowert" } --- Iteration 7 -- +-- Iteration 5 -- bool(true) array(2) { [0]=> @@ -174,21 +142,21 @@ array(2) { string(6) "uppert" } --- Iteration 8 -- +-- Iteration 6 -- bool(true) array(1) { [""]=> string(6) "emptyd" } --- Iteration 9 -- +-- Iteration 7 -- bool(true) array(1) { [""]=> string(6) "emptys" } --- Iteration 10 -- +-- Iteration 8 -- bool(true) array(3) { ["stringd"]=> @@ -199,21 +167,21 @@ array(3) { string(7) "strings" } --- Iteration 11 -- +-- Iteration 9 -- bool(true) array(1) { [""]=> string(9) "undefined" } --- Iteration 12 -- +-- Iteration 10 -- bool(true) array(1) { [""]=> string(5) "unset" } --- Iteration 13 -- +-- Iteration 11 -- bool(true) array(3) { ["foo"]=> diff --git a/ext/standard/tests/array/range_errors.phpt b/ext/standard/tests/array/range_errors.phpt index 7bc552ee97..e8bdf376e3 100644 --- a/ext/standard/tests/array/range_errors.phpt +++ b/ext/standard/tests/array/range_errors.phpt @@ -91,7 +91,7 @@ foreach( $step_arr as $step ) { } } ?> ---EXPECT-- +--EXPECTF-- *** Testing error conditions *** -- Testing ( (low < high) && (step = 0) ) -- @@ -126,6 +126,8 @@ range(): Argument #3 ($step) must not exceed the specified range -- Testing Invalid steps -- range(): Argument #3 ($step) must be of type int|float, string given + +Deprecated: range(): Passing null to parameter #3 ($step) of type int|float is deprecated in %s on line %d range(): Argument #3 ($step) must not exceed the specified range range(): Argument #3 ($step) must not exceed the specified range range(): Argument #3 ($step) must be of type int|float, string given diff --git a/ext/standard/tests/array/shuffle_variation4.phpt b/ext/standard/tests/array/shuffle_variation4.phpt index 629c449b7f..1d3269e76e 100644 --- a/ext/standard/tests/array/shuffle_variation4.phpt +++ b/ext/standard/tests/array/shuffle_variation4.phpt @@ -21,7 +21,7 @@ $array_arg = array( /*3*/ array("float1" => 0.23, 'float2' => 1.34, "exp1" => 0e2, 'exp2' => 200e-2, "exp3" => 10e0), // array with negative float values - array(-0.23 => -0.23, -1.34 => -1.34, -200e-2 => -200e-2, -30 => -30e0, -2147473649.80), + array(-0 => -0.23, -1 => -1.34, -200 => -200e-2, -30 => -30e0, -2147473649.80), // array with single and double quoted strings /*5*/ array('1' => 'one', "str1" => "123numbers", '' => 'hello\tworld', "" => "hello world\0", "12.34floatnum"), diff --git a/ext/standard/tests/file/005_variation2-win32.phpt b/ext/standard/tests/file/005_variation2-win32.phpt index 407f51a4d1..9f5b7ba679 100644 --- a/ext/standard/tests/file/005_variation2-win32.phpt +++ b/ext/standard/tests/file/005_variation2-win32.phpt @@ -28,13 +28,11 @@ function stat_fn( $filename ) { echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n"; echo "\n*** testing file info ***"; -stat_fn(NULL); stat_fn(false); stat_fn(''); stat_fn(' '); stat_fn('|'); -echo "\n*** testing touch ***"; -var_dump(touch(NULL)); +echo "\n*** testing touch ***\n"; var_dump(touch(false)); var_dump(touch('')); @@ -59,11 +57,6 @@ echo "Done"; -- File modification time is => -- inode change time is => --- File '' -- --- File access time is => --- File modification time is => --- inode change time is => - -- File ' ' -- -- File access time is => Warning: fileatime(): stat failed for in %s on line %d @@ -86,7 +79,7 @@ Warning: filemtime(): stat failed for | in %s on line %d Warning: filectime(): stat failed for | in %s on line %d -*** testing touch ***bool(false) +*** testing touch *** bool(false) bool(false) diff --git a/ext/standard/tests/file/005_variation2.phpt b/ext/standard/tests/file/005_variation2.phpt index 5a878a687b..55d1d66660 100644 --- a/ext/standard/tests/file/005_variation2.phpt +++ b/ext/standard/tests/file/005_variation2.phpt @@ -28,7 +28,6 @@ function stat_fn( $filename ) { echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n"; echo "\n*** testing touch ***\n"; -$a = touch(NULL); $b = touch(false); $c = touch(''); $d = touch(' '); @@ -41,7 +40,6 @@ var_dump($d); var_dump($e); echo "\n*** testing file info ***"; -stat_fn(NULL); stat_fn(false); stat_fn(''); stat_fn(' '); @@ -56,7 +54,9 @@ echo "Done"; *** Testing fileattime(), filemtime(), filectime() & touch() : usage variations *** *** testing touch *** -bool(false) + +Warning: Undefined variable $a in %s on line %d +NULL bool(false) bool(false) bool(true) @@ -73,11 +73,6 @@ bool(true) -- File modification time is => -- inode change time is => --- File '' -- --- File access time is => --- File modification time is => --- inode change time is => - -- File ' ' -- -- File access time is => %d -- File modification time is => %d diff --git a/ext/standard/tests/file/basename-win32.phpt b/ext/standard/tests/file/basename-win32.phpt index 4d6cf7e089..53f243a634 100644 --- a/ext/standard/tests/file/basename-win32.phpt +++ b/ext/standard/tests/file/basename-win32.phpt @@ -56,13 +56,11 @@ $file_path_variations = array ( /* paths with shortcut home dir char, with suffix variation */ array("C:\\temp\\bar"), array("C:\\temp\\bar", ""), - array("C:\\temp\\bar", NULL), array("C:\\temp\\bar", ' '), array("C:\\temp\\bar.tar", ".tar"), array("C:\\temp\\bar.tar", "~"), array("C:\\temp\\bar.tar\\", "~"), array("C:\\temp\\bar.tar\\", ""), - array("C:\\temp\\bar.tar", NULL), array("C:\\temp\\bar.tar", ''), array("C:\\temp\\bar.tar", " "), @@ -84,7 +82,6 @@ $file_path_variations = array ( array("\\bar.zip\\", "\\bar.zip\\"), array(" ", " "), array(' ', ' '), - array(NULL, NULL), /* path with spaces */ array(" "), @@ -93,7 +90,6 @@ $file_path_variations = array ( /* empty paths */ array(""), array(''), - array(NULL) ); function check_basename( $path_arrays ) { @@ -209,7 +205,7 @@ string(3) "bar" string(3) "bar" --Iteration 5-- -string(3) "bar" +string(7) "bar.tar" --Iteration 6-- string(7) "bar.tar" @@ -224,10 +220,10 @@ string(7) "bar.tar" string(7) "bar.tar" --Iteration 10-- -string(7) "bar.tar" +string(4) "10.5" --Iteration 11-- -string(7) "bar.tar" +string(2) "10" --Iteration 12-- string(4) "10.5" @@ -236,37 +232,37 @@ string(4) "10.5" string(2) "10" --Iteration 14-- -string(4) "10.5" +string(2) "10" --Iteration 15-- -string(2) "10" +string(4) "10.5" --Iteration 16-- -string(2) "10" +string(4) "10.5" --Iteration 17-- -string(4) "10.5" +string(6) "10.zip" --Iteration 18-- -string(4) "10.5" +string(1) "0" --Iteration 19-- -string(6) "10.zip" +string(1) "0" --Iteration 20-- -string(1) "0" +string(7) "bar.zip" --Iteration 21-- -string(1) "0" +string(7) "bar.zip" --Iteration 22-- string(7) "bar.zip" --Iteration 23-- -string(7) "bar.zip" +string(1) " " --Iteration 24-- -string(7) "bar.zip" +string(1) " " --Iteration 25-- string(1) " " @@ -278,17 +274,5 @@ string(1) " " string(0) "" --Iteration 28-- -string(1) " " - ---Iteration 29-- -string(1) " " - ---Iteration 30-- -string(0) "" - ---Iteration 31-- -string(0) "" - ---Iteration 32-- string(0) "" Done diff --git a/ext/standard/tests/file/basename.phpt b/ext/standard/tests/file/basename.phpt Binary files differindex 2b8507fa2d..c2dbf34f51 100644 --- a/ext/standard/tests/file/basename.phpt +++ b/ext/standard/tests/file/basename.phpt diff --git a/ext/standard/tests/file/basename_basic-win32.phpt b/ext/standard/tests/file/basename_basic-win32.phpt index 79de350eae..0678a7fd95 100644 --- a/ext/standard/tests/file/basename_basic-win32.phpt +++ b/ext/standard/tests/file/basename_basic-win32.phpt @@ -56,7 +56,6 @@ $file_paths = array ( /* empty paths */ "", '', - NULL, ); foreach ($file_paths as $file_path) { @@ -98,4 +97,3 @@ string(1) " " string(1) " " string(0) "" string(0) "" -string(0) "" diff --git a/ext/standard/tests/file/basename_basic.phpt b/ext/standard/tests/file/basename_basic.phpt index 55bd868c55..bd86695b92 100644 --- a/ext/standard/tests/file/basename_basic.phpt +++ b/ext/standard/tests/file/basename_basic.phpt @@ -56,7 +56,6 @@ $file_paths = array ( /* empty paths */ "", '', - NULL, ); foreach ($file_paths as $file_path) { @@ -98,4 +97,3 @@ string(1) " " string(1) " " string(0) "" string(0) "" -string(0) "" diff --git a/ext/standard/tests/file/bug51094.phpt b/ext/standard/tests/file/bug51094.phpt index cf2bb254c9..77d7470cb5 100644 --- a/ext/standard/tests/file/bug51094.phpt +++ b/ext/standard/tests/file/bug51094.phpt @@ -3,15 +3,15 @@ Fixed bug #51094 (parse_ini_file() with INI_SCANNER_RAW cuts a value that includ --FILE-- <?php -$ini = parse_ini_string('ini="ini;raw"', null, INI_SCANNER_RAW); +$ini = parse_ini_string('ini="ini;raw"', false, INI_SCANNER_RAW); var_dump($ini['ini']); -$ini = parse_ini_string('ini="ini;raw', null, INI_SCANNER_RAW); +$ini = parse_ini_string('ini="ini;raw', false, INI_SCANNER_RAW); var_dump($ini['ini']); -$ini = parse_ini_string('ini=ini;raw', null, INI_SCANNER_RAW); +$ini = parse_ini_string('ini=ini;raw', false, INI_SCANNER_RAW); var_dump($ini['ini']); -$ini = parse_ini_string('ini=ini"raw', null, INI_SCANNER_RAW); +$ini = parse_ini_string('ini=ini"raw', false, INI_SCANNER_RAW); var_dump($ini['ini']); -$ini = parse_ini_string("ini=\r\niniraw", null, INI_SCANNER_RAW); +$ini = parse_ini_string("ini=\r\niniraw", false, INI_SCANNER_RAW); var_dump($ini['ini']); ?> --EXPECT-- diff --git a/ext/standard/tests/file/bug61961.phpt b/ext/standard/tests/file/bug61961.phpt index c9ae4c8880..fbef22ba4c 100644 --- a/ext/standard/tests/file/bug61961.phpt +++ b/ext/standard/tests/file/bug61961.phpt @@ -5,7 +5,7 @@ Bug #61961 (file_get_content leaks when access empty file with max length) $tmp_empty_file = __FILE__ . ".tmp"; file_put_contents($tmp_empty_file, ""); -var_dump(file_get_contents($tmp_empty_file, NULL, NULL, NULL, 10)); +var_dump(file_get_contents($tmp_empty_file, false, NULL, 0, 10)); unlink($tmp_empty_file); ?> --EXPECT-- diff --git a/ext/standard/tests/file/chgrp.phpt b/ext/standard/tests/file/chgrp.phpt index b94def684a..1e4899e465 100644 --- a/ext/standard/tests/file/chgrp.phpt +++ b/ext/standard/tests/file/chgrp.phpt @@ -8,7 +8,7 @@ if(substr(PHP_OS, 0, 3) == "WIN") --FILE-- <?php try { - chgrp("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", null); + chgrp("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", 0); } catch (TypeError $exception) { echo $exception->getMessage() . "\n"; } diff --git a/ext/standard/tests/file/chown.phpt b/ext/standard/tests/file/chown.phpt index 05cd4e4d7d..5791c04c9b 100644 --- a/ext/standard/tests/file/chown.phpt +++ b/ext/standard/tests/file/chown.phpt @@ -7,7 +7,7 @@ if(substr(PHP_OS, 0, 3) == "WIN") ?> --FILE-- <?php -chown("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", NULL); +chown("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", 0); echo "ALIVE\n"; ?> --EXPECTF-- diff --git a/ext/standard/tests/file/fgetcsv_error_conditions.phpt b/ext/standard/tests/file/fgetcsv_error_conditions.phpt index dd2b4d61d9..9bb090246a 100644 --- a/ext/standard/tests/file/fgetcsv_error_conditions.phpt +++ b/ext/standard/tests/file/fgetcsv_error_conditions.phpt @@ -27,23 +27,23 @@ try { echo $e->getMessage() . \PHP_EOL; } -echo 'fgetcsv() with delimiter as NULL' . \PHP_EOL; +echo 'fgetcsv() with delimiter as empty string' . \PHP_EOL; try { - var_dump( fgetcsv($file_handle, $length, NULL, $enclosure) ); + var_dump( fgetcsv($file_handle, $length, '', $enclosure) ); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } -echo 'fgetcsv() with enclosure as NULL' . \PHP_EOL; +echo 'fgetcsv() with enclosure as empty string' . \PHP_EOL; try { - var_dump( fgetcsv($file_handle, $length, $delimiter, NULL) ); + var_dump( fgetcsv($file_handle, $length, $delimiter, '') ); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } -echo 'fgetcsv() with delimiter & enclosure as NULL' . \PHP_EOL; +echo 'fgetcsv() with delimiter & enclosure as empty string' . \PHP_EOL; try { - var_dump( fgetcsv($file_handle, $length, NULL, NULL) ); + var_dump( fgetcsv($file_handle, $length, '', '') ); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } @@ -53,9 +53,9 @@ fgetcsv() with negative length fgetcsv(): Argument #2 ($length) must be a greater than or equal to 0 fgetcsv(): Argument #2 ($length) must be a greater than or equal to 0 fgetcsv(): Argument #2 ($length) must be a greater than or equal to 0 -fgetcsv() with delimiter as NULL +fgetcsv() with delimiter as empty string fgetcsv(): Argument #3 ($separator) must be a single character -fgetcsv() with enclosure as NULL +fgetcsv() with enclosure as empty string fgetcsv(): Argument #4 ($enclosure) must be a single character -fgetcsv() with delimiter & enclosure as NULL +fgetcsv() with delimiter & enclosure as empty string fgetcsv(): Argument #3 ($separator) must be a single character diff --git a/ext/standard/tests/file/file_exists_variation1.phpt b/ext/standard/tests/file/file_exists_variation1.phpt index 55c6c94981..446e7fac16 100644 --- a/ext/standard/tests/file/file_exists_variation1.phpt +++ b/ext/standard/tests/file/file_exists_variation1.phpt @@ -6,7 +6,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com> <?php echo "*** Testing file_exists() : usage variations ***\n"; -var_dump(file_exists(NULL)); var_dump(file_exists(false)); var_dump(file_exists('')); var_dump(file_exists(' ')); @@ -19,5 +18,4 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) Done diff --git a/ext/standard/tests/file/file_get_contents_error_folder-win.phpt b/ext/standard/tests/file/file_get_contents_error_folder-win.phpt new file mode 100644 index 0000000000..ea3902fdbe --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_error_folder-win.phpt @@ -0,0 +1,12 @@ +--TEST-- +Test file_get_contents() function : error when passing folder - on Windows +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != "WIN") { print "skip - Windows only"; } +?> +--FILE-- +<?php +file_get_contents(__DIR__); +?> +--EXPECTF-- +Warning: file_get_contents(%s): Failed to open stream: Permission denied in %s on line %d diff --git a/ext/standard/tests/file/file_get_contents_error_folder.phpt b/ext/standard/tests/file/file_get_contents_error_folder.phpt new file mode 100644 index 0000000000..32f0210d3b --- /dev/null +++ b/ext/standard/tests/file/file_get_contents_error_folder.phpt @@ -0,0 +1,12 @@ +--TEST-- +Test file_get_contents() function : error when passing folder +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) === "WIN") { print "skip - not valid for Windows"; } +?> +--FILE-- +<?php +file_get_contents(__DIR__); +?> +--EXPECTF-- +Notice: file_get_contents(): Read of %d bytes failed with errno=21 Is a directory in %s on line %d 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 2c7033be6d..b6d801e9e7 100644 --- a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt @@ -20,7 +20,6 @@ $names_arr = array( "-1" => -1, "TRUE" => TRUE, "FALSE" => FALSE, - "NULL" => NULL, "\"\"" => "", "\" \"" => " ", "\\0" => "\0", @@ -58,9 +57,6 @@ bool(false) -- Filename: FALSE -- ValueError: Path cannot be empty --- Filename: NULL -- -ValueError: Path cannot be empty - -- Filename: "" -- ValueError: Path cannot be empty diff --git a/ext/standard/tests/file/file_get_contents_variation8.phpt b/ext/standard/tests/file/file_get_contents_variation8.phpt index 126f7b9fd7..ad23a13bb6 100644 --- a/ext/standard/tests/file/file_get_contents_variation8.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8.phpt @@ -19,7 +19,6 @@ $names_arr = array( -1, TRUE, FALSE, - NULL, "", " ", "\0", @@ -57,20 +56,18 @@ ValueError: Path cannot be empty -- Iteration 3 -- ValueError: Path cannot be empty -- Iteration 4 -- -ValueError: Path cannot be empty --- Iteration 5 -- Warning: file_get_contents( ): Failed to open stream: No such file or directory in %s on line %d bool(false) --- Iteration 6 -- +-- Iteration 5 -- ValueError: file_get_contents(): Argument #1 ($filename) must not contain any null bytes --- Iteration 7 -- +-- Iteration 6 -- TypeError: file_get_contents(): Argument #1 ($filename) must be of type string, array given --- Iteration 8 -- +-- Iteration 7 -- Warning: file_get_contents(/no/such/file/dir): Failed to open stream: No such file or directory in %s on line %d bool(false) --- Iteration 9 -- +-- Iteration 8 -- Warning: file_get_contents(php/php): Failed to open stream: No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/file_put_contents_variation5.phpt b/ext/standard/tests/file/file_put_contents_variation5.phpt index d16db38b14..97eb2604e0 100644 --- a/ext/standard/tests/file/file_put_contents_variation5.phpt +++ b/ext/standard/tests/file/file_put_contents_variation5.phpt @@ -19,7 +19,7 @@ runtest(); $newpath = ""; set_include_path($newpath); runtest(); -set_include_path(null); +set_include_path(""); runtest(); set_include_path(";; ; ;c:\\rubbish"); runtest(); 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 e3cd4609d4..dac2ba6d37 100644 --- a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt @@ -18,7 +18,6 @@ $names_arr = array( "-1" => -1, "TRUE" => TRUE, "FALSE" => FALSE, - "NULL" => NULL, "\"\"" => "", "\" \"" => " ", "\\0" => "\0", @@ -58,9 +57,6 @@ foreach($names_arr as $key =>$value) { -- Filename: FALSE -- ValueError: Path cannot be empty --- Filename: NULL -- -ValueError: Path cannot be empty - -- Filename: "" -- ValueError: Path cannot be empty diff --git a/ext/standard/tests/file/file_put_contents_variation8.phpt b/ext/standard/tests/file/file_put_contents_variation8.phpt index f5b956faee..70456fad9f 100644 --- a/ext/standard/tests/file/file_put_contents_variation8.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8.phpt @@ -22,7 +22,6 @@ $names_arr = array( -1, TRUE, FALSE, - NULL, "", " ", //this one also generates a java message rather than our own so we don't replicate php message @@ -64,18 +63,16 @@ ValueError: Path cannot be empty -- Iteration 3 -- ValueError: Path cannot be empty -- Iteration 4 -- -ValueError: Path cannot be empty --- Iteration 5 -- 9 bytes written to: ' ' --- Iteration 6 -- +-- Iteration 5 -- ValueError: file_put_contents(): Argument #1 ($filename) must not contain any null bytes --- Iteration 7 -- +-- Iteration 6 -- TypeError: file_put_contents(): Argument #1 ($filename) must be of type string, array given --- Iteration 8 -- +-- Iteration 7 -- Warning: file_put_contents(%sdir): Failed to open stream: %s in %s on line %d Failed to write data to: '%sir' --- Iteration 9 -- +-- Iteration 8 -- Warning: file_put_contents(%sphp): Failed to open stream: %s in %s on line %d Failed to write data to: '%sphp' diff --git a/ext/standard/tests/file/filegroup_variation2.phpt b/ext/standard/tests/file/filegroup_variation2.phpt index 85ee170660..7d0a87d247 100644 --- a/ext/standard/tests/file/filegroup_variation2.phpt +++ b/ext/standard/tests/file/filegroup_variation2.phpt @@ -18,7 +18,6 @@ $filenames = array( "", TRUE, FALSE, - NULL, /* scalars */ 1234, @@ -49,7 +48,6 @@ bool(false) Warning: filegroup(): stat failed for 1 in %s on line %d bool(false) bool(false) -bool(false) Warning: filegroup(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/fileinode_variation2.phpt b/ext/standard/tests/file/fileinode_variation2.phpt index d8593733a8..2dace6413c 100644 --- a/ext/standard/tests/file/fileinode_variation2.phpt +++ b/ext/standard/tests/file/fileinode_variation2.phpt @@ -18,7 +18,6 @@ $filenames = array( "", TRUE, FALSE, - NULL, /* scalars */ 1234, @@ -49,7 +48,6 @@ bool(false) Warning: fileinode(): stat failed for 1 in %s on line %d bool(false) bool(false) -bool(false) Warning: fileinode(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/fileowner_variation2.phpt b/ext/standard/tests/file/fileowner_variation2.phpt index 752fa1d6ef..05cc8495b1 100644 --- a/ext/standard/tests/file/fileowner_variation2.phpt +++ b/ext/standard/tests/file/fileowner_variation2.phpt @@ -19,7 +19,6 @@ $filenames = array( "", TRUE, FALSE, - NULL, /* scalars */ 1234, @@ -50,7 +49,6 @@ bool(false) Warning: fileowner(): stat failed for 1 in %s on line %d bool(false) bool(false) -bool(false) Warning: fileowner(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/fileperms_variation2.phpt b/ext/standard/tests/file/fileperms_variation2.phpt index 9c9d263ebe..c46ce617ae 100644 --- a/ext/standard/tests/file/fileperms_variation2.phpt +++ b/ext/standard/tests/file/fileperms_variation2.phpt @@ -18,7 +18,6 @@ $filenames = array( "", TRUE, FALSE, - NULL, /* scalars */ 1234, @@ -49,7 +48,6 @@ bool(false) Warning: fileperms(): stat failed for 1 in %s on line %d bool(false) bool(false) -bool(false) Warning: fileperms(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/filesize_variation5.phpt b/ext/standard/tests/file/filesize_variation5.phpt index ab1fc6c9ff..7da6e73e06 100644 --- a/ext/standard/tests/file/filesize_variation5.phpt +++ b/ext/standard/tests/file/filesize_variation5.phpt @@ -7,7 +7,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com> echo "*** Testing filesize(): usage variations ***\n"; /* null, false, "", " " */ -var_dump( filesize(NULL) ); var_dump( filesize(false) ); var_dump( filesize('') ); var_dump( filesize(' ') ); @@ -18,7 +17,6 @@ echo "*** Done ***\n"; *** Testing filesize(): usage variations *** bool(false) bool(false) -bool(false) Warning: filesize(): stat failed for in %s on line %d bool(false) diff --git a/ext/standard/tests/file/flock_basic.phpt b/ext/standard/tests/file/flock_basic.phpt index df1199d468..8b4ae30e0f 100644 --- a/ext/standard/tests/file/flock_basic.phpt +++ b/ext/standard/tests/file/flock_basic.phpt @@ -9,7 +9,7 @@ Description: PHP supports a portable way of locking complete files echo "*** Testing flock() fun with file and dir ***\n"; -$lock_file = preg_replace("~\.phpt?$~", null, __FILE__); +$lock_file = preg_replace("~\.phpt?$~", '', __FILE__); $file_handle = fopen($lock_file, "w"); var_dump(flock($file_handle, LOCK_SH|LOCK_NB)); @@ -19,7 +19,7 @@ var_dump(flock($file_handle, LOCK_UN)); fclose($file_handle); unlink($lock_file); -$lock_dir = sprintf("%s.dir", preg_replace("~\.phpt?$~", null, __FILE__)); +$lock_dir = sprintf("%s.dir", preg_replace("~\.phpt?$~", '', __FILE__)); mkdir($lock_dir); $dir_handle = opendir($lock_dir); diff --git a/ext/standard/tests/file/flock_error.phpt b/ext/standard/tests/file/flock_error.phpt index add2295981..753aaa6fb3 100644 --- a/ext/standard/tests/file/flock_error.phpt +++ b/ext/standard/tests/file/flock_error.phpt @@ -19,7 +19,6 @@ $operations = array( 0, LOCK_NB, FALSE, - NULL, array(1,2,3), array(), "string", @@ -62,15 +61,13 @@ flock(): Argument #2 ($operation) must be one of LOCK_SH, LOCK_EX, or LOCK_UN --- Iteration 2 --- flock(): Argument #2 ($operation) must be one of LOCK_SH, LOCK_EX, or LOCK_UN --- Iteration 3 --- -flock(): Argument #2 ($operation) must be one of LOCK_SH, LOCK_EX, or LOCK_UN +flock(): Argument #2 ($operation) must be of type int, array given --- Iteration 4 --- flock(): Argument #2 ($operation) must be of type int, array given --- Iteration 5 --- -flock(): Argument #2 ($operation) must be of type int, array given +flock(): Argument #2 ($operation) must be of type int, string given --- Iteration 6 --- flock(): Argument #2 ($operation) must be of type int, string given --- Iteration 7 --- flock(): Argument #2 ($operation) must be of type int, string given ---- Iteration 8 --- -flock(): Argument #2 ($operation) must be of type int, string given flock(): supplied resource is not a valid stream resource diff --git a/ext/standard/tests/file/flock_variation.phpt b/ext/standard/tests/file/flock_variation.phpt index 40945be58e..f4a5199959 100644 --- a/ext/standard/tests/file/flock_variation.phpt +++ b/ext/standard/tests/file/flock_variation.phpt @@ -5,7 +5,7 @@ Test flock() function: Variations echo "*** Testing flock() fun with the various operation and wouldblock values ***\n"; -$file = preg_replace("~\.phpt?$~", null, __FILE__); +$file = preg_replace("~\.phpt?$~", '', __FILE__); $fp = fopen($file, "w"); /* array of operations */ diff --git a/ext/standard/tests/file/fnmatch_basic.phpt b/ext/standard/tests/file/fnmatch_basic.phpt index 18a8161966..8b74bb430b 100644 --- a/ext/standard/tests/file/fnmatch_basic.phpt +++ b/ext/standard/tests/file/fnmatch_basic.phpt @@ -23,7 +23,6 @@ var_dump( fnmatch(100, 100) ); var_dump( fnmatch("string", "string") ); var_dump( fnmatch(TRUE, TRUE) ); var_dump( fnmatch(FALSE, FALSE) ); -var_dump( fnmatch(NULL, NULL) ); echo "\n*** Done ***\n"; ?> @@ -40,6 +39,5 @@ bool(true) bool(true) bool(true) bool(true) -bool(true) *** Done *** diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt index 2d6a08e72f..3413c3e6f7 100644 --- a/ext/standard/tests/file/fnmatch_variation.phpt +++ b/ext/standard/tests/file/fnmatch_variation.phpt @@ -127,8 +127,6 @@ match_($bool_arr, $bool_arr); echo "\n--- With NULL ---\n"; $null_arr = array( - NULL, - null, "", "\0", "string", @@ -399,42 +397,20 @@ bool(true) --- With NULL --- -- Iteration 0 -- bool(true) -bool(true) -bool(true) fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(false) -- Iteration 1 -- -bool(true) -bool(true) -bool(true) -fnmatch(): Argument #2 ($filename) must not contain any null bytes -bool(false) -bool(false) --- Iteration 2 -- -bool(true) -bool(true) -bool(true) -fnmatch(): Argument #2 ($filename) must not contain any null bytes -bool(false) -bool(false) --- Iteration 3 -- -fnmatch(): Argument #1 ($pattern) must not contain any null bytes fnmatch(): Argument #1 ($pattern) must not contain any null bytes fnmatch(): Argument #1 ($pattern) must not contain any null bytes fnmatch(): Argument #1 ($pattern) must not contain any null bytes fnmatch(): Argument #1 ($pattern) must not contain any null bytes -fnmatch(): Argument #1 ($pattern) must not contain any null bytes --- Iteration 4 -- -bool(false) -bool(false) +-- Iteration 2 -- bool(false) fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(true) bool(false) --- Iteration 5 -- -bool(false) -bool(false) +-- Iteration 3 -- bool(false) fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) diff --git a/ext/standard/tests/file/fputcsv_variation2.phpt b/ext/standard/tests/file/fputcsv_variation2.phpt deleted file mode 100644 index 77b075a5f0..0000000000 --- a/ext/standard/tests/file/fputcsv_variation2.phpt +++ /dev/null @@ -1,724 +0,0 @@ ---TEST-- -Test fputcsv() : usage variations - with delimiter as NULL ---FILE-- -<?php -/* Testing fputcsv() to write to a file when delimiter is NULL */ - -echo "*** Testing fputcsv() : with delimiter as NULL ***\n"; - -/* the array is with three elements in it. Each element should be read as - 1st element is delimiter, 2nd element is enclosure - and 3rd element is csv fields -*/ -$csv_lists = array ( - array(',', '"', array('water','fruit') ), - array(',', '"', array('"water","fruit') ), - array(',', '"', array('"water","fruit"') ), - array(' ', '^', array('^water^ ^fruit^')), - array(':', '&', array('&water&:&fruit&')), - array('=', '=', array('=water===fruit=')), - array('-', '-', array('-water--fruit-air')), - array('-', '-', array('-water---fruit---air-')), - array(':', '&', array('&""""&:&"&:,:":&,&:,,,,')) - -); -$file_path = __DIR__; -$filename = "$file_path/fputcsv_variation2.tmp"; - -$file_modes = array ("r+", "r+b", "r+t", - "a+", "a+b", "a+t", - "w+", "w+b", "w+t", - "x+", "x+b", "x+t"); - -$loop_counter = 1; -foreach ($csv_lists as $csv_list) { - for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - - echo "\n-- file opened in $file_modes[$mode_counter] --\n"; - // create the file and add the content with has csv fields - if ( strstr($file_modes[$mode_counter], "r") ) { - $file_handle = fopen($filename, "w"); - } else { - $file_handle = fopen($filename, $file_modes[$mode_counter] ); - } - if ( !$file_handle ) { - echo "Error: failed to create file $filename!\n"; - exit(); - } - $delimiter = $csv_list[0]; - $enclosure = $csv_list[1]; - $csv_field = $csv_list[2]; - - // write to a file in csv format - try { - var_dump( fputcsv($file_handle, $csv_field, NULL, $enclosure) ); - } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; - } - // check the file pointer position and eof - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - //close the file - fclose($file_handle); - - // print the file contents - var_dump( file_get_contents($filename) ); - - //delete file - unlink($filename); - } //end of mode loop -} // end of foreach - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fputcsv() : with delimiter as NULL *** - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" -Done diff --git a/ext/standard/tests/file/fputcsv_variation3.phpt b/ext/standard/tests/file/fputcsv_variation3.phpt deleted file mode 100644 index eb8771aa4a..0000000000 --- a/ext/standard/tests/file/fputcsv_variation3.phpt +++ /dev/null @@ -1,724 +0,0 @@ ---TEST-- -Test fputcsv() : usage variations - with enclosure as NULL ---FILE-- -<?php -/* Testing fputcsv() to write to a file when enclosure is NULL */ - -echo "*** Testing fputcsv() : with enclosure as NULL ***\n"; - -/* the array is with three elements in it. Each element should be read as - 1st element is delimiter, 2nd element is enclosure - and 3rd element is csv fields -*/ -$csv_lists = array ( - array(',', '"', array('water','fruit') ), - array(',', '"', array('"water","fruit') ), - array(',', '"', array('"water","fruit"') ), - array(' ', '^', array('^water^ ^fruit^')), - array(':', '&', array('&water&:&fruit&')), - array('=', '=', array('=water===fruit=')), - array('-', '-', array('-water--fruit-air')), - array('-', '-', array('-water---fruit---air-')), - array(':', '&', array('&""""&:&"&:,:":&,&:,,,,')) - -); -$file_path = __DIR__; -$filename = "$file_path/fputcsv_variation3.tmp"; - -$file_modes = array ("r+", "r+b", "r+t", - "a+", "a+b", "a+t", - "w+", "w+b", "w+t", - "x+", "x+b", "x+t"); - -$loop_counter = 1; -foreach ($csv_lists as $csv_list) { - for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - - echo "\n-- file opened in $file_modes[$mode_counter] --\n"; - // create the file and add the content with has csv fields - if ( strstr($file_modes[$mode_counter], "r") ) { - $file_handle = fopen($filename, "w"); - } else { - $file_handle = fopen($filename, $file_modes[$mode_counter] ); - } - if ( !$file_handle ) { - echo "Error: failed to create file $filename!\n"; - exit(); - } - $delimiter = $csv_list[0]; - $enclosure = $csv_list[1]; - $csv_field = $csv_list[2]; - - // write to a file in csv format - try { - var_dump( fputcsv($file_handle, $csv_field, $delimiter, NULL) ); - } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; - } - // check the file pointer position and eof - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - //close the file - fclose($file_handle); - - // print the file contents - var_dump( file_get_contents($filename) ); - - //delete file - unlink($filename); - } //end of mode loop -} // end of foreach - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fputcsv() : with enclosure as NULL *** - --- file opened in r+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #4 ($enclosure) must be a single character -int(0) -bool(false) -string(0) "" -Done diff --git a/ext/standard/tests/file/fputcsv_variation4.phpt b/ext/standard/tests/file/fputcsv_variation4.phpt deleted file mode 100644 index dc78796158..0000000000 --- a/ext/standard/tests/file/fputcsv_variation4.phpt +++ /dev/null @@ -1,724 +0,0 @@ ---TEST-- -Test fputcsv() : usage variations - with delimiter and enclosure as NULL ---FILE-- -<?php -/* Testing fputcsv() to write to a file when delimiter and enclosure is NULL */ - -echo "*** Testing fputcsv() : with delimiter and enclosure as NULL ***\n"; - -/* the array is with three elements in it. Each element should be read as - 1st element is delimiter, 2nd element is enclosure - and 3rd element is csv fields -*/ -$csv_lists = array ( - array(',', '"', array('water','fruit') ), - array(',', '"', array('"water","fruit') ), - array(',', '"', array('"water","fruit"') ), - array(' ', '^', array('^water^ ^fruit^')), - array(':', '&', array('&water&:&fruit&')), - array('=', '=', array('=water===fruit=')), - array('-', '-', array('-water--fruit-air')), - array('-', '-', array('-water---fruit---air-')), - array(':', '&', array('&""""&:&"&:,:":&,&:,,,,')) - -); -$file_path = __DIR__; -$filename = "$file_path/fputcsv_variation4.tmp"; - -$file_modes = array ("r+", "r+b", "r+t", - "a+", "a+b", "a+t", - "w+", "w+b", "w+t", - "x+", "x+b", "x+t"); - -$loop_counter = 1; -foreach ($csv_lists as $csv_list) { - for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - - echo "\n-- file opened in $file_modes[$mode_counter] --\n"; - // create the file and add the content with has csv fields - if ( strstr($file_modes[$mode_counter], "r") ) { - $file_handle = fopen($filename, "w"); - } else { - $file_handle = fopen($filename, $file_modes[$mode_counter] ); - } - if ( !$file_handle ) { - echo "Error: failed to create file $filename!\n"; - exit(); - } - $delimiter = $csv_list[0]; - $enclosure = $csv_list[1]; - $csv_field = $csv_list[2]; - - // write to a file in csv format - try { - var_dump( fputcsv($file_handle, $csv_field, NULL, NULL) ); - } catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; - } - // check the file pointer position and eof - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - //close the file - fclose($file_handle); - - // print the file contents - var_dump( file_get_contents($filename) ); - - //delete file - unlink($filename); - } //end of mode loop -} // end of foreach - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fputcsv() : with delimiter and enclosure as NULL *** - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in r+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in a+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in w+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+ -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+b -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" - --- file opened in x+t -- -fputcsv(): Argument #3 ($separator) must be a single character -int(0) -bool(false) -string(0) "" -Done diff --git a/ext/standard/tests/file/fscanf_error.phpt b/ext/standard/tests/file/fscanf_error.phpt index c50af50b6d..da586555be 100644 --- a/ext/standard/tests/file/fscanf_error.phpt +++ b/ext/standard/tests/file/fscanf_error.phpt @@ -31,9 +31,7 @@ try { fclose($file_handle); // different invalid format strings -$invalid_formats = array( $undefined_var, - "%", "%h", "%.", "%d%m" - ); +$invalid_formats = array("", "%", "%h", "%.", "%d%m"); // looping to use various invalid formats with fscanf() @@ -57,12 +55,10 @@ $file_path = __DIR__; $filename = "$file_path/fscanf_error.tmp"; unlink($filename); ?> ---EXPECTF-- +--EXPECT-- *** Testing fscanf() for error conditions *** fscanf(): supplied resource is not a valid File-Handle resource Different numbers of variable names and field specifiers - -Warning: Undefined variable $undefined_var in %s on line %d array(0) { } Bad scan conversion character " diff --git a/ext/standard/tests/file/glob_variation3.phpt b/ext/standard/tests/file/glob_variation3.phpt index 4bf008a9a7..891bbb6fa1 100644 --- a/ext/standard/tests/file/glob_variation3.phpt +++ b/ext/standard/tests/file/glob_variation3.phpt @@ -4,7 +4,7 @@ Test glob() function: ensure no platform difference <?php $path = __DIR__; -ini_set('open_basedir', NULL); +ini_set('open_basedir', ''); var_dump(glob("$path/*.none")); var_dump(glob("$path/?.none")); diff --git a/ext/standard/tests/file/is_dir_variation3.phpt b/ext/standard/tests/file/is_dir_variation3.phpt index ef875c34f8..730a2bcfea 100644 --- a/ext/standard/tests/file/is_dir_variation3.phpt +++ b/ext/standard/tests/file/is_dir_variation3.phpt @@ -12,7 +12,6 @@ $dirnames = array( -2.34555, TRUE, FALSE, - NULL, " ", /* scalars */ @@ -33,4 +32,3 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) diff --git a/ext/standard/tests/file/is_executable_variation3.phpt b/ext/standard/tests/file/is_executable_variation3.phpt index 42e37f5731..b9b3a98e5c 100644 --- a/ext/standard/tests/file/is_executable_variation3.phpt +++ b/ext/standard/tests/file/is_executable_variation3.phpt @@ -23,9 +23,7 @@ $invalid_files = array( -2.34555, TRUE, FALSE, - NULL, " ", - @$file_handle ); /* loop through to test each element in the above array is an executable file */ @@ -46,6 +44,4 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) -bool(false) Done diff --git a/ext/standard/tests/file/is_readable_variation3.phpt b/ext/standard/tests/file/is_readable_variation3.phpt index 320e6d49b9..e4a5766762 100644 --- a/ext/standard/tests/file/is_readable_variation3.phpt +++ b/ext/standard/tests/file/is_readable_variation3.phpt @@ -10,9 +10,6 @@ require __DIR__ . '/../skipif_root.inc'; echo "*** Testing is_readable(): usage variations ***\n"; -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); - echo "\n*** Testing is_readable() on miscellaneous filenames ***\n"; $misc_files = array( 0, @@ -20,9 +17,7 @@ $misc_files = array( -2.34555, TRUE, FALSE, - NULL, " ", - @$file_handle ); /* loop through to test each element in the above array is a readable file */ @@ -43,6 +38,4 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) -bool(false) Done diff --git a/ext/standard/tests/file/is_writable_variation3.phpt b/ext/standard/tests/file/is_writable_variation3.phpt index 286b64c4d3..021d6e5645 100644 --- a/ext/standard/tests/file/is_writable_variation3.phpt +++ b/ext/standard/tests/file/is_writable_variation3.phpt @@ -19,9 +19,7 @@ $misc_files = array( -2.34555, TRUE, FALSE, - NULL, " ", - @$file_handle ); /* loop through to test each element in the above array is a writable file */ @@ -47,7 +45,3 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) -bool(false) -bool(false) -bool(false) diff --git a/ext/standard/tests/file/lstat_stat_variation22.phpt b/ext/standard/tests/file/lstat_stat_variation22.phpt index b89c5c5298..9efb23fc41 100644 --- a/ext/standard/tests/file/lstat_stat_variation22.phpt +++ b/ext/standard/tests/file/lstat_stat_variation22.phpt @@ -13,14 +13,12 @@ obscure_filename --FILE-- <?php echo "*** testing stat ***\n"; -var_dump(stat(NULL)); var_dump(stat(false)); var_dump(stat('')); var_dump(stat(' ')); var_dump(stat('|')); echo "*** testing lstat ***\n"; -var_dump(lstat(NULL)); var_dump(lstat(false)); var_dump(lstat('')); var_dump(lstat(' ')); @@ -30,7 +28,6 @@ var_dump(lstat('|')); *** testing stat *** bool(false) bool(false) -bool(false) Warning: stat(): stat failed for in %s on line %d bool(false) @@ -40,7 +37,6 @@ bool(false) *** testing lstat *** bool(false) bool(false) -bool(false) Warning: lstat(): Lstat failed for in %s on line %d bool(false) diff --git a/ext/standard/tests/file/pathinfo_variaton.phpt b/ext/standard/tests/file/pathinfo_variaton.phpt index 4447d07d6c..04e1f15c69 100644 --- a/ext/standard/tests/file/pathinfo_variaton.phpt +++ b/ext/standard/tests/file/pathinfo_variaton.phpt @@ -4,9 +4,6 @@ Test pathinfo() function: usage variations <?php echo "*** Testing pathinfo() with miscellaneous input arguments ***\n"; -$fp = fopen(__FILE__, "r"); -unset($fp); - class object_temp { public $url_var = "www.foo.com"; var $html_var = "/var/html/testdir/example.html"; @@ -47,13 +44,6 @@ $paths = array ( "", '', - /* pathname as NULL */ - NULL, - null, - - /* filename as resource */ - $fp, - /* pathname as members of object */ $obj->url_var, $obj->html_var, @@ -83,10 +73,8 @@ foreach($paths as $path) { echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing pathinfo() with miscellaneous input arguments *** - -Warning: Undefined variable $fp in %s on line %d -- Iteration 1 -- array(3) { ["dirname"]=> @@ -240,39 +228,6 @@ string(0) "" string(0) "" string(0) "" -- Iteration 13 -- -array(2) { - ["basename"]=> - string(0) "" - ["filename"]=> - string(0) "" -} -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 14 -- -array(2) { - ["basename"]=> - string(0) "" - ["filename"]=> - string(0) "" -} -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 15 -- -array(2) { - ["basename"]=> - string(0) "" - ["filename"]=> - string(0) "" -} -string(0) "" -string(0) "" -string(0) "" -string(0) "" --- Iteration 16 -- array(4) { ["dirname"]=> string(1) "." @@ -287,7 +242,7 @@ string(1) "." string(11) "www.foo.com" string(3) "com" string(7) "www.foo" --- Iteration 17 -- +-- Iteration 14 -- array(4) { ["dirname"]=> string(17) "/var/html/testdir" @@ -302,7 +257,7 @@ string(17) "/var/html/testdir" string(12) "example.html" string(4) "html" string(7) "example" --- Iteration 18 -- +-- Iteration 15 -- array(3) { ["dirname"]=> string(12) "/testdir/foo" @@ -315,7 +270,7 @@ string(12) "/testdir/foo" string(4) "test" string(0) "" string(4) "test" --- Iteration 19 -- +-- Iteration 16 -- array(4) { ["dirname"]=> string(4) "/foo" @@ -330,7 +285,7 @@ string(4) "/foo" string(12) "symlink.link" string(4) "link" string(7) "symlink" --- Iteration 20 -- +-- Iteration 17 -- array(3) { ["dirname"]=> string(1) "." @@ -343,7 +298,7 @@ string(1) "." string(5) "12345" string(0) "" string(5) "12345" --- Iteration 21 -- +-- Iteration 18 -- array(4) { ["dirname"]=> string(1) "." @@ -358,7 +313,7 @@ string(1) "." string(15) "www.example.com" string(3) "com" string(11) "www.example" --- Iteration 22 -- +-- Iteration 19 -- array(3) { ["dirname"]=> string(12) "/testdir/foo" @@ -371,7 +326,7 @@ string(12) "/testdir/foo" string(4) "test" string(0) "" string(4) "test" --- Iteration 23 -- +-- Iteration 20 -- array(4) { ["dirname"]=> string(6) "../foo" @@ -386,7 +341,7 @@ string(6) "../foo" string(9) "test.link" string(4) "link" string(4) "test" --- Iteration 24 -- +-- Iteration 21 -- array(4) { ["dirname"]=> string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/test5/test6" @@ -401,7 +356,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 25 -- +-- Iteration 22 -- array(4) { ["dirname"]=> string(1) "." diff --git a/ext/standard/tests/file/php_fd_wrapper_04.phpt b/ext/standard/tests/file/php_fd_wrapper_04.phpt index 458f6cd9bd..e1f9927ee9 100644 --- a/ext/standard/tests/file/php_fd_wrapper_04.phpt +++ b/ext/standard/tests/file/php_fd_wrapper_04.phpt @@ -1,5 +1,10 @@ --TEST-- php://fd wrapper: invalid file descriptor +--SKIPIF-- +<?php +// At least on Mac 10.14 Mojave; not sure about older versions +if (strtolower(PHP_OS) == 'darwin') die('skip: the warning output is different on MacOS'); +?> --FILE-- <?php fopen("php://fd/1023", "w"); diff --git a/ext/standard/tests/file/readfile_error.phpt b/ext/standard/tests/file/readfile_error.phpt index bec5b383d7..9e47e68fac 100644 --- a/ext/standard/tests/file/readfile_error.phpt +++ b/ext/standard/tests/file/readfile_error.phpt @@ -9,11 +9,6 @@ echo "*** Test readfile(): error conditions ***\n"; echo "\n-- Testing readfile() with invalid arguments --\n"; // invalid arguments try { - var_dump( readfile(NULL) ); // NULL as $filename -} catch (\ValueError $e) { - echo $e->getMessage() . \PHP_EOL; -} -try { var_dump( readfile('') ); // empty string as $filename } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; @@ -36,7 +31,6 @@ echo "Done\n"; -- Testing readfile() with invalid arguments -- Path cannot be empty Path cannot be empty -Path cannot be empty -- Testing readfile() with non-existent file -- diff --git a/ext/standard/tests/file/readfile_variation10-win32.phpt b/ext/standard/tests/file/readfile_variation10-win32.phpt index add9afd58d..325e47224d 100644 --- a/ext/standard/tests/file/readfile_variation10-win32.phpt +++ b/ext/standard/tests/file/readfile_variation10-win32.phpt @@ -19,7 +19,6 @@ $names_arr = array( "-1" => -1, "TRUE" => TRUE, "FALSE" => FALSE, - "NULL" => NULL, "\"\"" => "", "\" \"" => " ", "\\0" => "\0", @@ -54,9 +53,6 @@ Warning: readfile(1): Failed to open stream: No such file or directory in %s on -- Filename: FALSE -- ValueError: Path cannot be empty --- Filename: NULL -- -ValueError: Path cannot be empty - -- Filename: "" -- ValueError: Path cannot be empty diff --git a/ext/standard/tests/file/readfile_variation10.phpt b/ext/standard/tests/file/readfile_variation10.phpt Binary files differindex 99cb0b2d6b..a2fc2d79cb 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_variation3.phpt b/ext/standard/tests/file/readlink_realpath_variation3.phpt index f256ffea42..44a53f0dfb 100644 --- a/ext/standard/tests/file/readlink_realpath_variation3.phpt +++ b/ext/standard/tests/file/readlink_realpath_variation3.phpt @@ -13,8 +13,6 @@ $link_string = array ( /* empty linkname */ "", '', - NULL, - null ); for($loop_counter = 0; $loop_counter < count($link_string); $loop_counter++) { echo "-- Iteration"; @@ -51,14 +49,4 @@ string(%d) "%s" Warning: readlink(): %s in %s on line %d bool(false) string(%d) "%s" --- Iteration5 -- - -Warning: readlink(): %s in %s on line %d -bool(false) -string(%d) "%s" --- Iteration6 -- - -Warning: readlink(): %s in %s on line %d -bool(false) -string(%d) "%s" Done diff --git a/ext/standard/tests/file/readlink_variation1.phpt b/ext/standard/tests/file/readlink_variation1.phpt index b129de364f..6697286de2 100644 --- a/ext/standard/tests/file/readlink_variation1.phpt +++ b/ext/standard/tests/file/readlink_variation1.phpt @@ -17,7 +17,6 @@ $filenames = array( "", TRUE, FALSE, - NULL, /* scalars */ 1234, @@ -55,6 +54,3 @@ bool(false) Warning: readlink(): %s in %s on line %d bool(false) - -Warning: readlink(): %s in %s on line %d -bool(false) diff --git a/ext/standard/tests/file/realpath_bug77484.phpt b/ext/standard/tests/file/realpath_bug77484.phpt index 85595d09e3..9aa3a335c2 100644 --- a/ext/standard/tests/file/realpath_bug77484.phpt +++ b/ext/standard/tests/file/realpath_bug77484.phpt @@ -9,6 +9,10 @@ if (PHP_ZTS) { /* TODO eliminate difference in TS build. */ die("skip Not for ZTS"); } +if (getenv('SKIP_REPEAT')) { + /* The cwd is persistent across repeats */ + die("skip Not repeatable"); +} ?> --FILE-- <?php diff --git a/ext/standard/tests/file/realpath_variation-win32-mb.phpt b/ext/standard/tests/file/realpath_variation-win32-mb.phpt index a3539f6106..ea2f1c6fec 100644 --- a/ext/standard/tests/file/realpath_variation-win32-mb.phpt +++ b/ext/standard/tests/file/realpath_variation-win32-mb.phpt @@ -51,8 +51,6 @@ $file_string = array ( /* empty filename */ "", '', - NULL, - null ); for($loop_counter = 0; $loop_counter < count($file_string); $loop_counter++) { echo "-- Iteration"; @@ -91,8 +89,4 @@ bool(false) string(%d) "%s" -- Iteration4 -- string(%d) "%s" --- Iteration5 -- -string(%d) "%s" --- Iteration6 -- -string(%d) "%s" Done diff --git a/ext/standard/tests/file/realpath_variation-win32.phpt b/ext/standard/tests/file/realpath_variation-win32.phpt index 9f46c62e7c..1ea8ced7d0 100644 --- a/ext/standard/tests/file/realpath_variation-win32.phpt +++ b/ext/standard/tests/file/realpath_variation-win32.phpt @@ -51,8 +51,6 @@ $file_string = array ( /* empty filename */ "", '', - NULL, - null ); for($loop_counter = 0; $loop_counter < count($file_string); $loop_counter++) { echo "-- Iteration"; @@ -91,8 +89,4 @@ bool(false) string(%d) "%s" -- Iteration4 -- string(%d) "%s" --- Iteration5 -- -string(%d) "%s" --- Iteration6 -- -string(%d) "%s" Done diff --git a/ext/standard/tests/file/rename_variation13-win32.phpt b/ext/standard/tests/file/rename_variation13-win32.phpt index 65dbdfb8d6..a2cf9a528d 100644 --- a/ext/standard/tests/file/rename_variation13-win32.phpt +++ b/ext/standard/tests/file/rename_variation13-win32.phpt @@ -17,7 +17,6 @@ $names_arr = array( -1, /* -1 is just a valid filename on windows */ TRUE, /* 1 as well, (string)TRUE > "1" */ FALSE, - NULL, "", // I think both p8 and php are wrong on the messages here //p8 generates different messages to php, php is probably wrong //php has either "File Exists" or "Permission Denied". @@ -80,35 +79,28 @@ bool(false) Warning: rename(,%safile.tmp): %r(Invalid argument|(The parameter is incorrect|The system cannot find the path specified) \(code: \d+\))%r in %srename_variation13-win32.php on line %d bool(false) --- 3 testing '' NULL -- +-- 3 testing '' string -- Warning: rename(%safile.tmp,): %r(Invalid argument|(The parameter is incorrect|The system cannot find the path specified) \(code: \d+\))%r in %srename_variation13-win32.php on line %d bool(false) Warning: rename(,%safile.tmp): %r(Invalid argument|(The parameter is incorrect|The system cannot find the path specified) \(code: \d+\))%r in %srename_variation13-win32.php on line %d bool(false) --- 4 testing '' string -- - -Warning: rename(%safile.tmp,): %r(Invalid argument|(The parameter is incorrect|The system cannot find the path specified) \(code: \d+\))%r in %srename_variation13-win32.php on line %d -bool(false) - -Warning: rename(,%safile.tmp): %r(Invalid argument|(The parameter is incorrect|The system cannot find the path specified) \(code: \d+\))%r in %srename_variation13-win32.php on line %d -bool(false) --- 5 testing ' ' string -- +-- 4 testing ' ' string -- Warning: rename(%s): The filename, directory name, or volume label syntax is incorrect (code: 123) in %srename_variation13-win32.php on line %d bool(false) Warning: rename(%s): The filename, directory name, or volume label syntax is incorrect (code: 123) in %srename_variation13-win32.php on line %d bool(false) --- 6 testing '/no/such/file/dir' string -- +-- 5 testing '/no/such/file/dir' string -- Warning: rename(%safile.tmp,/no/such/file/dir): The system cannot find the path specified (code: 3) in %srename_variation13-win32.php on line %d bool(false) Warning: rename(/no/such/file/dir,%safile.tmp): The system cannot find the path specified (code: 3) in %srename_variation13-win32.php on line %d bool(false) --- 7 testing 'php/php' string -- +-- 6 testing 'php/php' string -- Warning: rename(%safile.tmp,php/php): The system cannot find the path specified (code: 3) in %srename_variation13-win32.php on line %d bool(false) diff --git a/ext/standard/tests/file/rename_variation13.phpt b/ext/standard/tests/file/rename_variation13.phpt index 83de25cd84..1fa95f3726 100644 --- a/ext/standard/tests/file/rename_variation13.phpt +++ b/ext/standard/tests/file/rename_variation13.phpt @@ -23,7 +23,6 @@ $names_arr = array( -1, TRUE, FALSE, - NULL, "", " ", @@ -78,13 +77,6 @@ bool(false) Warning: rename(,%s/renameVar13/afile.tmp): %s in %s on line %d bool(false) --- testing '' -- - -Warning: rename(%s/renameVar13/afile.tmp,): %s in %s on line %d -bool(false) - -Warning: rename(,%s/renameVar13/afile.tmp): %s in %s on line %d -bool(false) -- testing ' ' -- bool(true) 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 72737d1a8e..f4035f8f40 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 @@ -19,17 +19,14 @@ $linkname = __DIR__."/symlink_link_linkinfo_is_link_link_error1.tmp"; echo "*** Testing symlink() for error conditions ***\n"; //invalid arguments -var_dump( symlink(NULL, $linkname) ); // NULL as filename var_dump( symlink('', $linkname) ); // empty string as filename var_dump( symlink(false, $linkname) ); // boolean false as filename -var_dump( symlink($filename, NULL) ); // NULL as linkname var_dump( symlink($filename, '') ); // '' as linkname var_dump( symlink($filename, false) ); // false as linkname echo "\n*** Testing linkinfo() for error conditions ***\n"; //invalid arguments -var_dump( linkinfo(NULL) ); // NULL as linkname var_dump( linkinfo('') ); // empty string as linkname var_dump( linkinfo(false) ); // boolean false as linkname @@ -55,12 +52,6 @@ bool(false) Warning: symlink(): %s in %s on line %d bool(false) -Warning: symlink(): %s in %s on line %d -bool(false) - -Warning: symlink(): %s in %s on line %d -bool(false) - *** Testing linkinfo() for error conditions *** Warning: linkinfo(): %s in %s on line %d @@ -68,7 +59,4 @@ int(-1) Warning: linkinfo(): %s in %s on line %d int(-1) - -Warning: linkinfo(): %s in %s on line %d -int(-1) Done 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 c5b21c0d21..fcc64d4098 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 @@ -19,18 +19,15 @@ $linkname = __DIR__."/symlink_link_linkinfo_is_link_link_error2.tmp"; echo "*** Testing link() for error conditions ***\n"; //invalid arguments -var_dump( link(NULL, $linkname) ); // NULL as filename var_dump( link('', $linkname) ); // empty string as filename var_dump( link(' ', $linkname) ); // space as filename var_dump( link(false, $linkname) ); // boolean false as filename -var_dump( link($filename, NULL) ); // NULL as linkname var_dump( link($filename, '') ); // '' as linkname var_dump( link($filename, false) ); // false as linkname echo "\n*** Testing is_link() for error conditions ***\n"; //invalid arguments -var_dump( is_link(NULL) ); // NULL as linkname var_dump( is_link('') ); // empty string as linkname var_dump( is_link(' ') ); // space as linkname var_dump( is_link(false) ); // boolean false as linkname @@ -60,16 +57,9 @@ bool(false) Warning: link(): No such file or directory in %s on line %d bool(false) -Warning: link(): No such file or directory in %s on line %d -bool(false) - -Warning: link(): No such file or directory in %s on line %d -bool(false) - *** Testing is_link() for error conditions *** bool(false) bool(false) bool(false) bool(false) -bool(false) Done diff --git a/ext/standard/tests/file/tempnam_variation3-win32.phpt b/ext/standard/tests/file/tempnam_variation3-win32.phpt index 86990f0341..5bc4f5ec88 100644 --- a/ext/standard/tests/file/tempnam_variation3-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt @@ -26,7 +26,6 @@ $names_arr = array( -1, TRUE, FALSE, - NULL, "", " ", "\0", @@ -47,7 +46,6 @@ $res_arr = array( true, true, true, - true, false, /* prefix with path separator of a non existing directory*/ @@ -99,17 +97,15 @@ OK -- Iteration 3 -- OK -- Iteration 4 -- -OK --- Iteration 5 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation3-win32.php on line %d Failed, not created in the correct directory %s vs %s 0 --- Iteration 6 -- +-- Iteration 5 -- tempnam(): Argument #2 ($prefix) must not contain any null bytes --- Iteration 7 -- +-- Iteration 6 -- tempnam(): Argument #2 ($prefix) must be of type string, array given --- Iteration 8 -- +-- Iteration 7 -- OK --- Iteration 9 -- +-- Iteration 8 -- OK diff --git a/ext/standard/tests/file/tempnam_variation3.phpt b/ext/standard/tests/file/tempnam_variation3.phpt index baf0a5a868..6f20ec140e 100644 --- a/ext/standard/tests/file/tempnam_variation3.phpt +++ b/ext/standard/tests/file/tempnam_variation3.phpt @@ -21,7 +21,6 @@ $names_arr = array( -1, TRUE, FALSE, - NULL, "", " ", "\0", @@ -98,18 +97,14 @@ File name is => %s/%s File permissions are => 100600 File created in => directory specified -- Iteration 5 -- -File name is => %s/%s -File permissions are => 100600 -File created in => directory specified --- Iteration 6 -- tempnam(): Argument #2 ($prefix) must not contain any null bytes --- Iteration 7 -- +-- Iteration 6 -- tempnam(): Argument #2 ($prefix) must be of type string, array given --- Iteration 8 -- +-- Iteration 7 -- File name is => %s/dir%s File permissions are => 100600 File created in => directory specified --- Iteration 9 -- +-- Iteration 8 -- File name is => %s/php%s File permissions are => 100600 File created in => directory specified diff --git a/ext/standard/tests/file/tempnam_variation7-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt index 0c951e2657..b731c76449 100644 --- a/ext/standard/tests/file/tempnam_variation7-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt @@ -19,7 +19,6 @@ $names_arr = array( -1, TRUE, FALSE, - NULL, "", " ", "\0", @@ -86,26 +85,22 @@ File name is => %s%et%s File permissions are => 100666 File created in => temp dir -- Iteration 4 -- -File name is => %s%et%s -File permissions are => 100666 -File created in => temp dir --- Iteration 5 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d File name is => %s%et%s File permissions are => 100666 File created in => temp dir --- Iteration 6 -- +-- Iteration 5 -- tempnam(): Argument #1 ($directory) must not contain any null bytes --- Iteration 7 -- +-- Iteration 6 -- tempnam(): Argument #1 ($directory) must be of type string, array given --- Iteration 8 -- +-- Iteration 7 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d File name is => %s%et%s File permissions are => 100666 File created in => temp dir --- Iteration 9 -- +-- Iteration 8 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d File name is => %s%et%s diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt index 9a0b1151c6..1928da4f89 100644 --- a/ext/standard/tests/file/tempnam_variation7.phpt +++ b/ext/standard/tests/file/tempnam_variation7.phpt @@ -19,7 +19,6 @@ $names_arr = array( -1, TRUE, FALSE, - NULL, "", " ", "\0", @@ -91,26 +90,22 @@ File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir -- Iteration 4 -- -File name is => %s%etempnam_variation3.tmp%s -File permissions are => 100600 -File created in => temp dir --- Iteration 5 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir --- Iteration 6 -- +-- Iteration 5 -- tempnam(): Argument #1 ($directory) must not contain any null bytes --- Iteration 7 -- +-- Iteration 6 -- tempnam(): Argument #1 ($directory) must be of type string, array given --- Iteration 8 -- +-- Iteration 7 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d File name is => %s/tempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir --- Iteration 9 -- +-- Iteration 8 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d File name is => %s/tempnam_variation3.tmp%s diff --git a/ext/standard/tests/file/unlink_error-win32-mb.phpt b/ext/standard/tests/file/unlink_error-win32-mb.phpt index e85db00600..df98e2e367 100644 --- a/ext/standard/tests/file/unlink_error-win32-mb.phpt +++ b/ext/standard/tests/file/unlink_error-win32-mb.phpt @@ -27,9 +27,6 @@ echo "\n-- Testing unlink() on invalid arguments --\n"; var_dump( unlink('') ); // $filename as empty string var_dump( file_exists('') ); // confirm file doesn't exist -var_dump( unlink(NULL) ); // $filename as NULL -var_dump( file_exists(NULL) ); // confirm file doesn't exist - var_dump( unlink(false) ); // $filename as boolean false var_dump( file_exists(false) ); // confirm file doesn't exist @@ -66,10 +63,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink(): %s in %s on line %d -bool(false) -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 af579be58d..6bce3d4b80 100644 --- a/ext/standard/tests/file/unlink_error-win32.phpt +++ b/ext/standard/tests/file/unlink_error-win32.phpt @@ -25,9 +25,6 @@ echo "\n-- Testing unlink() on invalid arguments --\n"; var_dump( unlink('') ); // $filename as empty string var_dump( file_exists('') ); // confirm file doesn't exist -var_dump( unlink(NULL) ); // $filename as NULL -var_dump( file_exists(NULL) ); // confirm file doesn't exist - var_dump( unlink(false) ); // $filename as boolean false var_dump( file_exists(false) ); // confirm file doesn't exist @@ -63,10 +60,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink(): %s in %s on line %d -bool(false) -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 e5f809df05..1dd8ef1a25 100644 --- a/ext/standard/tests/file/unlink_error.phpt +++ b/ext/standard/tests/file/unlink_error.phpt @@ -25,9 +25,6 @@ echo "\n-- Testing unlink() on invalid arguments --\n"; var_dump( unlink('') ); // $filename as empty string var_dump( file_exists('') ); // confirm file doesn't exist -var_dump( unlink(NULL) ); // $filename as NULL -var_dump( file_exists(NULL) ); // confirm file doesn't exist - var_dump( unlink(false) ); // $filename as boolean false var_dump( file_exists(false) ); // confirm file doesn't exist @@ -62,10 +59,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink(): %s in %s on line %d -bool(false) -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/windows_mb_path/test_long_path_bug71103.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_bug71103.phpt index a81ff66dfb..3e024c5e56 100644 --- a/ext/standard/tests/file/windows_mb_path/test_long_path_bug71103.phpt +++ b/ext/standard/tests/file/windows_mb_path/test_long_path_bug71103.phpt @@ -17,7 +17,7 @@ $d = $base . '\\dev\\http\\tproj\\app\\cache\\dev_old\\annotations\\72'; $foo = $d . '\\5b53796d666f6e795c42756e646c655c5477696742756e646c655c436f6e74726f6c6c65725c457863657074696f6e436f6e74726f6c6c657223676574416e64436c65616e4f7574707574427566666572696e67405b416e6e6f745d5d5b.doctrinecache.data'; $bar = $d . '\\5b53796d666f6e795c42756e646c655c5477696742756e646c655c436f6e74726f6c6c65725c457863657074696f6e436f6e74726f6c6c657223676574416e64436c65616e4f7574707574427566666572696e67405b416e6e6f745d5d5b315d.doctrinecache.data'; -mkdir($d, NULL, true); +mkdir($d, 0777, true); foreach (array($foo, $bar) as $f) { touch($f); diff --git a/ext/standard/tests/general_functions/array_is_list.phpt b/ext/standard/tests/general_functions/array_is_list.phpt new file mode 100644 index 0000000000..1cc2886f96 --- /dev/null +++ b/ext/standard/tests/general_functions/array_is_list.phpt @@ -0,0 +1,98 @@ +--TEST-- +Test array_is_list() function +--FILE-- +<?php + +function test_is_list(string $desc, $val) : void { + try { + printf("%s: %s\n", $desc, json_encode(array_is_list($val))); + } catch (TypeError $e) { + printf("%s: threw %s\n", $desc, $e->getMessage()); + } +} + +test_is_list("empty", []); +test_is_list("one", [1]); +test_is_list("two", [1,2]); +test_is_list("three", [1,2,3]); +test_is_list("four", [1,2,3,4]); +test_is_list("ten", range(0, 10)); + +test_is_list("null", null); +test_is_list("int", 123); +test_is_list("float", 1.23); +test_is_list("string", "string"); +test_is_list("object", new stdClass()); +test_is_list("true", true); +test_is_list("false", false); + +test_is_list("string key", ["a" => 1]); +test_is_list("mixed keys", [0 => 0, "a" => 1]); +test_is_list("ordered keys", [0 => 0, 1 => 1]); +test_is_list("shuffled keys", [1 => 0, 0 => 1]); +test_is_list("skipped keys", [0 => 0, 2 => 2]); + +$arr = [1, 2, 3]; +unset($arr[0]); +test_is_list("unset first", $arr); + +$arr = [1, 2, 3]; +unset($arr[1]); +test_is_list("unset middle", $arr); + +$arr = [1, 2, 3]; +unset($arr[2]); +test_is_list("unset end", $arr); + +$arr = [1, "a" => "a", 2]; +unset($arr["a"]); +test_is_list("unset string key", $arr); + +$arr = [1 => 1, 0 => 0]; +unset($arr[1]); +test_is_list("unset into order", $arr); + +$arr = ["a" => 1]; +unset($arr["a"]); +test_is_list("unset to empty", $arr); + +$arr = [1, 2, 3]; +$arr[] = 4; +test_is_list("append implicit", $arr); + +$arr = [1, 2, 3]; +$arr[3] = 4; +test_is_list("append explicit", $arr); + +$arr = [1, 2, 3]; +$arr[4] = 5; +test_is_list("append with gap", $arr); + +--EXPECT-- +empty: true +one: true +two: true +three: true +four: true +ten: true +null: threw array_is_list(): Argument #1 ($array) must be of type array, null given +int: threw array_is_list(): Argument #1 ($array) must be of type array, int given +float: threw array_is_list(): Argument #1 ($array) must be of type array, float given +string: threw array_is_list(): Argument #1 ($array) must be of type array, string given +object: threw array_is_list(): Argument #1 ($array) must be of type array, stdClass given +true: threw array_is_list(): Argument #1 ($array) must be of type array, bool given +false: threw array_is_list(): Argument #1 ($array) must be of type array, bool given +string key: false +mixed keys: false +ordered keys: true +shuffled keys: false +skipped keys: false +unset first: false +unset middle: false +unset end: true +unset string key: true +unset into order: true +unset to empty: true +append implicit: true +append explicit: true +append with gap: false
\ No newline at end of file diff --git a/ext/standard/tests/general_functions/call_user_func_return.phpt b/ext/standard/tests/general_functions/call_user_func_return.phpt index 4719587ffc..f4aaec13a5 100644 --- a/ext/standard/tests/general_functions/call_user_func_return.phpt +++ b/ext/standard/tests/general_functions/call_user_func_return.phpt @@ -23,20 +23,20 @@ function & test2($arg1, $arg2) function test($func) { - debug_zval_dump($func('Direct', 'Call')); - debug_zval_dump(call_user_func_array($func, array('User', 'Func'))); + var_dump($func('Direct', 'Call')); + var_dump(call_user_func_array($func, array('User', 'Func'))); } test('test1'); test('test2'); ?> ---EXPECTF-- +--EXPECT-- Direct Call -string(5) "test1" refcount(%d) +string(5) "test1" User Func -string(5) "test1" refcount(%d) +string(5) "test1" Direct Call -string(5) "test2" refcount(%d) +string(5) "test2" User Func -string(5) "test2" refcount(%d) +string(5) "test2" diff --git a/ext/standard/tests/general_functions/debug_zval_dump_b.phpt b/ext/standard/tests/general_functions/debug_zval_dump_b.phpt Binary files differindex 5ce121b6a7..0444ade190 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_b.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_b.phpt diff --git a/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt b/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt Binary files differindex 6425249ca6..9302593cb2 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt diff --git a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt index b195353703..e248bdc8be 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt @@ -2,6 +2,8 @@ Test debug_zval_dump() function : working on objects --SKIPIF-- <?php if (PHP_ZTS) { print "skip only for no-zts build"; } +--INI-- +opcache.enable=0 --FILE-- <?php function zval_dump( $values ) { diff --git a/ext/standard/tests/general_functions/debug_zval_dump_v.phpt b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt index ad64ceebdb..17132874bf 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_v.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt @@ -188,11 +188,11 @@ NULL -- Iteration 4 -- NULL -- Iteration 5 -- -string(7) "TRUE123" refcount(%d) +string(7) "TRUE123" interned -- Iteration 6 -- -string(9) "123string" refcount(%d) +string(9) "123string" interned -- Iteration 7 -- -string(9) "string123" refcount(%d) +string(9) "string123" interned -- Iteration 8 -- -string(10) "NULLstring" refcount(%d) +string(10) "NULLstring" interned Done diff --git a/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt b/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt index c7cab179b4..752b1dfa7e 100644 --- a/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt +++ b/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt @@ -10,10 +10,6 @@ if( substr(PHP_OS, 0, 3) != "WIN" ) echo "*** Testing escapeshellarg() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - // heredoc string $heredoc = <<<EOT abc @@ -39,10 +35,6 @@ $inputs = array( 1.234567E-2, .5, - // null data -/*11*/ NULL, - null, - // boolean data /*13*/ true, false, @@ -53,12 +45,6 @@ $inputs = array( /*17*/ "", '', - // undefined data -/*19*/ @$undefined_var, - - // unset data -/*20*/ @$unset_var, - ); // loop through each element of $inputs to check the behaviour of escapeshellarg() @@ -103,7 +89,7 @@ string(12) ""0.01234567"" string(5) ""0.5"" -- Iteration 11 -- -string(2) """" +string(3) ""1"" -- Iteration 12 -- string(2) """" @@ -115,19 +101,7 @@ string(3) ""1"" string(2) """" -- Iteration 15 -- -string(3) ""1"" - --- Iteration 16 -- -string(2) """" - --- Iteration 17 -- -string(2) """" - --- Iteration 18 -- -string(2) """" - --- Iteration 19 -- string(2) """" --- Iteration 20 -- +-- Iteration 16 -- string(2) """" diff --git a/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt b/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt index 15ebbfcd4e..028b987eec 100644 --- a/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt +++ b/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt @@ -10,10 +10,6 @@ if( substr(PHP_OS, 0, 3) == "WIN" ) echo "*** Testing escapeshellarg() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - // heredoc string $heredoc = <<<EOT abc @@ -39,10 +35,6 @@ $inputs = array( 1.234567E-2, .5, - // null data -/*11*/ NULL, - null, - // boolean data /*13*/ true, false, @@ -52,13 +44,6 @@ $inputs = array( // empty data /*17*/ "", '', - - // undefined data -/*19*/ @$undefined_var, - - // unset data -/*20*/ @$unset_var, - ); // loop through each element of $inputs to check the behaviour of escapeshellarg() @@ -103,7 +88,7 @@ string(12) "'0.01234567'" string(5) "'0.5'" -- Iteration 11 -- -string(2) "''" +string(3) "'1'" -- Iteration 12 -- string(2) "''" @@ -115,19 +100,7 @@ string(3) "'1'" string(2) "''" -- Iteration 15 -- -string(3) "'1'" - --- Iteration 16 -- -string(2) "''" - --- Iteration 17 -- -string(2) "''" - --- Iteration 18 -- -string(2) "''" - --- Iteration 19 -- string(2) "''" --- Iteration 20 -- +-- Iteration 16 -- string(2) "''" diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation3.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation3.phpt deleted file mode 100644 index 1a99242ba6..0000000000 --- a/ext/standard/tests/general_functions/get_cfg_var_variation3.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -Test function get_cfg_var() by substituting argument 1 with emptyUnsetUndefNull values. ---CREDITS-- -Francesco Fullone ff@ideato.it -#PHPTestFest Cesena Italia on 2009-06-20 ---INI-- -session.use_cookies=0 -session.serialize_handler=php -session.save_handler=files ---FILE-- -<?php - - -echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n"; - - - -$unset_var = 10; -unset($unset_var); - -$variation_array = array( - 'unset var' => @$unset_var, - 'undefined var' => @$undefined_var, - 'empty string DQ' => "", - 'empty string SQ' => '', - 'uppercase NULL' => NULL, - 'lowercase null' => null - ); - - -foreach ( $variation_array as $var ) { - var_dump(get_cfg_var( $var ) ); -} -?> ---EXPECT-- -*** Test substituting argument 1 with emptyUnsetUndefNull values *** -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) diff --git a/ext/standard/tests/general_functions/getservbyname_variation10.phpt b/ext/standard/tests/general_functions/getservbyname_variation10.phpt deleted file mode 100644 index db1d47f3ef..0000000000 --- a/ext/standard/tests/general_functions/getservbyname_variation10.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Test function getservbyname() by substituting argument 2 with emptyUnsetUndefNull values. ---FILE-- -<?php - - -echo "*** Test substituting argument 2 with emptyUnsetUndefNull values ***\n"; - -$service = "www"; - - -$unset_var = 10; -unset($unset_var); - -$variation_array = array( - 'unset var' => @$unset_var, - 'undefined var' => @$undefined_var, - 'empty string DQ' => "", - 'empty string SQ' => '', - 'uppercase NULL' => NULL, - 'lowercase null' => null, - ); - - -foreach ( $variation_array as $var ) { - var_dump(getservbyname( $service, $var ) ); -} -?> ---EXPECT-- -*** Test substituting argument 2 with emptyUnsetUndefNull values *** -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) diff --git a/ext/standard/tests/general_functions/getservbyname_variation3.phpt b/ext/standard/tests/general_functions/getservbyname_variation3.phpt deleted file mode 100644 index 6602ce0bfc..0000000000 --- a/ext/standard/tests/general_functions/getservbyname_variation3.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Test function getservbyname() by substituting argument 1 with emptyUnsetUndefNull values. ---FILE-- -<?php - - -echo "*** Test substituting argument 1 with emptyUnsetUndefNull values ***\n"; - -$protocol = "tcp"; - - -$unset_var = 10; -unset($unset_var); - -$variation_array = array( - 'unset var' => @$unset_var, - 'undefined var' => @$undefined_var, - 'empty string DQ' => "", - 'empty string SQ' => '', - 'uppercase NULL' => NULL, - 'lowercase null' => null, - ); - - -foreach ( $variation_array as $var ) { - var_dump(getservbyname( $var , $protocol ) ); -} -?> ---EXPECT-- -*** Test substituting argument 1 with emptyUnsetUndefNull values *** -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) diff --git a/ext/standard/tests/general_functions/getservbyport_variation1.phpt b/ext/standard/tests/general_functions/getservbyport_variation1.phpt index a6358027a5..03cc5b46e9 100644 --- a/ext/standard/tests/general_functions/getservbyport_variation1.phpt +++ b/ext/standard/tests/general_functions/getservbyport_variation1.phpt @@ -15,16 +15,13 @@ Simone Gentili (sensorario@gmail.com) ?> --FILE-- <?php - var_dump(getservbyport( -1, "tcp" )); - var_dump(getservbyport( 80, "ppp" )); - var_dump(getservbyport( null, null)); - var_dump(getservbyport( 2, 2)); - var_dump(getservbyport( "80", "tcp")); - +var_dump(getservbyport( -1, "tcp" )); +var_dump(getservbyport( 80, "ppp" )); +var_dump(getservbyport( 2, 2)); +var_dump(getservbyport( "80", "tcp")); ?> --EXPECTF-- bool(false) bool(false) bool(false) -bool(false) string(%d) "%s" diff --git a/ext/standard/tests/general_functions/http_response_code.phpt b/ext/standard/tests/general_functions/http_response_code.phpt index bc2775f3d3..ab290c3cef 100644 --- a/ext/standard/tests/general_functions/http_response_code.phpt +++ b/ext/standard/tests/general_functions/http_response_code.phpt @@ -2,6 +2,15 @@ Test http_response_code basic functionality --CREDITS-- Gabriel Caruso (carusogabriel@php.net) +--SKIPIF-- +<?php +if (getenv('SKIP_REPEAT')) { + /* The http_response_code leaks across repeats. Technically that's a bug, but it's something + * that only affects the CLI repeat option, where the response code is not meaningful in the + * first place. Other SAPIs will properly reset the response code for each request. */ + die('skip Not repeatable'); +} +?> --FILE-- <?php var_dump( diff --git a/ext/standard/tests/general_functions/ini_set_types.phpt b/ext/standard/tests/general_functions/ini_set_types.phpt new file mode 100644 index 0000000000..16def381db --- /dev/null +++ b/ext/standard/tests/general_functions/ini_set_types.phpt @@ -0,0 +1,34 @@ +--TEST-- +ini_set() accepts non-strings under strict_types +--FILE-- +<?php +declare(strict_types=1); + +ini_set('docref_root', null); +var_dump(ini_get('docref_root')); +ini_set('html_errors', true); +var_dump(ini_get('html_errors')); +ini_set('html_errors', false); +var_dump(ini_get('html_errors')); +ini_set('precision', 6); +var_dump(ini_get('precision')); + +// There are no float options in always enabled extensions. +// Just use a random string property, even though it doesn't make sense. +ini_set('user_agent', 3.14); +var_dump(ini_get('user_agent')); + +try { + ini_set('foo', []); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +string(0) "" +string(1) "1" +string(0) "" +string(1) "6" +string(4) "3.14" +ini_set(): Argument #2 ($value) must be of type string|int|float|bool|null diff --git a/ext/standard/tests/general_functions/proc_nice_basic.phpt b/ext/standard/tests/general_functions/proc_nice_basic.phpt index b8cc3cd128..17bca0f7b7 100644 --- a/ext/standard/tests/general_functions/proc_nice_basic.phpt +++ b/ext/standard/tests/general_functions/proc_nice_basic.phpt @@ -25,7 +25,7 @@ if ($exit_code !== 0) { else return -1; } - $delta = 10; + $delta = 5; $pid = getmypid(); $niceBefore = getNice($pid); proc_nice($delta); diff --git a/ext/standard/tests/general_functions/uniqid_basic.phpt b/ext/standard/tests/general_functions/uniqid_basic.phpt index 0e782cdfd1..408f72bfdb 100644 --- a/ext/standard/tests/general_functions/uniqid_basic.phpt +++ b/ext/standard/tests/general_functions/uniqid_basic.phpt @@ -6,8 +6,8 @@ echo "*** Testing uniqid() : basic functionality ***\n"; echo "\nuniqid() without a prefix\n"; var_dump(uniqid()); -var_dump(uniqid(null, true)); -var_dump(uniqid(null, false)); +var_dump(uniqid('', true)); +var_dump(uniqid('', false)); echo "\n\n"; echo "uniqid() with a prefix\n"; @@ -17,7 +17,6 @@ $prefix = array ( 99999, "99999", 10.5e2, - null, true, false ); @@ -52,10 +51,6 @@ string(17) "1050%s" string(27) "1050%s.%s" string(17) "1050%s" -string(13) "%s" -string(23) "%s.%s" -string(13) "%s" - string(14) "1%s" string(24) "1%s.%s" string(14) "1%s" @@ -63,4 +58,3 @@ string(14) "1%s" string(13) "%s" string(23) "%s.%s" string(13) "%s" - diff --git a/ext/standard/tests/image/image_type_to_extension.phpt b/ext/standard/tests/image/image_type_to_extension.phpt index 448aac4e99..fd60fc454e 100644 --- a/ext/standard/tests/image/image_type_to_extension.phpt +++ b/ext/standard/tests/image/image_type_to_extension.phpt @@ -29,7 +29,7 @@ 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(1000000, NULL)); + var_dump(image_type_to_extension(1000000, false)); var_dump(image_type_to_extension(0)); ?> Done diff --git a/ext/standard/tests/math/abs_basic.phpt b/ext/standard/tests/math/abs_basic.phpt index 65120efef6..2b4957b996 100644 --- a/ext/standard/tests/math/abs_basic.phpt +++ b/ext/standard/tests/math/abs_basic.phpt @@ -26,7 +26,7 @@ for ($i = 0; $i < count($values); $i++) { var_dump($res); } ?> ---EXPECT-- +--EXPECTF-- *** Testing abs() : basic functionality *** int(23) int(23) @@ -39,6 +39,8 @@ int(23) float(23.45) float(23.45) float(23.45) + +Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d int(0) int(1) int(0) diff --git a/ext/standard/tests/math/abs_variation.phpt b/ext/standard/tests/math/abs_variation.phpt index 6b7a184cbd..d7f878bc01 100644 --- a/ext/standard/tests/math/abs_variation.phpt +++ b/ext/standard/tests/math/abs_variation.phpt @@ -78,13 +78,17 @@ foreach($inputs as $input) { fclose($fp); ?> ---EXPECT-- +--EXPECTF-- *** Testing abs() : usage variations *** -- Iteration 1 -- + +Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d int(0) -- Iteration 2 -- + +Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d int(0) -- Iteration 3 -- @@ -121,9 +125,13 @@ abs(): Argument #1 ($num) must be of type int|float, string given abs(): Argument #1 ($num) must be of type int|float, classA given -- Iteration 14 -- + +Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d int(0) -- Iteration 15 -- + +Deprecated: abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d int(0) -- Iteration 16 -- diff --git a/ext/standard/tests/math/acos_variation.phpt b/ext/standard/tests/math/acos_variation.phpt index 163487d99f..1fac4ccc24 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.45", "2.345e1", "1000", - null, true, false); @@ -42,6 +41,5 @@ float(NAN) float(NAN) float(NAN) float(NAN) -float(1.5707963267948966) float(0) float(1.5707963267948966) diff --git a/ext/standard/tests/math/acosh_variation.phpt b/ext/standard/tests/math/acosh_variation.phpt index 904316a998..9335961e63 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.45", "2.345e1", "1000", - null, true, false); @@ -42,6 +41,5 @@ float(3.8281684713331012) float(3.8475627390640357) float(3.8475627390640357) float(7.600902209541989) -float(NAN) float(0) float(NAN) diff --git a/ext/standard/tests/math/asin_variation.phpt b/ext/standard/tests/math/asin_variation.phpt index 323701c51a..d028689439 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.45", "2.345e1", "1000", - null, true, false); @@ -42,6 +41,5 @@ float(NAN) float(NAN) float(NAN) float(NAN) -float(0) float(1.5707963267948966) float(0) diff --git a/ext/standard/tests/math/asinh_variation.phpt b/ext/standard/tests/math/asinh_variation.phpt index 4958468064..e7b9fd9c54 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.45", "2.345e1", "1000", - null, true, false); @@ -42,6 +41,5 @@ float(3.829113652) float(3.848471992) float(3.848471992) float(7.60090271) -float(0) float(0.881373587) float(0) diff --git a/ext/standard/tests/math/atan2_basic.phpt b/ext/standard/tests/math/atan2_basic.phpt index 1763795cfa..1c89cfa1c2 100644 --- a/ext/standard/tests/math/atan2_basic.phpt +++ b/ext/standard/tests/math/atan2_basic.phpt @@ -13,7 +13,6 @@ $valuesy = array(23, "23", "23.45", "2.345e1", - null, true, false); @@ -26,7 +25,6 @@ $valuesx = array(23, "23", "23.45", "2.345e1", - null, true, false); @@ -48,7 +46,6 @@ Y:23 X:23 float(0.78539816339745) Y:23 X:23 float(0.78539816339745) Y:23 X:23.45 float(0.77571063007847) Y:23 X:2.345e1 float(0.77571063007847) -Y:23 X: float(1.5707963267949) Y:23 X:1 float(1.5273454314034) Y:23 X: float(1.5707963267949) Y:-23 X:23 float(-0.78539816339745) @@ -60,7 +57,6 @@ Y:-23 X:23 float(-0.78539816339745) Y:-23 X:23 float(-0.78539816339745) Y:-23 X:23.45 float(-0.77571063007847) Y:-23 X:2.345e1 float(-0.77571063007847) -Y:-23 X: float(-1.5707963267949) Y:-23 X:1 float(-1.5273454314034) Y:-23 X: float(-1.5707963267949) Y:23.45 X:23 float(0.79508569671643) @@ -72,7 +68,6 @@ Y:23.45 X:23 float(0.79508569671643) Y:23.45 X:23 float(0.79508569671643) Y:23.45 X:23.45 float(0.78539816339745) Y:23.45 X:2.345e1 float(0.78539816339745) -Y:23.45 X: float(1.5707963267949) Y:23.45 X:1 float(1.5281782247706) Y:23.45 X: float(1.5707963267949) Y:-23.45 X:23 float(-0.79508569671643) @@ -84,7 +79,6 @@ Y:-23.45 X:23 float(-0.79508569671643) Y:-23.45 X:23 float(-0.79508569671643) Y:-23.45 X:23.45 float(-0.78539816339745) Y:-23.45 X:2.345e1 float(-0.78539816339745) -Y:-23.45 X: float(-1.5707963267949) Y:-23.45 X:1 float(-1.5281782247706) Y:-23.45 X: float(-1.5707963267949) Y:23 X:23 float(0.78539816339745) @@ -96,7 +90,6 @@ Y:23 X:23 float(0.78539816339745) Y:23 X:23 float(0.78539816339745) Y:23 X:23.45 float(0.77571063007847) Y:23 X:2.345e1 float(0.77571063007847) -Y:23 X: float(1.5707963267949) Y:23 X:1 float(1.5273454314034) Y:23 X: float(1.5707963267949) Y:23 X:23 float(0.78539816339745) @@ -108,7 +101,6 @@ Y:23 X:23 float(0.78539816339745) Y:23 X:23 float(0.78539816339745) Y:23 X:23.45 float(0.77571063007847) Y:23 X:2.345e1 float(0.77571063007847) -Y:23 X: float(1.5707963267949) Y:23 X:1 float(1.5273454314034) Y:23 X: float(1.5707963267949) Y:23 X:23 float(0.78539816339745) @@ -120,7 +112,6 @@ Y:23 X:23 float(0.78539816339745) Y:23 X:23 float(0.78539816339745) Y:23 X:23.45 float(0.77571063007847) Y:23 X:2.345e1 float(0.77571063007847) -Y:23 X: float(1.5707963267949) Y:23 X:1 float(1.5273454314034) Y:23 X: float(1.5707963267949) Y:23.45 X:23 float(0.79508569671643) @@ -132,7 +123,6 @@ Y:23.45 X:23 float(0.79508569671643) Y:23.45 X:23 float(0.79508569671643) Y:23.45 X:23.45 float(0.78539816339745) Y:23.45 X:2.345e1 float(0.78539816339745) -Y:23.45 X: float(1.5707963267949) Y:23.45 X:1 float(1.5281782247706) Y:23.45 X: float(1.5707963267949) Y:2.345e1 X:23 float(0.79508569671643) @@ -144,21 +134,8 @@ Y:2.345e1 X:23 float(0.79508569671643) Y:2.345e1 X:23 float(0.79508569671643) Y:2.345e1 X:23.45 float(0.78539816339745) Y:2.345e1 X:2.345e1 float(0.78539816339745) -Y:2.345e1 X: float(1.5707963267949) Y:2.345e1 X:1 float(1.5281782247706) Y:2.345e1 X: float(1.5707963267949) -Y: X:23 float(0) -Y: X:-23 float(3.1415926535898) -Y: X:23.45 float(0) -Y: X:-23.45 float(3.1415926535898) -Y: X:23 float(0) -Y: X:23 float(0) -Y: X:23 float(0) -Y: X:23.45 float(0) -Y: X:2.345e1 float(0) -Y: X: float(0) -Y: X:1 float(0) -Y: X: float(0) Y:1 X:23 float(0.043450895391531) Y:1 X:-23 float(3.0981417581983) Y:1 X:23.45 float(0.042618102024328) @@ -168,7 +145,6 @@ Y:1 X:23 float(0.043450895391531) Y:1 X:23 float(0.043450895391531) Y:1 X:23.45 float(0.042618102024328) Y:1 X:2.345e1 float(0.042618102024328) -Y:1 X: float(1.5707963267949) Y:1 X:1 float(0.78539816339745) Y:1 X: float(1.5707963267949) Y: X:23 float(0) @@ -180,6 +156,5 @@ Y: X:23 float(0) Y: X:23 float(0) Y: X:23.45 float(0) Y: X:2.345e1 float(0) -Y: X: float(0) Y: X:1 float(0) Y: X: float(0) diff --git a/ext/standard/tests/math/atan_variation.phpt b/ext/standard/tests/math/atan_variation.phpt index 88593c84de..abd3831ddd 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.45", "2.345e1", "1000", - null, true, false); @@ -42,6 +41,5 @@ float(1.5273454314033659) float(1.528178224770569) float(1.528178224770569) float(1.5697963271282298) -float(0) float(0.7853981633974483) float(0) diff --git a/ext/standard/tests/math/atanh_variation.phpt b/ext/standard/tests/math/atanh_variation.phpt index fa71e206c8..f740c1ccc0 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.45", "2.345e1", "1000", - null, true, false); @@ -42,6 +41,5 @@ float(NAN) float(NAN) float(NAN) float(NAN) -float(0) float(INF) float(0) diff --git a/ext/standard/tests/math/base_convert_variation1.phpt b/ext/standard/tests/math/base_convert_variation1.phpt index 8d8e0ff3a2..fd06465ab5 100644 --- a/ext/standard/tests/math/base_convert_variation1.phpt +++ b/ext/standard/tests/math/base_convert_variation1.phpt @@ -4,10 +4,6 @@ Test base_convert() function : usage variations - different data types as $numbe <?php echo "*** Testing base_convert() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - // heredoc string $heredoc = <<<EOT abc @@ -32,10 +28,6 @@ $inputs = array( 1.234567E-2, .5, - // null data -/*11*/ NULL, - null, - // boolean data /*13*/ true, false, @@ -52,12 +44,6 @@ $inputs = array( 'abcxyz', $heredoc, - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - // resource variable /*25*/ $fp ); @@ -121,7 +107,7 @@ Deprecated: Invalid characters passed for attempted conversion, these have been string(1) "5" -- Iteration 11 -- -string(1) "0" +string(1) "1" -- Iteration 12 -- string(1) "0" @@ -133,40 +119,28 @@ string(1) "1" string(1) "0" -- Iteration 15 -- -string(1) "1" +string(1) "0" -- Iteration 16 -- string(1) "0" -- Iteration 17 -- -string(1) "0" - --- Iteration 18 -- -string(1) "0" - --- Iteration 19 -- base_convert(): Argument #1 ($num) must be of type string, array given --- Iteration 20 -- +-- Iteration 18 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d string(1) "0" --- Iteration 21 -- +-- Iteration 19 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d string(1) "0" --- Iteration 22 -- +-- Iteration 20 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d string(1) "0" --- Iteration 23 -- -string(1) "0" - --- Iteration 24 -- -string(1) "0" - --- Iteration 25 -- +-- Iteration 21 -- base_convert(): Argument #1 ($num) must be of type string, resource given diff --git a/ext/standard/tests/math/base_convert_variation2.phpt b/ext/standard/tests/math/base_convert_variation2.phpt new file mode 100644 index 0000000000..279cff9920 --- /dev/null +++ b/ext/standard/tests/math/base_convert_variation2.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test base_convert() function : strange literals +--FILE-- +<?php +echo 'Binary to decimal:', \PHP_EOL; +var_dump(base_convert('0b', 2, 10)); +var_dump(base_convert('0B', 2, 10)); +var_dump(base_convert('', 2, 10)); +echo 'Octal to decimal:', \PHP_EOL; +var_dump(base_convert('0o', 8, 10)); +var_dump(base_convert('0O', 8, 10)); +var_dump(base_convert('0', 8, 10)); +var_dump(base_convert('', 8, 10)); +echo 'Hexadecimal to decimal:', \PHP_EOL; +var_dump(base_convert('0x', 16, 10)); +var_dump(base_convert('0X', 16, 10)); +var_dump(base_convert('', 16, 10)); +?> +--EXPECT-- +Binary to decimal: +string(1) "0" +string(1) "0" +string(1) "0" +Octal to decimal: +string(1) "0" +string(1) "0" +string(1) "0" +string(1) "0" +Hexadecimal to decimal: +string(1) "0" +string(1) "0" +string(1) "0" diff --git a/ext/standard/tests/math/base_convert_variation3.phpt b/ext/standard/tests/math/base_convert_variation3.phpt new file mode 100644 index 0000000000..27e0841108 --- /dev/null +++ b/ext/standard/tests/math/base_convert_variation3.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test base_convert() function: converting '0' +--FILE-- +<?php +echo 'Binary to decimal:', \PHP_EOL; +var_dump(base_convert('0', 2, 10)); +echo 'Octal to decimal:', \PHP_EOL; +var_dump(base_convert('0', 8, 10)); +echo 'Hexadecimal to decimal:', \PHP_EOL; +var_dump(base_convert('0', 16, 10)); +?> +--EXPECT-- +Binary to decimal: +string(1) "0" +Octal to decimal: +string(1) "0" +Hexadecimal to decimal: +string(1) "0" diff --git a/ext/standard/tests/math/bindec_basic.phpt b/ext/standard/tests/math/bindec_basic.phpt index 03eec8ee30..7640171fe6 100644 --- a/ext/standard/tests/math/bindec_basic.phpt +++ b/ext/standard/tests/math/bindec_basic.phpt @@ -26,7 +26,7 @@ $values = array(111000111, 011237, true, false, - null); + ); for ($i = 0; $i < count($values); $i++) { $res = bindec($values[$i]); @@ -74,4 +74,3 @@ Deprecated: Invalid characters passed for attempted conversion, these have been int(0) int(1) int(0) -int(0) diff --git a/ext/standard/tests/math/bindec_basic_64bit.phpt b/ext/standard/tests/math/bindec_basic_64bit.phpt index b8f46b6748..8fece221c0 100644 --- a/ext/standard/tests/math/bindec_basic_64bit.phpt +++ b/ext/standard/tests/math/bindec_basic_64bit.phpt @@ -26,7 +26,7 @@ $values = array(111000111, 011237, true, false, - null); + ); for ($i = 0; $i < count($values); $i++) { $res = bindec($values[$i]); @@ -74,4 +74,3 @@ Deprecated: Invalid characters passed for attempted conversion, these have been int(0) int(1) int(0) -int(0) diff --git a/ext/standard/tests/math/bindec_variation1.phpt b/ext/standard/tests/math/bindec_variation1.phpt index 5c6b2e1b1e..420ceeed7a 100644 --- a/ext/standard/tests/math/bindec_variation1.phpt +++ b/ext/standard/tests/math/bindec_variation1.phpt @@ -7,9 +7,6 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); --FILE-- <?php echo "*** Testing bindec() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); // heredoc string $heredoc = <<<EOT @@ -34,10 +31,6 @@ $inputs = array( 12.3456789000E-10, .5, - // null data -/*10*/ NULL, - null, - // boolean data /*12*/ true, false, @@ -54,12 +47,6 @@ $inputs = array( 'abcxyz', $heredoc, - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - // resource variable /*24*/ $fp ); @@ -122,7 +109,7 @@ Deprecated: Invalid characters passed for attempted conversion, these have been int(0) -- Iteration 10 -- -int(0) +int(1) -- Iteration 11 -- int(0) @@ -134,40 +121,28 @@ int(1) int(0) -- Iteration 14 -- -int(1) +int(0) -- Iteration 15 -- int(0) -- Iteration 16 -- -int(0) - --- Iteration 17 -- -int(0) - --- Iteration 18 -- bindec(): Argument #1 ($binary_string) must be of type string, array given --- Iteration 19 -- +-- Iteration 17 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d int(0) --- Iteration 20 -- +-- Iteration 18 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d int(0) --- Iteration 21 -- +-- Iteration 19 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d int(0) --- Iteration 22 -- -int(0) - --- Iteration 23 -- -int(0) - --- Iteration 24 -- +-- Iteration 20 -- bindec(): Argument #1 ($binary_string) must be of type string, resource given diff --git a/ext/standard/tests/math/bindec_variation1_64bit.phpt b/ext/standard/tests/math/bindec_variation1_64bit.phpt index e83edbe59c..56bbbd3564 100644 --- a/ext/standard/tests/math/bindec_variation1_64bit.phpt +++ b/ext/standard/tests/math/bindec_variation1_64bit.phpt @@ -7,9 +7,6 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); --FILE-- <?php echo "*** Testing bindec() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); // heredoc string $heredoc = <<<EOT @@ -34,10 +31,6 @@ $inputs = array( 12.3456789000E-10, .5, - // null data -/*10*/ NULL, - null, - // boolean data /*12*/ true, false, @@ -54,12 +47,6 @@ $inputs = array( 'abcxyz', $heredoc, - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - // resource variable /*24*/ $fp ); @@ -122,7 +109,7 @@ Deprecated: Invalid characters passed for attempted conversion, these have been int(0) -- Iteration 10 -- -int(0) +int(1) -- Iteration 11 -- int(0) @@ -134,40 +121,28 @@ int(1) int(0) -- Iteration 14 -- -int(1) +int(0) -- Iteration 15 -- int(0) -- Iteration 16 -- -int(0) - --- Iteration 17 -- -int(0) - --- Iteration 18 -- bindec(): Argument #1 ($binary_string) must be of type string, array given --- Iteration 19 -- +-- Iteration 17 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d int(0) --- Iteration 20 -- +-- Iteration 18 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d int(0) --- Iteration 21 -- +-- Iteration 19 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d int(0) --- Iteration 22 -- -int(0) - --- Iteration 23 -- -int(0) - --- Iteration 24 -- +-- Iteration 20 -- bindec(): Argument #1 ($binary_string) must be of type string, resource given diff --git a/ext/standard/tests/math/bindec_variation2.phpt b/ext/standard/tests/math/bindec_variation2.phpt new file mode 100644 index 0000000000..3fddc5d856 --- /dev/null +++ b/ext/standard/tests/math/bindec_variation2.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test bindec() function : strange literals +--FILE-- +<?php + +var_dump(bindec('0b')); +var_dump(bindec('0B')); +var_dump(bindec('')); + +?> +--EXPECT-- +int(0) +int(0) +int(0) diff --git a/ext/standard/tests/math/ceil_basic.phpt b/ext/standard/tests/math/ceil_basic.phpt index a8b3ede2a2..7bdc87d16e 100644 --- a/ext/standard/tests/math/ceil_basic.phpt +++ b/ext/standard/tests/math/ceil_basic.phpt @@ -33,7 +33,7 @@ for ($i = 0; $i < count($values); $i++) { } ?> ---EXPECT-- +--EXPECTF-- *** Testing ceil() : basic functionality *** float(0) float(0) @@ -54,4 +54,6 @@ float(-3950) float(39) float(1) float(0) + +Deprecated: ceil(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d float(0) diff --git a/ext/standard/tests/math/ceil_variation1.phpt b/ext/standard/tests/math/ceil_variation1.phpt index ce61442f65..7751946ea9 100644 --- a/ext/standard/tests/math/ceil_variation1.phpt +++ b/ext/standard/tests/math/ceil_variation1.phpt @@ -71,13 +71,17 @@ foreach($inputs as $input) { }; fclose($fp); ?> ---EXPECT-- +--EXPECTF-- *** Testing ceil() : usage variations *** -- Iteration 1 -- + +Deprecated: ceil(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d float(0) -- Iteration 2 -- + +Deprecated: ceil(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d float(0) -- Iteration 3 -- @@ -114,9 +118,13 @@ ceil(): Argument #1 ($num) must be of type int|float, string given ceil(): Argument #1 ($num) must be of type int|float, classA given -- Iteration 14 -- + +Deprecated: ceil(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d float(0) -- Iteration 15 -- + +Deprecated: ceil(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d float(0) -- Iteration 16 -- diff --git a/ext/standard/tests/math/cos_variation.phpt b/ext/standard/tests/math/cos_variation.phpt index 23af5e873b..19d72f60a7 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.45", "2.345e1", "1000", - null, true, false); @@ -42,6 +41,5 @@ float(-0.5328330203) float(-0.1117112391) float(-0.1117112391) float(0.5623790763) -float(1) float(0.5403023059) float(1) diff --git a/ext/standard/tests/math/cosh_variation.phpt b/ext/standard/tests/math/cosh_variation.phpt index 1a0a6b69e7..475c19fd50 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.45", "2.345e1", "1000", - null, true, false); @@ -42,6 +41,5 @@ float(4872401723) float(7641446995) float(7641446995) float(INF) -float(1) float(1.543080635) float(1) diff --git a/ext/standard/tests/math/decbin_basic.phpt b/ext/standard/tests/math/decbin_basic.phpt index 54b771ca26..ff1d5896f6 100644 --- a/ext/standard/tests/math/decbin_basic.phpt +++ b/ext/standard/tests/math/decbin_basic.phpt @@ -14,7 +14,6 @@ $values = array(10, "0x5F", true, false, - null, ); foreach ($values as $value) { @@ -39,4 +38,3 @@ string(6) "100111" decbin(): Argument #1 ($num) must be of type int, string given string(1) "1" string(1) "0" -string(1) "0" diff --git a/ext/standard/tests/math/decbin_variation1.phpt b/ext/standard/tests/math/decbin_variation1.phpt index fd9addc721..5ac82d41d6 100644 --- a/ext/standard/tests/math/decbin_variation1.phpt +++ b/ext/standard/tests/math/decbin_variation1.phpt @@ -9,9 +9,6 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); --FILE-- <?php echo "*** Testing decbin() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); // heredoc string $heredoc = <<<EOT @@ -43,10 +40,6 @@ $inputs = array( 12.3456789000E-10, .5, - // null data -/*12*/ NULL, - null, - // boolean data /*14*/ true, false, @@ -66,12 +59,6 @@ $inputs = array( // object data /*24*/ new classA(), - // undefined data -/*25*/ @$undefined_var, - - // unset data -/*26*/ @$unset_var, - // resource variable /*27*/ $fp ); @@ -127,7 +114,7 @@ string(1) "0" string(1) "0" -- Iteration 12 -- -string(1) "0" +string(1) "1" -- Iteration 13 -- string(1) "0" @@ -139,37 +126,25 @@ string(1) "1" string(1) "0" -- Iteration 16 -- -string(1) "1" +decbin(): Argument #1 ($num) must be of type int, string given -- Iteration 17 -- -string(1) "0" +decbin(): Argument #1 ($num) must be of type int, string given -- Iteration 18 -- -decbin(): Argument #1 ($num) must be of type int, string given +decbin(): Argument #1 ($num) must be of type int, array given -- Iteration 19 -- decbin(): Argument #1 ($num) must be of type int, string given -- Iteration 20 -- -decbin(): Argument #1 ($num) must be of type int, array given +decbin(): Argument #1 ($num) must be of type int, string given -- Iteration 21 -- decbin(): Argument #1 ($num) must be of type int, string given -- Iteration 22 -- -decbin(): Argument #1 ($num) must be of type int, string given - --- Iteration 23 -- -decbin(): Argument #1 ($num) must be of type int, string given - --- Iteration 24 -- decbin(): Argument #1 ($num) must be of type int, classA given --- Iteration 25 -- -string(1) "0" - --- Iteration 26 -- -string(1) "0" - --- Iteration 27 -- +-- Iteration 23 -- decbin(): Argument #1 ($num) must be of type int, resource given diff --git a/ext/standard/tests/math/decbin_variation1_64bit.phpt b/ext/standard/tests/math/decbin_variation1_64bit.phpt index f9e1b19b29..15bb864398 100644 --- a/ext/standard/tests/math/decbin_variation1_64bit.phpt +++ b/ext/standard/tests/math/decbin_variation1_64bit.phpt @@ -9,9 +9,6 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); --FILE-- <?php echo "*** Testing decbin() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); // heredoc string $heredoc = <<<EOT @@ -43,10 +40,6 @@ $inputs = array( 12.3456789000E-10, .5, - // null data -/*12*/ NULL, - null, - // boolean data /*14*/ true, false, @@ -66,12 +59,6 @@ $inputs = array( // object data /*24*/ new classA(), - // undefined data -/*25*/ @$undefined_var, - - // unset data -/*26*/ @$unset_var, - // resource variable /*27*/ $fp ); @@ -125,7 +112,7 @@ string(1) "0" string(1) "0" -- Iteration 12 -- -string(1) "0" +string(1) "1" -- Iteration 13 -- string(1) "0" @@ -137,37 +124,25 @@ string(1) "1" string(1) "0" -- Iteration 16 -- -string(1) "1" +decbin(): Argument #1 ($num) must be of type int, string given -- Iteration 17 -- -string(1) "0" +decbin(): Argument #1 ($num) must be of type int, string given -- Iteration 18 -- -decbin(): Argument #1 ($num) must be of type int, string given +decbin(): Argument #1 ($num) must be of type int, array given -- Iteration 19 -- decbin(): Argument #1 ($num) must be of type int, string given -- Iteration 20 -- -decbin(): Argument #1 ($num) must be of type int, array given +decbin(): Argument #1 ($num) must be of type int, string given -- Iteration 21 -- decbin(): Argument #1 ($num) must be of type int, string given -- Iteration 22 -- -decbin(): Argument #1 ($num) must be of type int, string given - --- Iteration 23 -- -decbin(): Argument #1 ($num) must be of type int, string given - --- Iteration 24 -- decbin(): Argument #1 ($num) must be of type int, classA given --- Iteration 25 -- -string(1) "0" - --- Iteration 26 -- -string(1) "0" - --- Iteration 27 -- +-- Iteration 23 -- decbin(): Argument #1 ($num) must be of type int, resource given diff --git a/ext/standard/tests/math/dechex_basic.phpt b/ext/standard/tests/math/dechex_basic.phpt index 92e9c426b3..4fde95ebe7 100644 --- a/ext/standard/tests/math/dechex_basic.phpt +++ b/ext/standard/tests/math/dechex_basic.phpt @@ -14,7 +14,6 @@ $values = array(10, "0x5F", true, false, - null, ); foreach ($values as $value) { @@ -39,4 +38,3 @@ string(2) "27" dechex(): Argument #1 ($num) must be of type int, string given string(1) "1" string(1) "0" -string(1) "0" diff --git a/ext/standard/tests/math/dechex_variation1.phpt b/ext/standard/tests/math/dechex_variation1.phpt index 8add97f7a2..8fee0d42ad 100644 --- a/ext/standard/tests/math/dechex_variation1.phpt +++ b/ext/standard/tests/math/dechex_variation1.phpt @@ -9,9 +9,6 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); --FILE-- <?php echo "*** Testing dechex() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); // heredoc string $heredoc = <<<EOT @@ -43,10 +40,6 @@ $inputs = array( 12.3456789000E-10, .5, - // null data -/*12*/ NULL, - null, - // boolean data /*14*/ true, false, @@ -66,12 +59,6 @@ $inputs = array( // object data /*24*/ new classA(), - // undefined data -/*25*/ @$undefined_var, - - // unset data -/*26*/ @$unset_var, - // resource variable /*27*/ $fp ); @@ -127,7 +114,7 @@ string(1) "0" string(1) "0" -- Iteration 12 -- -string(1) "0" +string(1) "1" -- Iteration 13 -- string(1) "0" @@ -139,37 +126,25 @@ string(1) "1" string(1) "0" -- Iteration 16 -- -string(1) "1" +dechex(): Argument #1 ($num) must be of type int, string given -- Iteration 17 -- -string(1) "0" +dechex(): Argument #1 ($num) must be of type int, string given -- Iteration 18 -- -dechex(): Argument #1 ($num) must be of type int, string given +dechex(): Argument #1 ($num) must be of type int, array given -- Iteration 19 -- dechex(): Argument #1 ($num) must be of type int, string given -- Iteration 20 -- -dechex(): Argument #1 ($num) must be of type int, array given +dechex(): Argument #1 ($num) must be of type int, string given -- Iteration 21 -- dechex(): Argument #1 ($num) must be of type int, string given -- Iteration 22 -- -dechex(): Argument #1 ($num) must be of type int, string given - --- Iteration 23 -- -dechex(): Argument #1 ($num) must be of type int, string given - --- Iteration 24 -- dechex(): Argument #1 ($num) must be of type int, classA given --- Iteration 25 -- -string(1) "0" - --- Iteration 26 -- -string(1) "0" - --- Iteration 27 -- +-- Iteration 23 -- dechex(): Argument #1 ($num) must be of type int, resource given diff --git a/ext/standard/tests/math/dechex_variation1_64bit.phpt b/ext/standard/tests/math/dechex_variation1_64bit.phpt index 020bbcd22c..8435d2bc30 100644 --- a/ext/standard/tests/math/dechex_variation1_64bit.phpt +++ b/ext/standard/tests/math/dechex_variation1_64bit.phpt @@ -9,9 +9,6 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); --FILE-- <?php echo "*** Testing dechex() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); // heredoc string $heredoc = <<<EOT @@ -43,10 +40,6 @@ $inputs = array( 12.3456789000E-10, .5, - // null data -/*12*/ NULL, - null, - // boolean data /*14*/ true, false, @@ -66,12 +59,6 @@ $inputs = array( // object data /*24*/ new classA(), - // undefined data -/*25*/ @$undefined_var, - - // unset data -/*26*/ @$unset_var, - // resource variable /*27*/ $fp ); @@ -126,7 +113,7 @@ string(1) "0" string(1) "0" -- Iteration 12 -- -string(1) "0" +string(1) "1" -- Iteration 13 -- string(1) "0" @@ -138,37 +125,25 @@ string(1) "1" string(1) "0" -- Iteration 16 -- -string(1) "1" +dechex(): Argument #1 ($num) must be of type int, string given -- Iteration 17 -- -string(1) "0" +dechex(): Argument #1 ($num) must be of type int, string given -- Iteration 18 -- -dechex(): Argument #1 ($num) must be of type int, string given +dechex(): Argument #1 ($num) must be of type int, array given -- Iteration 19 -- dechex(): Argument #1 ($num) must be of type int, string given -- Iteration 20 -- -dechex(): Argument #1 ($num) must be of type int, array given +dechex(): Argument #1 ($num) must be of type int, string given -- Iteration 21 -- dechex(): Argument #1 ($num) must be of type int, string given -- Iteration 22 -- -dechex(): Argument #1 ($num) must be of type int, string given - --- Iteration 23 -- -dechex(): Argument #1 ($num) must be of type int, string given - --- Iteration 24 -- dechex(): Argument #1 ($num) must be of type int, classA given --- Iteration 25 -- -string(1) "0" - --- Iteration 26 -- -string(1) "0" - --- Iteration 27 -- +-- Iteration 23 -- dechex(): Argument #1 ($num) must be of type int, resource given diff --git a/ext/standard/tests/math/decoct_basic.phpt b/ext/standard/tests/math/decoct_basic.phpt index 9252789b24..2bf63662f4 100644 --- a/ext/standard/tests/math/decoct_basic.phpt +++ b/ext/standard/tests/math/decoct_basic.phpt @@ -14,7 +14,6 @@ $values = array(10, "0x5F", true, false, - null, ); foreach ($values as $value) { @@ -39,4 +38,3 @@ string(2) "47" decoct(): Argument #1 ($num) must be of type int, string given string(1) "1" string(1) "0" -string(1) "0" diff --git a/ext/standard/tests/math/decoct_variation1.phpt b/ext/standard/tests/math/decoct_variation1.phpt index a236ea5367..608bb56873 100644 --- a/ext/standard/tests/math/decoct_variation1.phpt +++ b/ext/standard/tests/math/decoct_variation1.phpt @@ -9,10 +9,6 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); --FILE-- <?php echo "*** Testing decoct() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - // heredoc string $heredoc = <<<EOT @@ -44,10 +40,6 @@ $inputs = array( 12.3456789000E-10, .5, - // null data -/*12*/ NULL, - null, - // boolean data /*14*/ true, false, @@ -67,12 +59,6 @@ $inputs = array( // object data /*24*/ new classA(), - // undefined data -/*25*/ @$undefined_var, - - // unset data -/*26*/ @$unset_var, - // resource variable /*27*/ $fp ); @@ -127,7 +113,7 @@ string(1) "0" string(1) "0" -- Iteration 12 -- -string(1) "0" +string(1) "1" -- Iteration 13 -- string(1) "0" @@ -139,37 +125,25 @@ string(1) "1" string(1) "0" -- Iteration 16 -- -string(1) "1" +decoct(): Argument #1 ($num) must be of type int, string given -- Iteration 17 -- -string(1) "0" +decoct(): Argument #1 ($num) must be of type int, string given -- Iteration 18 -- -decoct(): Argument #1 ($num) must be of type int, string given +decoct(): Argument #1 ($num) must be of type int, array given -- Iteration 19 -- decoct(): Argument #1 ($num) must be of type int, string given -- Iteration 20 -- -decoct(): Argument #1 ($num) must be of type int, array given +decoct(): Argument #1 ($num) must be of type int, string given -- Iteration 21 -- decoct(): Argument #1 ($num) must be of type int, string given -- Iteration 22 -- -decoct(): Argument #1 ($num) must be of type int, string given - --- Iteration 23 -- -decoct(): Argument #1 ($num) must be of type int, string given - --- Iteration 24 -- decoct(): Argument #1 ($num) must be of type int, classA given --- Iteration 25 -- -string(1) "0" - --- Iteration 26 -- -string(1) "0" - --- Iteration 27 -- +-- Iteration 23 -- decoct(): Argument #1 ($num) must be of type int, resource given diff --git a/ext/standard/tests/math/decoct_variation1_64bit.phpt b/ext/standard/tests/math/decoct_variation1_64bit.phpt index 2ecc212844..73650f5983 100644 --- a/ext/standard/tests/math/decoct_variation1_64bit.phpt +++ b/ext/standard/tests/math/decoct_variation1_64bit.phpt @@ -9,10 +9,6 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); --FILE-- <?php echo "*** Testing decoct() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - // heredoc string $heredoc = <<<EOT @@ -44,10 +40,6 @@ $inputs = array( 12.3456789000E-10, .5, - // null data -/*12*/ NULL, - null, - // boolean data /*14*/ true, false, @@ -67,12 +59,6 @@ $inputs = array( // object data /*24*/ new classA(), - // undefined data -/*25*/ @$undefined_var, - - // unset data -/*26*/ @$unset_var, - // resource variable /*27*/ $fp ); @@ -127,7 +113,7 @@ string(1) "0" string(1) "0" -- Iteration 12 -- -string(1) "0" +string(1) "1" -- Iteration 13 -- string(1) "0" @@ -139,37 +125,25 @@ string(1) "1" string(1) "0" -- Iteration 16 -- -string(1) "1" +decoct(): Argument #1 ($num) must be of type int, string given -- Iteration 17 -- -string(1) "0" +decoct(): Argument #1 ($num) must be of type int, string given -- Iteration 18 -- -decoct(): Argument #1 ($num) must be of type int, string given +decoct(): Argument #1 ($num) must be of type int, array given -- Iteration 19 -- decoct(): Argument #1 ($num) must be of type int, string given -- Iteration 20 -- -decoct(): Argument #1 ($num) must be of type int, array given +decoct(): Argument #1 ($num) must be of type int, string given -- Iteration 21 -- decoct(): Argument #1 ($num) must be of type int, string given -- Iteration 22 -- -decoct(): Argument #1 ($num) must be of type int, string given - --- Iteration 23 -- -decoct(): Argument #1 ($num) must be of type int, string given - --- Iteration 24 -- decoct(): Argument #1 ($num) must be of type int, classA given --- Iteration 25 -- -string(1) "0" - --- Iteration 26 -- -string(1) "0" - --- Iteration 27 -- +-- Iteration 23 -- decoct(): Argument #1 ($num) must be of type int, resource given diff --git a/ext/standard/tests/math/deg2rad_variation.phpt b/ext/standard/tests/math/deg2rad_variation.phpt index 01cee28b18..47a5a89367 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.45", "2.345e1", "1000", - null, true, false); @@ -42,6 +41,5 @@ float(0.40142572795869574) float(0.40927970959267024) float(0.40927970959267024) float(17.453292519943293) -float(0) float(0.017453292519943295) float(0) diff --git a/ext/standard/tests/math/exp_basic.phpt b/ext/standard/tests/math/exp_basic.phpt index cf67db2c7a..b10ab493a8 100644 --- a/ext/standard/tests/math/exp_basic.phpt +++ b/ext/standard/tests/math/exp_basic.phpt @@ -15,7 +15,6 @@ $values = array(10, "039", true, false, - null, ); $iterator = 1; @@ -59,6 +58,3 @@ float(2.718281828459) -- Iteration 11 -- float(1) - --- Iteration 12 -- -float(1) diff --git a/ext/standard/tests/math/expm1_basic.phpt b/ext/standard/tests/math/expm1_basic.phpt index 99a46e5599..ea4c165da2 100644 --- a/ext/standard/tests/math/expm1_basic.phpt +++ b/ext/standard/tests/math/expm1_basic.phpt @@ -16,7 +16,6 @@ $values = array(10, "039", true, false, - null, ); // loop through each element of $values to check the behaviour of expm1() @@ -62,6 +61,3 @@ float(1.718281828459) -- Iteration 11 -- float(0) - --- Iteration 12 -- -float(0) diff --git a/ext/standard/tests/math/floor_basic.phpt b/ext/standard/tests/math/floor_basic.phpt index 3e4650aaa6..308a055f80 100644 --- a/ext/standard/tests/math/floor_basic.phpt +++ b/ext/standard/tests/math/floor_basic.phpt @@ -33,7 +33,7 @@ foreach($values as $value) { }; ?> ---EXPECT-- +--EXPECTF-- *** Testing floor() : basic functionality *** -- floor 0 -- @@ -94,4 +94,6 @@ float(1) float(0) -- floor -- + +Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d float(0) diff --git a/ext/standard/tests/math/floor_variation1.phpt b/ext/standard/tests/math/floor_variation1.phpt index 0b5f09f27d..c9ec5e710c 100644 --- a/ext/standard/tests/math/floor_variation1.phpt +++ b/ext/standard/tests/math/floor_variation1.phpt @@ -71,13 +71,17 @@ foreach($inputs as $input) { }; fclose($fp); ?> ---EXPECT-- +--EXPECTF-- *** Testing floor() : usage variations *** -- Iteration 1 -- + +Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d float(0) -- Iteration 2 -- + +Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d float(0) -- Iteration 3 -- @@ -114,9 +118,13 @@ floor(): Argument #1 ($num) must be of type int|float, string given floor(): Argument #1 ($num) must be of type int|float, classA given -- Iteration 14 -- + +Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d float(0) -- Iteration 15 -- + +Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d float(0) -- Iteration 16 -- diff --git a/ext/standard/tests/math/fmod_basic.phpt b/ext/standard/tests/math/fmod_basic.phpt index 731b76adab..84cd27125c 100644 --- a/ext/standard/tests/math/fmod_basic.phpt +++ b/ext/standard/tests/math/fmod_basic.phpt @@ -13,7 +13,6 @@ $values1 = array(234, "234", "234.5", "23.45e1", - null, true, false); @@ -26,7 +25,6 @@ $values2 = array(2, "2", "2.3", "2.3e1", - null, true, false); for ($i = 0; $i < count($values1); $i++) { @@ -49,7 +47,6 @@ float(0) float(0) float(1.700000000000018) float(4) -float(NAN) float(0) float(NAN) @@ -63,7 +60,6 @@ float(-0) float(-0) float(-1.700000000000018) float(-4) -float(NAN) float(-0) float(NAN) @@ -77,7 +73,6 @@ float(0.5) float(0.5) float(2.200000000000018) float(4.5) -float(NAN) float(0.5) float(NAN) @@ -91,7 +86,6 @@ float(-0.5) float(-0.5) float(-2.200000000000018) float(-4.5) -float(NAN) float(-0.5) float(NAN) @@ -105,7 +99,6 @@ float(0) float(0) float(1.700000000000018) float(4) -float(NAN) float(0) float(NAN) @@ -119,7 +112,6 @@ float(0) float(0) float(1.700000000000018) float(4) -float(NAN) float(0) float(NAN) @@ -133,7 +125,6 @@ float(0) float(0) float(1.700000000000018) float(4) -float(NAN) float(0) float(NAN) @@ -147,7 +138,6 @@ float(0.5) float(0.5) float(2.200000000000018) float(4.5) -float(NAN) float(0.5) float(NAN) @@ -161,25 +151,10 @@ float(0.5) float(0.5) float(2.200000000000018) float(4.5) -float(NAN) float(0.5) float(NAN) iteration 9 -float(0) -float(0) -float(0) -float(0) -float(0) -float(0) -float(0) -float(0) -float(0) -float(NAN) -float(0) -float(NAN) - -iteration 10 float(1) float(1) float(1) @@ -189,11 +164,10 @@ float(1) float(1) float(1) float(1) -float(NAN) float(0) float(NAN) -iteration 11 +iteration 10 float(0) float(0) float(0) @@ -203,6 +177,5 @@ float(0) float(0) float(0) float(0) -float(NAN) float(0) float(NAN) diff --git a/ext/standard/tests/math/hexdec_basic.phpt b/ext/standard/tests/math/hexdec_basic.phpt index 748c641a1a..2f06b9650a 100644 --- a/ext/standard/tests/math/hexdec_basic.phpt +++ b/ext/standard/tests/math/hexdec_basic.phpt @@ -23,7 +23,7 @@ $values = array(0x123abc, '011237', true, false, - null); + ); for ($i = 0; $i < count($values); $i++) { $res = hexdec($values[$i]); var_dump($res); @@ -51,4 +51,3 @@ int(18279) int(70199) int(1) int(0) -int(0) diff --git a/ext/standard/tests/math/hexdec_basic_64bit.phpt b/ext/standard/tests/math/hexdec_basic_64bit.phpt index c7c59451f5..fd6d53b601 100644 --- a/ext/standard/tests/math/hexdec_basic_64bit.phpt +++ b/ext/standard/tests/math/hexdec_basic_64bit.phpt @@ -25,7 +25,7 @@ $values = array(0x123abc, '011237', true, false, - null); + ); foreach($values as $value) { echo "\n-- hexdec $value --\n"; @@ -90,6 +90,3 @@ int(1) -- hexdec -- int(0) - --- hexdec -- -int(0) diff --git a/ext/standard/tests/math/hexdec_variation1.phpt b/ext/standard/tests/math/hexdec_variation1.phpt index 703d30f086..65ebbe347b 100644 --- a/ext/standard/tests/math/hexdec_variation1.phpt +++ b/ext/standard/tests/math/hexdec_variation1.phpt @@ -9,9 +9,6 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); --FILE-- <?php echo "*** Testing hexdec() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); // heredoc string $heredoc = <<<EOT @@ -38,10 +35,6 @@ $inputs = array( 12.3456789000E-10, .5, - // null data -/*12*/ NULL, - null, - // boolean data /*14*/ true, false, @@ -58,12 +51,6 @@ $inputs = array( 'abcxyz', $heredoc, - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - // resource variable /*26*/ $fp ); @@ -128,7 +115,7 @@ Deprecated: Invalid characters passed for attempted conversion, these have been int(5) -- Iteration 12 -- -int(0) +int(1) -- Iteration 13 -- int(0) @@ -140,40 +127,28 @@ int(1) int(0) -- Iteration 16 -- -int(1) +int(0) -- Iteration 17 -- int(0) -- Iteration 18 -- -int(0) - --- Iteration 19 -- -int(0) - --- Iteration 20 -- hexdec(): Argument #1 ($hex_string) must be of type string, array given --- Iteration 21 -- +-- Iteration 19 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d int(2748) --- Iteration 22 -- +-- Iteration 20 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d int(2748) --- Iteration 23 -- +-- Iteration 21 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d int(2748) --- Iteration 24 -- -int(0) - --- Iteration 25 -- -int(0) - --- Iteration 26 -- +-- Iteration 22 -- hexdec(): Argument #1 ($hex_string) must be of type string, resource given diff --git a/ext/standard/tests/math/hexdec_variation1_64bit.phpt b/ext/standard/tests/math/hexdec_variation1_64bit.phpt index 9c76afec0b..c892b8049f 100644 --- a/ext/standard/tests/math/hexdec_variation1_64bit.phpt +++ b/ext/standard/tests/math/hexdec_variation1_64bit.phpt @@ -9,9 +9,6 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); --FILE-- <?php echo "*** Testing hexdec() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); // heredoc string $heredoc = <<<EOT @@ -38,10 +35,6 @@ $inputs = array( 12.3456789000E-10, .5, - // null data -/*12*/ NULL, - null, - // boolean data /*14*/ true, false, @@ -58,12 +51,6 @@ $inputs = array( 'abcxyz', $heredoc, - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - // resource variable /*26*/ $fp ); @@ -128,7 +115,7 @@ Deprecated: Invalid characters passed for attempted conversion, these have been int(5) -- Iteration 12 -- -int(0) +int(1) -- Iteration 13 -- int(0) @@ -140,40 +127,28 @@ int(1) int(0) -- Iteration 16 -- -int(1) +int(0) -- Iteration 17 -- int(0) -- Iteration 18 -- -int(0) - --- Iteration 19 -- -int(0) - --- Iteration 20 -- hexdec(): Argument #1 ($hex_string) must be of type string, array given --- Iteration 21 -- +-- Iteration 19 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d int(2748) --- Iteration 22 -- +-- Iteration 20 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d int(2748) --- Iteration 23 -- +-- Iteration 21 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d int(2748) --- Iteration 24 -- -int(0) - --- Iteration 25 -- -int(0) - --- Iteration 26 -- +-- Iteration 22 -- hexdec(): Argument #1 ($hex_string) must be of type string, resource given diff --git a/ext/standard/tests/math/hexdec_variation2.phpt b/ext/standard/tests/math/hexdec_variation2.phpt new file mode 100644 index 0000000000..81ebae5c3f --- /dev/null +++ b/ext/standard/tests/math/hexdec_variation2.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test hexdec() function : strange literals +--FILE-- +<?php + +var_dump(hexdec('0x')); +var_dump(hexdec('0X')); +var_dump(hexdec('')); + +?> +--EXPECT-- +int(0) +int(0) +int(0) diff --git a/ext/standard/tests/math/hypot_basic.phpt b/ext/standard/tests/math/hypot_basic.phpt index 1b4b04f00a..750d688a17 100644 --- a/ext/standard/tests/math/hypot_basic.phpt +++ b/ext/standard/tests/math/hypot_basic.phpt @@ -16,7 +16,6 @@ $valuesy = array(23, "23", "23.45", "2.345e1", - null, true, false); @@ -29,7 +28,6 @@ $valuesx = array(33, "33", "43.45", "1.345e1", - null, true, false); @@ -62,8 +60,6 @@ Y:23 X:43.45 float(49.1620026036369) Y:23 X:1.345e1 float(26.6439955712352) -Y:23 X: float(23) - Y:23 X:1 float(23.0217288664427) Y:23 X: float(23) @@ -86,8 +82,6 @@ Y:-23 X:43.45 float(49.1620026036369) Y:-23 X:1.345e1 float(26.6439955712352) -Y:-23 X: float(23) - Y:-23 X:1 float(23.0217288664427) Y:-23 X: float(23) @@ -110,8 +104,6 @@ Y:23.45 X:43.45 float(49.3741329037787) Y:23.45 X:1.345e1 float(27.033405260899) -Y:23.45 X: float(23.45) - Y:23.45 X:1 float(23.4713122769052) Y:23.45 X: float(23.45) @@ -134,8 +126,6 @@ Y:-23.45 X:43.45 float(49.3741329037787) Y:-23.45 X:1.345e1 float(27.033405260899) -Y:-23.45 X: float(23.45) - Y:-23.45 X:1 float(23.4713122769052) Y:-23.45 X: float(23.45) @@ -158,8 +148,6 @@ Y:23 X:43.45 float(49.1620026036369) Y:23 X:1.345e1 float(26.6439955712352) -Y:23 X: float(23) - Y:23 X:1 float(23.0217288664427) Y:23 X: float(23) @@ -182,8 +170,6 @@ Y:23 X:43.45 float(49.1620026036369) Y:23 X:1.345e1 float(26.6439955712352) -Y:23 X: float(23) - Y:23 X:1 float(23.0217288664427) Y:23 X: float(23) @@ -206,8 +192,6 @@ Y:23 X:43.45 float(49.1620026036369) Y:23 X:1.345e1 float(26.6439955712352) -Y:23 X: float(23) - Y:23 X:1 float(23.0217288664427) Y:23 X: float(23) @@ -230,8 +214,6 @@ Y:23.45 X:43.45 float(49.3741329037787) Y:23.45 X:1.345e1 float(27.033405260899) -Y:23.45 X: float(23.45) - Y:23.45 X:1 float(23.4713122769052) Y:23.45 X: float(23.45) @@ -254,36 +236,10 @@ Y:2.345e1 X:43.45 float(49.3741329037787) Y:2.345e1 X:1.345e1 float(27.033405260899) -Y:2.345e1 X: float(23.45) - Y:2.345e1 X:1 float(23.4713122769052) Y:2.345e1 X: float(23.45) -Y: X:33 float(33) - -Y: X:-33 float(33) - -Y: X:33.45 float(33.45) - -Y: X:-33.45 float(33.45) - -Y: X:39 float(39) - -Y: X:31 float(31) - -Y: X:33 float(33) - -Y: X:43.45 float(43.45) - -Y: X:1.345e1 float(13.45) - -Y: X: float(0) - -Y: X:1 float(1) - -Y: X: float(0) - Y:1 X:33 float(33.0151480384384) Y:1 X:-33 float(33.0151480384384) @@ -302,8 +258,6 @@ Y:1 X:43.45 float(43.4615059564208) Y:1 X:1.345e1 float(13.4871234887206) -Y:1 X: float(1) - Y:1 X:1 float(1.4142135623731) Y:1 X: float(1) @@ -326,8 +280,6 @@ Y: X:43.45 float(43.45) Y: X:1.345e1 float(13.45) -Y: X: float(0) - Y: X:1 float(1) Y: X: float(0) diff --git a/ext/standard/tests/math/is_finite_basic.phpt b/ext/standard/tests/math/is_finite_basic.phpt index 9ee9d544e3..bc044e69ea 100644 --- a/ext/standard/tests/math/is_finite_basic.phpt +++ b/ext/standard/tests/math/is_finite_basic.phpt @@ -11,7 +11,6 @@ $values = array(234, "234", "234.5", "23.45e1", - null, true, false, pow(0, -2), @@ -34,6 +33,5 @@ bool(true) bool(true) bool(true) bool(true) -bool(true) bool(false) bool(false) diff --git a/ext/standard/tests/math/is_infinite_basic.phpt b/ext/standard/tests/math/is_infinite_basic.phpt index 076f202c14..0c7b076118 100644 --- a/ext/standard/tests/math/is_infinite_basic.phpt +++ b/ext/standard/tests/math/is_infinite_basic.phpt @@ -11,7 +11,6 @@ $values = array(234, "234", "234.5", "23.45e1", - null, true, false, pow(0, -2), @@ -34,6 +33,5 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) bool(true) bool(false) diff --git a/ext/standard/tests/math/is_nan_basic.phpt b/ext/standard/tests/math/is_nan_basic.phpt index fabc40b97b..65555e25ae 100644 --- a/ext/standard/tests/math/is_nan_basic.phpt +++ b/ext/standard/tests/math/is_nan_basic.phpt @@ -11,7 +11,6 @@ $values = array(234, "234", "234.5", "23.45e1", - null, true, false, pow(0, -2), @@ -37,5 +36,4 @@ bool(false) bool(false) bool(false) bool(false) -bool(false) bool(true) diff --git a/ext/standard/tests/math/log10_variation.phpt b/ext/standard/tests/math/log10_variation.phpt index 6e73cd7bea..9da765d5ae 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.45", "2.345e1", "1000", - null, true, false); @@ -42,6 +41,5 @@ float(1.3617278360175928) float(1.3701428470511021) float(1.3701428470511021) float(3) -float(-INF) float(0) float(-INF) diff --git a/ext/standard/tests/math/log1p_basic.phpt b/ext/standard/tests/math/log1p_basic.phpt index c7ffe2ec18..7b19c3f9f4 100644 --- a/ext/standard/tests/math/log1p_basic.phpt +++ b/ext/standard/tests/math/log1p_basic.phpt @@ -15,7 +15,6 @@ $values = array(23, "23", "23.45", "2.345e1", - null, true, false); @@ -60,9 +59,6 @@ float(3.196630215920881) -- log1p 2.345e1 -- float(3.196630215920881) --- log1p -- -float(0) - -- log1p 1 -- float(0.6931471805599453) diff --git a/ext/standard/tests/math/log_basic.phpt b/ext/standard/tests/math/log_basic.phpt index 84e72bb14d..ae2e790bcc 100644 --- a/ext/standard/tests/math/log_basic.phpt +++ b/ext/standard/tests/math/log_basic.phpt @@ -13,7 +13,6 @@ $values = array(23, "23", "23.45", "2.345e1", - null, true, false); @@ -40,7 +39,6 @@ float(3.1354942159291497) float(3.1354942159291497) float(3.1548704948922883) float(3.1548704948922883) -float(-INF) float(0) float(-INF) @@ -54,6 +52,5 @@ float(2.2617809780285065) float(2.2617809780285065) float(2.275758008814007) float(2.275758008814007) -float(-INF) float(0) float(-INF) diff --git a/ext/standard/tests/math/mt_rand_basic.phpt b/ext/standard/tests/math/mt_rand_basic.phpt index 24050bbc8a..113ca32ee6 100644 --- a/ext/standard/tests/math/mt_rand_basic.phpt +++ b/ext/standard/tests/math/mt_rand_basic.phpt @@ -54,7 +54,6 @@ for ($x = 0; $x < count($min); $x++) { echo "\nNon-numeric cases\n"; $min = array(true, false, - null, "10", "10.5"); @@ -94,6 +93,5 @@ PASSED: range min = 256 max = 448 Non-numeric cases PASSED range min = 1 max = 100 PASSED range min = 0 max = 100 -PASSED range min = 0 max = 100 PASSED range min = 10 max = 100 PASSED range min = 10 max = 100 diff --git a/ext/standard/tests/math/mt_srand_basic.phpt b/ext/standard/tests/math/mt_srand_basic.phpt index ec0c24254d..71abbcb0aa 100644 --- a/ext/standard/tests/math/mt_srand_basic.phpt +++ b/ext/standard/tests/math/mt_srand_basic.phpt @@ -11,7 +11,6 @@ var_dump(mt_srand("500")); var_dump(mt_srand("500E3")); var_dump(mt_srand(true)); var_dump(mt_srand(false)); -var_dump(mt_srand(NULL)); ?> --EXPECT-- NULL @@ -21,4 +20,3 @@ NULL NULL NULL NULL -NULL diff --git a/ext/standard/tests/math/number_format_basic.phpt b/ext/standard/tests/math/number_format_basic.phpt index b82ad5c753..022e573b01 100644 --- a/ext/standard/tests/math/number_format_basic.phpt +++ b/ext/standard/tests/math/number_format_basic.phpt @@ -11,7 +11,6 @@ $values = array(1234.5678, "123456789", "123.456789", "12.3456789e1", - null, true, false); @@ -40,7 +39,7 @@ for ($i = 0; $i < count($values); $i++) { } ?> --EXPECT-- - number_format tests.....default +number_format tests.....default string(5) "1,235" string(6) "-1,235" string(10) "12,346,578" @@ -50,7 +49,6 @@ string(11) "402,653,183" string(11) "123,456,789" string(3) "123" string(3) "123" -string(1) "0" string(1) "1" string(1) "0" @@ -64,7 +62,6 @@ string(14) "402,653,183.00" string(14) "123,456,789.00" string(6) "123.46" string(6) "123.46" -string(4) "0.00" string(4) "1.00" string(4) "0.00" @@ -78,7 +75,6 @@ string(14) "402 653 183.00" string(14) "123 456 789.00" string(6) "123.46" string(6) "123.46" -string(4) "0.00" string(4) "1.00" string(4) "0.00" @@ -92,6 +88,5 @@ string(14) "402 653 183,00" string(14) "123 456 789,00" string(6) "123,46" string(6) "123,46" -string(4) "0,00" string(4) "1,00" string(4) "0,00" diff --git a/ext/standard/tests/math/number_format_multichar.phpt b/ext/standard/tests/math/number_format_multichar.phpt index 5648257e03..1ed823042f 100644 --- a/ext/standard/tests/math/number_format_multichar.phpt +++ b/ext/standard/tests/math/number_format_multichar.phpt @@ -11,7 +11,6 @@ $values = array(1234.5678, "123456789", "123.456789", "12.3456789e1", - null, true, false); @@ -34,7 +33,7 @@ for ($i = 0; $i < count($values); $i++) { } ?> --EXPECT-- - number_format tests.....multiple character decimal point +number_format tests.....multiple character decimal point string(13) "1 234·57" string(14) "-1 234·57" string(18) "12 346 578·00" @@ -44,7 +43,6 @@ string(19) "402 653 183·00" string(19) "123 456 789·00" string(11) "123·46" string(11) "123·46" -string(9) "0·00" string(9) "1·00" string(9) "0·00" @@ -58,7 +56,6 @@ string(28) "402 653 183.00" string(28) "123 456 789.00" string(6) "123.46" string(6) "123.46" -string(4) "0.00" string(4) "1.00" string(4) "0.00" @@ -72,6 +69,5 @@ string(33) "402 653 183·00" string(33) "123 456 789·00" string(11) "123·46" string(11) "123·46" -string(9) "0·00" string(9) "1·00" string(9) "0·00" diff --git a/ext/standard/tests/math/octdec_basic.phpt b/ext/standard/tests/math/octdec_basic.phpt index 1daf9a4338..4c3ffc8b8a 100644 --- a/ext/standard/tests/math/octdec_basic.phpt +++ b/ext/standard/tests/math/octdec_basic.phpt @@ -22,7 +22,7 @@ $values = array(01234567, 31.1013e5, true, false, - null); + ); for ($i = 0; $i < count($values); $i++) { $res = octdec($values[$i]); @@ -57,4 +57,3 @@ int(102923) int(823384) int(1) int(0) -int(0) diff --git a/ext/standard/tests/math/octdec_basic_64bit.phpt b/ext/standard/tests/math/octdec_basic_64bit.phpt index bb8f70085d..4051d9be63 100644 --- a/ext/standard/tests/math/octdec_basic_64bit.phpt +++ b/ext/standard/tests/math/octdec_basic_64bit.phpt @@ -25,7 +25,7 @@ $values = array(01234567, 31.1013e5, true, false, - null); + ); for ($i = 0; $i < count($values); $i++) { $res = octdec($values[$i]); @@ -62,4 +62,3 @@ int(102923) int(823384) int(1) int(0) -int(0) diff --git a/ext/standard/tests/math/octdec_variation1.phpt b/ext/standard/tests/math/octdec_variation1.phpt index 6ee2b6f91c..c24d2e8e6b 100644 --- a/ext/standard/tests/math/octdec_variation1.phpt +++ b/ext/standard/tests/math/octdec_variation1.phpt @@ -5,9 +5,6 @@ precision=14 --FILE-- <?php echo "*** Testing octdec() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); // heredoc string $heredoc = <<<EOT @@ -34,10 +31,6 @@ $inputs = array( 12.3456789000E-10, .5, - // null data -/*12*/ NULL, - null, - // boolean data /*14*/ true, false, @@ -54,12 +47,6 @@ $inputs = array( 'abcxyz', $heredoc, - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - // resource variable /*26*/ $fp ); @@ -131,7 +118,7 @@ Deprecated: Invalid characters passed for attempted conversion, these have been int(5) -- Iteration 12 -- -int(0) +int(1) -- Iteration 13 -- int(0) @@ -143,41 +130,29 @@ int(1) int(0) -- Iteration 16 -- -int(1) +int(0) -- Iteration 17 -- int(0) -- Iteration 18 -- -int(0) - --- Iteration 19 -- -int(0) - --- Iteration 20 -- octdec(): Argument #1 ($octal_string) must be of type string, array given --- Iteration 21 -- +-- Iteration 19 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d int(0) --- Iteration 22 -- +-- Iteration 20 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d int(0) --- Iteration 23 -- +-- Iteration 21 -- Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d int(0) --- Iteration 24 -- -int(0) - --- Iteration 25 -- -int(0) - --- Iteration 26 -- +-- Iteration 22 -- octdec(): Argument #1 ($octal_string) must be of type string, resource given ---Done--- diff --git a/ext/standard/tests/math/octdec_variation2.phpt b/ext/standard/tests/math/octdec_variation2.phpt new file mode 100644 index 0000000000..bf26f45736 --- /dev/null +++ b/ext/standard/tests/math/octdec_variation2.phpt @@ -0,0 +1,16 @@ +--TEST-- +Test octdec() function : strange literals +--FILE-- +<?php + +var_dump(octdec('0o')); +var_dump(octdec('0O')); +var_dump(octdec('0')); +var_dump(octdec('')); + +?> +--EXPECT-- +int(0) +int(0) +int(0) +int(0) diff --git a/ext/standard/tests/math/rad2deg_variation.phpt b/ext/standard/tests/math/rad2deg_variation.phpt index 122d5b2c13..3cc1317ea8 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.45", "2.345e1", "1000", - null, true, false); @@ -42,6 +41,5 @@ float(1317.8029288008934) float(1343.5860295817804) float(1343.5860295817804) float(57295.77951308232) -float(0) float(57.29577951308232) float(0) diff --git a/ext/standard/tests/math/rand_basic.phpt b/ext/standard/tests/math/rand_basic.phpt index 87e9d7cd42..06b46b2277 100644 --- a/ext/standard/tests/math/rand_basic.phpt +++ b/ext/standard/tests/math/rand_basic.phpt @@ -54,7 +54,6 @@ for ($x = 0; $x < count($min); $x++) { echo "\nNon-numeric cases\n"; $min = array(true, false, - null, "10", "10.5"); @@ -94,6 +93,5 @@ PASSED: range min = 256 max = 448 Non-numeric cases PASSED range min = 1 max = 100 PASSED range min = 0 max = 100 -PASSED range min = 0 max = 100 PASSED range min = 10 max = 100 PASSED range min = 10 max = 100 diff --git a/ext/standard/tests/math/round_basic.phpt b/ext/standard/tests/math/round_basic.phpt index 8f2ded09f3..44aacf2eec 100644 --- a/ext/standard/tests/math/round_basic.phpt +++ b/ext/standard/tests/math/round_basic.phpt @@ -25,7 +25,6 @@ $precision = array(2, "04", "3.6", "2.1e1", - null, true, false); @@ -50,7 +49,6 @@ round: 123456789 ...with precision 04-> float(123456789) ...with precision 3.6-> float(123456789) ...with precision 2.1e1-> float(123456789) -...with precision -> float(123456789) ...with precision 1-> float(123456789) ...with precision -> float(123456789) round: 123.456789 @@ -63,7 +61,6 @@ round: 123.456789 ...with precision 04-> float(123.4568) ...with precision 3.6-> float(123.457) ...with precision 2.1e1-> float(123.456789) -...with precision -> float(123) ...with precision 1-> float(123.5) ...with precision -> float(123) round: -4.5679123 @@ -76,7 +73,6 @@ round: -4.5679123 ...with precision 04-> float(-4.5679) ...with precision 3.6-> float(-4.568) ...with precision 2.1e1-> float(-4.5679123) -...with precision -> float(-5) ...with precision 1-> float(-4.6) ...with precision -> float(-5) round: 12300 @@ -89,7 +85,6 @@ round: 12300 ...with precision 04-> float(12300) ...with precision 3.6-> float(12300) ...with precision 2.1e1-> float(12300) -...with precision -> float(12300) ...with precision 1-> float(12300) ...with precision -> float(12300) round: -4567 @@ -102,7 +97,6 @@ round: -4567 ...with precision 04-> float(-4567) ...with precision 3.6-> float(-4567) ...with precision 2.1e1-> float(-4567) -...with precision -> float(-4567) ...with precision 1-> float(-4567) ...with precision -> float(-4567) round: 2311527 @@ -115,7 +109,6 @@ round: 2311527 ...with precision 04-> float(2311527) ...with precision 3.6-> float(2311527) ...with precision 2.1e1-> float(2311527) -...with precision -> float(2311527) ...with precision 1-> float(2311527) ...with precision -> float(2311527) round: 14680063 @@ -128,7 +121,6 @@ round: 14680063 ...with precision 04-> float(14680063) ...with precision 3.6-> float(14680063) ...with precision 2.1e1-> float(14680063) -...with precision -> float(14680063) ...with precision 1-> float(14680063) ...with precision -> float(14680063) round: 1.234567 @@ -141,7 +133,6 @@ round: 1.234567 ...with precision 04-> float(1.2346) ...with precision 3.6-> float(1.235) ...with precision 2.1e1-> float(1.234567) -...with precision -> float(1) ...with precision 1-> float(1.2) ...with precision -> float(1) round: 2.3456789e8 @@ -154,6 +145,5 @@ round: 2.3456789e8 ...with precision 04-> float(234567890) ...with precision 3.6-> float(234567890) ...with precision 2.1e1-> float(234567890) -...with precision -> float(234567890) ...with precision 1-> float(234567890) ...with precision -> float(234567890) diff --git a/ext/standard/tests/math/round_variation1.phpt b/ext/standard/tests/math/round_variation1.phpt index b6ce56dd4a..2a2adf27ca 100644 --- a/ext/standard/tests/math/round_variation1.phpt +++ b/ext/standard/tests/math/round_variation1.phpt @@ -85,7 +85,7 @@ foreach($inputs as $input) { }; fclose($fp); ?> ---EXPECT-- +--EXPECTF-- *** Testing round() : usage variations *** -- Iteration 1 -- @@ -119,9 +119,13 @@ float(1.23457E-9) float(0.5) -- Iteration 11 -- + +Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d float(0) -- Iteration 12 -- + +Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d float(0) -- Iteration 13 -- @@ -158,9 +162,13 @@ round(): Argument #1 ($num) must be of type int|float, string given round(): Argument #1 ($num) must be of type int|float, classA given -- Iteration 24 -- + +Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d float(0) -- Iteration 25 -- + +Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d float(0) -- Iteration 26 -- diff --git a/ext/standard/tests/math/sin_variation.phpt b/ext/standard/tests/math/sin_variation.phpt index 84c5b60c7b..6cca50a167 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.45", "2.345e1", "1000", - null, true, false); @@ -42,6 +41,5 @@ float(-0.8462204042) float(-0.9937407102) float(-0.9937407102) float(0.8268795405) -float(0) float(0.8414709848) float(0) diff --git a/ext/standard/tests/math/sinh_variation.phpt b/ext/standard/tests/math/sinh_variation.phpt index 4a26efb50a..f053e58144 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.45", "2.345e1", "1000", - null, true, false); @@ -42,6 +41,5 @@ float(4872401723) float(7641446995) float(7641446995) float(INF) -float(0) float(1.175201194) float(0) diff --git a/ext/standard/tests/math/sqrt_variation.phpt b/ext/standard/tests/math/sqrt_variation.phpt index b0683b701a..eb73870d1f 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.45", "2.345e1", "1000", - null, true, false); @@ -44,6 +43,5 @@ float(4.795831523312719) float(4.8425200051213) float(4.8425200051213) float(31.622776601683793) -float(0) float(1) float(0) diff --git a/ext/standard/tests/math/srand_basic.phpt b/ext/standard/tests/math/srand_basic.phpt index d3a5447553..ce9a4e3f97 100644 --- a/ext/standard/tests/math/srand_basic.phpt +++ b/ext/standard/tests/math/srand_basic.phpt @@ -13,7 +13,6 @@ var_dump(srand("500")); var_dump(srand("500E3")); var_dump(srand(true)); var_dump(srand(false)); -var_dump(srand(NULL)); ?> --EXPECT-- *** Testing srand() : basic functionality *** @@ -24,4 +23,3 @@ NULL NULL NULL NULL -NULL diff --git a/ext/standard/tests/math/tan_variation.phpt b/ext/standard/tests/math/tan_variation.phpt index 602db48e49..4394ddcd57 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.45", "2.345e1", "1000", - null, true, false); @@ -42,6 +41,5 @@ float(1.588153083) float(8.895619796) float(8.895619796) float(1.470324156) -float(0) float(1.557407725) float(0) diff --git a/ext/standard/tests/math/tanh_variation.phpt b/ext/standard/tests/math/tanh_variation.phpt index aab33fea60..d2011f4745 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.45", "2.345e1", "1000", - null, true, false); @@ -42,6 +41,5 @@ float(1) float(1) float(1) float(1) -float(0) float(0.7615941559557649) float(0) diff --git a/ext/standard/tests/password/password_verify.phpt b/ext/standard/tests/password/password_verify.phpt index a196763c13..5f2ff1230c 100644 --- a/ext/standard/tests/password/password_verify.phpt +++ b/ext/standard/tests/password/password_verify.phpt @@ -20,11 +20,13 @@ var_dump(password_verify("foo", "$1")); echo "OK!"; ?> ---EXPECT-- +--EXPECTF-- bool(false) bool(false) bool(false) bool(true) + +Deprecated: password_verify(): Passing null to parameter #2 ($hash) of type string is deprecated in %s on line %d bool(false) bool(true) bool(false) diff --git a/ext/standard/tests/serialize/SplObjectStorage_object_reference.phpt b/ext/standard/tests/serialize/SplObjectStorage_object_reference.phpt new file mode 100644 index 0000000000..e09ba1ae38 --- /dev/null +++ b/ext/standard/tests/serialize/SplObjectStorage_object_reference.phpt @@ -0,0 +1,33 @@ +--TEST-- +Reference to SplObjectStorage key (not supported) +--FILE-- +<?php + +$inner = 'x:i:1;O:8:"stdClass":0:{};m:a:0:{}'; +$inner_len = strlen($inner); +$str = <<<STR +a:2:{i:0;C:16:"SPlObjectStorage":{$inner_len}:{{$inner}}i:1;R:4;} +STR; +var_dump(unserialize($str)); + +?> +--EXPECTF-- +array(2) { + [0]=> + object(SplObjectStorage)#1 (1) { + ["storage":"SplObjectStorage":private]=> + array(1) { + ["%s"]=> + array(2) { + ["obj"]=> + object(stdClass)#2 (0) { + } + ["inf"]=> + NULL + } + } + } + [1]=> + object(stdClass)#2 (0) { + } +} diff --git a/ext/standard/tests/serialize/incomplete_class_magic.phpt b/ext/standard/tests/serialize/incomplete_class_magic.phpt new file mode 100644 index 0000000000..bef139740c --- /dev/null +++ b/ext/standard/tests/serialize/incomplete_class_magic.phpt @@ -0,0 +1,32 @@ +--TEST-- +(un)serializing __PHP_Incomplete_Class instance edge case +--FILE-- +<?php + +$serialized = 'O:8:"Missing_":1:{s:33:"__PHP_Incomplete_Class_Name' . "\0" . 'other";i:123;}'; +ob_start(); +$o = unserialize($serialized); +var_dump($o); +$reserialized = serialize($o); +var_dump(unserialize($reserialized)); +// Pretty print null bytes +echo str_replace("\0", "\\0", ob_get_clean()); + +// The serialization should have a property count of 1 and a property set with 1 element. +var_export($reserialized); +echo "\n"; +?> +--EXPECT-- +object(__PHP_Incomplete_Class)#1 (2) { + ["__PHP_Incomplete_Class_Name"]=> + string(8) "Missing_" + ["__PHP_Incomplete_Class_Name\0other"]=> + int(123) +} +object(__PHP_Incomplete_Class)#2 (2) { + ["__PHP_Incomplete_Class_Name"]=> + string(8) "Missing_" + ["__PHP_Incomplete_Class_Name\0other"]=> + int(123) +} +'O:8:"Missing_":1:{s:33:"__PHP_Incomplete_Class_Name' . "\0" . 'other";i:123;}' diff --git a/ext/standard/tests/serialize/serialization_objects_002.phpt b/ext/standard/tests/serialize/serialization_objects_002.phpt Binary files differindex a703af0c8f..211ba10187 100644 --- a/ext/standard/tests/serialize/serialization_objects_002.phpt +++ b/ext/standard/tests/serialize/serialization_objects_002.phpt diff --git a/ext/standard/tests/serialize/unserialize_overwrite_undeclared_protected.phpt b/ext/standard/tests/serialize/unserialize_overwrite_undeclared_protected.phpt new file mode 100644 index 0000000000..b442c922c4 --- /dev/null +++ b/ext/standard/tests/serialize/unserialize_overwrite_undeclared_protected.phpt @@ -0,0 +1,21 @@ +--TEST-- +Overwriting an undeclared property with protected mangling +--FILE-- +<?php +class Test { + // We need at least one declared property, even though we don't use it. + public $foo; +} + +$str = <<<STR +O:4:"Test":2:{s:4:"\0*\0x";N;s:4:"\0*\0x";N;} +STR; +var_dump(unserialize($str)); +?> +--EXPECT-- +object(Test)#1 (2) { + ["foo"]=> + NULL + ["x":protected]=> + NULL +} diff --git a/ext/standard/tests/streams/bug64433.phpt b/ext/standard/tests/streams/bug64433.phpt index 56af241837..53fecc57f9 100644 --- a/ext/standard/tests/streams/bug64433.phpt +++ b/ext/standard/tests/streams/bug64433.phpt @@ -9,8 +9,6 @@ if(!$res) { die("skip could not open cli server script"); } ?> ---CONFLICTS-- -server --FILE-- <?php include __DIR__."/../../../../sapi/cli/tests/php_cli_server.inc"; diff --git a/ext/standard/tests/strings/addcslashes_001.phpt b/ext/standard/tests/strings/addcslashes_001.phpt Binary files differindex be6b18559f..e8fdf2b69a 100644 --- a/ext/standard/tests/strings/addcslashes_001.phpt +++ b/ext/standard/tests/strings/addcslashes_001.phpt diff --git a/ext/standard/tests/strings/addcslashes_003.phpt b/ext/standard/tests/strings/addcslashes_003.phpt Binary files differindex f743726301..7736a9f58f 100644 --- a/ext/standard/tests/strings/addcslashes_003.phpt +++ b/ext/standard/tests/strings/addcslashes_003.phpt diff --git a/ext/standard/tests/strings/basename_variation.phpt b/ext/standard/tests/strings/basename_variation.phpt index eae1f7fa51..c34b643600 100644 --- a/ext/standard/tests/strings/basename_variation.phpt +++ b/ext/standard/tests/strings/basename_variation.phpt @@ -6,13 +6,11 @@ $file_path_variations = array ( /* paths with shortcut home dir char, with suffix variation */ array("~/home/user/bar"), array("~/home/user/bar", ""), - array("~/home/user/bar", NULL), array("~/home/user/bar", ' '), array("~/home/user/bar.tar", ".tar"), array("~/home/user/bar.tar", "~"), array("~/home/user/bar.tar/", "~"), array("~/home/user/bar.tar/", ""), - array("~/home/user/bar.tar", NULL), array("~/home/user/bar.tar", ''), array("~/home/user/bar.tar", " "), @@ -29,7 +27,6 @@ $file_path_variations = array ( array("hostname:/home/user/My Pics.gz/", "Pics.gz"), array("hostname:/home/user/My Pics.gz/", ".gz"), array("hostname:/home/user/My Pics.gz/"), - array("hostname:/home/user/My Pics.gz/", NULL), array("hostname:/home/user/My Pics.gz/", ' '), array("hostname:/home/user/My Pics.gz/", ''), array("hostname:/home/user/My Pics.gz/", "My Pics.gz"), @@ -52,7 +49,6 @@ $file_path_variations = array ( array("/bar.gz/", "/bar.gz/"), array(" ", " "), array(' ', ' '), - array(NULL, NULL), /* path with spaces */ array(" "), @@ -61,7 +57,6 @@ $file_path_variations = array ( /* empty paths */ array(""), array(''), - array(NULL), ); function check_basename( $path_arrays ) { @@ -97,7 +92,7 @@ string(3) "bar" string(3) "bar" --Iteration 5-- -string(3) "bar" +string(7) "bar.tar" --Iteration 6-- string(7) "bar.tar" @@ -118,13 +113,13 @@ string(7) "bar.tar" string(7) "bar.tar" --Iteration 12-- -string(7) "bar.tar" +string(1) "t" --Iteration 13-- -string(7) "bar.tar" +string(7) "tbar.gz" --Iteration 14-- -string(1) "t" +string(7) "tbar.gz" --Iteration 15-- string(7) "tbar.gz" @@ -133,22 +128,22 @@ string(7) "tbar.gz" string(7) "tbar.gz" --Iteration 17-- -string(7) "tbar.gz" +string(10) "My Pics.gz" --Iteration 18-- -string(7) "tbar.gz" +string(10) "My Pics.gz" --Iteration 19-- -string(10) "My Pics.gz" +string(3) "My " --Iteration 20-- -string(10) "My Pics.gz" +string(7) "My Pics" --Iteration 21-- -string(3) "My " +string(10) "My Pics.gz" --Iteration 22-- -string(7) "My Pics" +string(10) "My Pics.gz" --Iteration 23-- string(10) "My Pics.gz" @@ -157,16 +152,16 @@ string(10) "My Pics.gz" string(10) "My Pics.gz" --Iteration 25-- -string(10) "My Pics.gz" +string(4) "10.5" --Iteration 26-- -string(10) "My Pics.gz" +string(2) "10" --Iteration 27-- -string(10) "My Pics.gz" +string(4) "10.5" --Iteration 28-- -string(4) "10.5" +string(2) "10" --Iteration 29-- string(2) "10" @@ -175,56 +170,41 @@ string(2) "10" string(4) "10.5" --Iteration 31-- -string(2) "10" +string(4) "10.5" --Iteration 32-- -string(2) "10" +string(5) "10.gz" --Iteration 33-- -string(4) "10.5" +string(1) "0" --Iteration 34-- -string(4) "10.5" +string(1) "0" --Iteration 35-- -string(5) "10.gz" +string(6) "bar.gz" --Iteration 36-- -string(1) "0" +string(6) "bar.gz" --Iteration 37-- -string(1) "0" +string(6) "bar.gz" --Iteration 38-- -string(6) "bar.gz" +string(1) " " --Iteration 39-- -string(6) "bar.gz" +string(1) " " --Iteration 40-- -string(6) "bar.gz" +string(1) " " --Iteration 41-- string(1) " " --Iteration 42-- -string(1) " " - ---Iteration 43-- string(0) "" ---Iteration 44-- -string(1) " " - ---Iteration 45-- -string(1) " " - ---Iteration 46-- -string(0) "" - ---Iteration 47-- -string(0) "" - ---Iteration 48-- +--Iteration 43-- string(0) "" Done diff --git a/ext/standard/tests/strings/bug21338.phpt b/ext/standard/tests/strings/bug21338.phpt index c118ee18de..2809d43089 100644 --- a/ext/standard/tests/strings/bug21338.phpt +++ b/ext/standard/tests/strings/bug21338.phpt @@ -2,9 +2,7 @@ Bug #20934 (html_entity_decode() crash when "" is passed) --FILE-- <?php - var_dump(html_entity_decode(NULL)); - var_dump(html_entity_decode("")); +var_dump(html_entity_decode("")); ?> --EXPECT-- string(0) "" -string(0) "" diff --git a/ext/standard/tests/strings/bug51899.phpt b/ext/standard/tests/strings/bug51899.phpt index fb430cf30d..55fd535f42 100644 --- a/ext/standard/tests/strings/bug51899.phpt +++ b/ext/standard/tests/strings/bug51899.phpt @@ -8,7 +8,6 @@ var_dump(parse_ini_string('a= ')); var_dump(parse_ini_string('a='.PHP_EOL)); var_dump(parse_ini_string('a=b ')); var_dump(parse_ini_string('')); -var_dump(parse_ini_string(NULL)); var_dump(parse_ini_string("\0")); ?> @@ -33,5 +32,3 @@ array(0) { } array(0) { } -array(0) { -} diff --git a/ext/standard/tests/strings/bug53021.phpt b/ext/standard/tests/strings/bug53021.phpt index cdb408db63..4f70f213e8 100644 --- a/ext/standard/tests/strings/bug53021.phpt +++ b/ext/standard/tests/strings/bug53021.phpt @@ -38,4 +38,4 @@ single quotes variations: ' ' ' -' +' diff --git a/ext/standard/tests/strings/bug61116.phpt b/ext/standard/tests/strings/bug61116.phpt index f8f76cd504..01da21d975 100644 --- a/ext/standard/tests/strings/bug61116.phpt +++ b/ext/standard/tests/strings/bug61116.phpt @@ -10,7 +10,7 @@ Function [ <internal:standard> function htmlspecialchars ] { - Parameters [4] { Parameter #0 [ <required> string $string ] - Parameter #1 [ <optional> int $flags = ENT_COMPAT ] + Parameter #1 [ <optional> int $flags = ENT_QUOTES | ENT_SUBSTITUTE ] Parameter #2 [ <optional> ?string $encoding = null ] Parameter #3 [ <optional> bool $double_encode = true ] } @@ -21,7 +21,7 @@ Function [ <internal:standard> function get_html_translation_table ] { - Parameters [3] { Parameter #0 [ <optional> int $table = HTML_SPECIALCHARS ] - Parameter #1 [ <optional> int $flags = ENT_COMPAT ] + Parameter #1 [ <optional> int $flags = ENT_QUOTES | ENT_SUBSTITUTE ] Parameter #2 [ <optional> string $encoding = "UTF-8" ] } - Return [ array ] diff --git a/ext/standard/tests/strings/chop_variation5.phpt b/ext/standard/tests/strings/chop_variation5.phpt index c0fe43976f..2b86a9713b 100644 --- a/ext/standard/tests/strings/chop_variation5.phpt +++ b/ext/standard/tests/strings/chop_variation5.phpt @@ -10,7 +10,6 @@ echo "*** Testing chop() : with miscellaneous arguments ***\n"; var_dump ( chop("chop test \t\0 ") ); /* without second Argument */ var_dump ( chop("chop test " , "") ); /* no characters in second Argument */ - var_dump ( chop("chop test ", NULL) ); /* with NULL as second Argument */ var_dump ( chop("chop test ", true) ); /* with boolean value as second Argument */ var_dump ( chop("chop test ", " ") ); /* with single space as second Argument */ var_dump ( chop("chop test \t\n\r\0\x0B", "\t\n\r\0\x0B") ); /* with multiple escape sequences as second Argument */ @@ -25,7 +24,6 @@ echo "Done\n"; string(9) "chop test" string(12) "chop test " string(17) "chop test " -string(17) "chop test " string(9) "chop test" string(10) "chop test " string(9) "chop test" diff --git a/ext/standard/tests/strings/chr_variation1.phpt b/ext/standard/tests/strings/chr_variation1.phpt index f9df308a7a..13a0636b8a 100644 --- a/ext/standard/tests/strings/chr_variation1.phpt +++ b/ext/standard/tests/strings/chr_variation1.phpt @@ -5,10 +5,6 @@ Test chr() function : usage variations - test values for $ascii argument echo "*** Testing chr() function: with unexpected inputs for 'ascii' argument ***\n"; -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - //defining a class class sample { public function __toString() { @@ -38,16 +34,6 @@ $inputs = array ( false, TRUE, FALSE, - - // null values -/*15*/ NULL, - null, - - // undefined variable -/*19*/ @$undefined_var, - - // unset variable -/*20*/ @$unset_var ); // loop through with each element of the $inputs array to test chr() function @@ -85,11 +71,3 @@ string(2) "00" string(2) "01" -- Iteration 11 -- string(2) "00" --- Iteration 12 -- -string(2) "00" --- Iteration 13 -- -string(2) "00" --- Iteration 14 -- -string(2) "00" --- Iteration 15 -- -string(2) "00" diff --git a/ext/standard/tests/strings/dirname_variation.phpt b/ext/standard/tests/strings/dirname_variation.phpt index 5b8e22f5ae..96140b755e 100644 --- a/ext/standard/tests/strings/dirname_variation.phpt +++ b/ext/standard/tests/strings/dirname_variation.phpt @@ -43,8 +43,6 @@ $file_path_variations = array ( /* empty path */ "", '', - NULL, - null ); function check_dirname( $paths ) { @@ -131,10 +129,4 @@ string\(0\) "" --Iteration 22 -- string\(0\) "" - ---Iteration 23 -- -string\(0\) "" - ---Iteration 24 -- -string\(0\) "" Done diff --git a/ext/standard/tests/strings/html_entity_decode3.phpt b/ext/standard/tests/strings/html_entity_decode3.phpt index e8372ed4f8..6b5efd8f04 100644 --- a/ext/standard/tests/strings/html_entity_decode3.phpt +++ b/ext/standard/tests/strings/html_entity_decode3.phpt @@ -218,7 +218,7 @@ echo "\nDone.\n";  NOT DECODED  NOT DECODED   DECODED -' NOT DECODED +' DECODED  NOT DECODED € NOT DECODED Ÿ NOT DECODED diff --git a/ext/standard/tests/strings/htmlentities24.phpt b/ext/standard/tests/strings/htmlentities24.phpt index 2a04bd345e..8754257d7f 100644 --- a/ext/standard/tests/strings/htmlentities24.phpt +++ b/ext/standard/tests/strings/htmlentities24.phpt @@ -13,11 +13,9 @@ for($i=0; $i<256; $i++) /* giving arguments as NULL */ echo "\n*** Testing htmlentities() with NULL as first,second and third argument ***\n"; -var_dump( htmlentities("\x82\x86\x99\x9f\x80\x82\x81", NULL, 'cp1252') ); var_dump( htmlentities("\x82\x86\x99\x9f\x80\x82\x81", ENT_QUOTES, NULL) ); /* UTF-8 assumed */ var_dump( htmlentities("\x82\x86\x99\x9f\x80\x82\x81", ENT_NOQUOTES, NULL) ); /* UTF-8 assumed */ var_dump( htmlentities("\x82\x86\x99\x9f\x80\x82\x81", ENT_COMPAT, NULL) ); /* UTF-8 assumed */ -var_dump( htmlentities(NULL, NULL, NULL) ); /* giving long string to check for proper memory re-allocation */ echo "\n*** Checking for proper memory allocation with long string ***\n"; @@ -297,8 +295,6 @@ string(16) "6368722832353429" string(16) "6368722832353529" *** Testing htmlentities() with NULL as first,second and third argument *** -string(42) "‚†™Ÿ€‚" -string(0) "" string(0) "" string(0) "" string(0) "" @@ -310,7 +306,7 @@ string(198) "‚†™Ÿ€‚†„€&perm string(42) "<html> This is a test! </html>" *** Testing htmlentites() on a quote *** -string(36) "A 'quote' is <b>bold</b>" +string(46) "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>" diff --git a/ext/standard/tests/strings/htmlspecialchars.phpt b/ext/standard/tests/strings/htmlspecialchars.phpt index 095225f534..775cb2f4d4 100644 --- a/ext/standard/tests/strings/htmlspecialchars.phpt +++ b/ext/standard/tests/strings/htmlspecialchars.phpt @@ -9,11 +9,9 @@ var_dump( bin2hex( htmlspecialchars("chr($i)") ) ); /* giving NULL as the argument */ echo "\n*** Testing htmlspecialchars() with NULL as first, second and third argument ***\n"; -var_dump( htmlspecialchars("<br>", NULL, 'iso-8859-1') ); var_dump( htmlspecialchars("<br>", ENT_NOQUOTES, NULL) ); var_dump( htmlspecialchars("<br>", ENT_QUOTES, NULL) ); var_dump( htmlspecialchars("<br>", ENT_COMPAT, NULL) ); -var_dump( htmlspecialchars(NULL, NULL, NULL) ); /* giving long string to check for proper memory re-allocation */ echo "\n*** Checking a long string for proper memory allocation ***\n"; @@ -296,8 +294,6 @@ string(16) "6368722832353529" string(10) "<br>" string(10) "<br>" string(10) "<br>" -string(10) "<br>" -string(0) "" *** Checking a long string for proper memory allocation *** string(187) "<br>Testing<p>New file.</p><p><br>File <b><i><u>WORKS!!!</i></u></b></p><br><p>End of file!!!</p>" @@ -306,7 +302,7 @@ string(187) "<br>Testing<p>New file.</p><p><br>Fil string(46) "<br>Testing<p>New file.</p> " *** Testing htmlspecialchars() on a quote... -string(36) "A 'quote' is <b>bold</b>" +string(46) "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>" diff --git a/ext/standard/tests/strings/htmlspecialchars_basic.phpt b/ext/standard/tests/strings/htmlspecialchars_basic.phpt index 578814beff..c86692aa3b 100644 --- a/ext/standard/tests/strings/htmlspecialchars_basic.phpt +++ b/ext/standard/tests/strings/htmlspecialchars_basic.phpt @@ -56,7 +56,7 @@ Basic tests Test 1: abc<>"& Test 2: &&abc<>"& Test 3: a>,\<bc<>"& -Test 4: a\'\'&bc<>"& +Test 4: a\'\'&bc<>"& Test 5: &amp;&lt; Test 6: abc<>"& Test 7: &&abc<>"& diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt index d3e3166fb9..ad9df68f05 100644 --- a/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt +++ b/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt @@ -26,8 +26,8 @@ echo "Done"; ?> --EXPECT-- *** Testing htmlspecialchars_decode() : basic functionality *** -string(92) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" -string(92) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" string(92) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" string(92) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" string(102) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt index 93058d1853..98d4684d63 100644 --- a/ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt +++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt @@ -73,12 +73,12 @@ string(0) "" -- Iteration 2 -- string(0) "" -- Iteration 3 -- -string(103) "<html>Roy's height > Sam's height +string(93) "<html>Roy's height > Sam's height 13 < 25 1111 & 0000 = 0000 "This is a double quoted string"" -- Iteration 4 -- -string(130) "<html>Roy's height
> Sam 's height +string(120) "<html>Roy's height
> Sam 's height 1111 & 0000 = 0000 " heredoc double quoted string. withdifferentwhitespaces"" @@ -87,8 +87,8 @@ string(62) "<html>11 < 12. 123 string 4567 "string" 1111 & 0000 = 0000 ;" -- Iteration 6 -- -string(153) "<html>< This's a string with quotes: +string(143) "<html>< This's a string with quotes: "strings in double quote" & 'strings in single quote' " -this\line is 'single quoted' /with\slashes </html>" +this\line is 'single quoted' /with\slashes </html>" Done diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt index bdbddcf8a9..00d4e9a143 100644 --- a/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt +++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt @@ -33,22 +33,22 @@ echo "Done"; --EXPECT-- *** Testing htmlspecialchars_decode() : usage variations *** -- Iteration 1 -- -string(90) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" +string(85) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" string(90) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" string(100) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" string(85) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" -- Iteration 2 -- -string(88) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" +string(78) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" string(88) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" string(98) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" string(78) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" -- Iteration 3 -- -string(48) "\nRoy's height >\t; Sam's\v height\f" +string(38) "\nRoy's height >\t; Sam's\v height\f" string(48) "\nRoy's height >\t; Sam's\v height\f" string(48) "\nRoy's height >\t; Sam's\v height\f" string(38) "\nRoy's height >\t; Sam's\v height\f" -- Iteration 4 -- -string(48) "\r\tRoy's height >\r; Sam\t's height" +string(38) "\r\tRoy's height >\r; Sam\t's height" string(48) "\r\tRoy's height >\r; Sam\t's height" string(48) "\r\tRoy's height >\r; Sam\t's height" string(38) "\r\tRoy's height >\r; Sam\t's height" diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt index 9937ca9b54..3f235944eb 100644 --- a/ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt +++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt @@ -32,12 +32,12 @@ echo "Done"; --EXPECT-- *** Testing htmlspecialchars_decode() : usage variations *** -- Iteration 1 -- -string(89) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" +string(84) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" string(89) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" string(99) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" string(84) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" -- Iteration 2 -- -string(82) "Roy's height > Sam's height... 13 < 15... +string(72) "Roy's height > Sam's height... 13 < 15...
" double quote string "" string(82) "Roy's height > Sam's height... 13 < 15...
" double quote string "" @@ -46,8 +46,8 @@ string(92) "Roy's height > Sam's height... 13 < 15... string(72) "Roy's height > Sam's height... 13 < 15...
" double quote string "" -- Iteration 3 -- -string(44) " -Roy's height > ; Sam's height" +string(34) " +Roy's height > ; Sam's height" string(44) " Roy's height > ; Sam's height" string(44) " @@ -55,7 +55,7 @@ Roy's height > ; Sam's height" string(34) " Roy's height > ; Sam's height" -- Iteration 4 -- -string(44) "
Roy's height >
; Sam 's height" +string(34) "
Roy's height >
; Sam 's height" string(44) "
Roy's height >
; Sam 's height" string(44) "
Roy's height >
; Sam 's height" string(34) "
Roy's height >
; Sam 's height" diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt Binary files differindex c1c1599eb7..ca12110211 100644 --- a/ext/standard/tests/strings/implode1.phpt +++ b/ext/standard/tests/strings/implode1.phpt diff --git a/ext/standard/tests/strings/join_basic.phpt b/ext/standard/tests/strings/join_basic.phpt index 8e8c554ee9..129f75bc79 100644 --- a/ext/standard/tests/strings/join_basic.phpt +++ b/ext/standard/tests/strings/join_basic.phpt @@ -16,12 +16,12 @@ $glue = ", "; // multiple car as glue $pieces = array("Red", "Green", "Blue", "Black", "White"); var_dump( join($glue, $pieces) ); -// pices as associative array (numeric values) +// pieces as associative array (numeric values) $pieces = array("Hour" => 10, "Minute" => 20, "Second" => 40); $glue = ':'; var_dump( join($glue, $pieces) ); -// pices as associative array (string/numeric values) +// pieces as associative array (string/numeric values) $pieces = array("Day" => 'Friday', "Month" => "September", "Year" => 2007); $glue = '/'; var_dump( join($glue, $pieces) ); diff --git a/ext/standard/tests/strings/join_variation1.phpt b/ext/standard/tests/strings/join_variation1.phpt index 7a806349ce..256f361460 100644 --- a/ext/standard/tests/strings/join_variation1.phpt +++ b/ext/standard/tests/strings/join_variation1.phpt @@ -10,10 +10,6 @@ echo "*** Testing join() : usage variations ***\n"; // initialize all required variables $pieces = array("element1", "element2"); -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - // get a resource variable $fp = fopen(__FILE__, "r"); @@ -62,18 +58,8 @@ $values = array ( "", '', - // null values - NULL, - null, - // resource variable $fp, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var ); @@ -143,13 +129,5 @@ string(16) "element1element2" -- Iteration 21 -- string(16) "element1element2" -- Iteration 22 -- -string(16) "element1element2" --- Iteration 23 -- -string(16) "element1element2" --- Iteration 24 -- join(): Argument #1 ($separator) must be of type array|string, resource given --- Iteration 25 -- -string(16) "element1element2" --- Iteration 26 -- -string(16) "element1element2" Done diff --git a/ext/standard/tests/strings/join_variation4.phpt b/ext/standard/tests/strings/join_variation4.phpt Binary files differindex 8c8c8b9092..314345547c 100644 --- a/ext/standard/tests/strings/join_variation4.phpt +++ b/ext/standard/tests/strings/join_variation4.phpt diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt Binary files differindex 359d210e74..fc0b954199 100644 --- a/ext/standard/tests/strings/lcfirst.phpt +++ b/ext/standard/tests/strings/lcfirst.phpt diff --git a/ext/standard/tests/strings/ltrim.phpt b/ext/standard/tests/strings/ltrim.phpt index 8ac57ca92e..952ad282c6 100644 --- a/ext/standard/tests/strings/ltrim.phpt +++ b/ext/standard/tests/strings/ltrim.phpt @@ -23,7 +23,6 @@ var_dump( ltrim($str, "\nusi") ); echo "\n *** Output for Normal Behaviour ***\n"; var_dump ( ltrim(" \t\0 ltrim test") ); /* without second Argument */ var_dump ( ltrim(" ltrim test" , "") ); /* no characters in second Argument */ - var_dump ( ltrim(" ltrim test", NULL) ); /* with NULL as second Argument */ var_dump ( ltrim(" ltrim test", true) ); /* with boolean value as second Argument */ var_dump ( ltrim(" ltrim test", " ") ); /* with single space as second Argument */ var_dump ( ltrim("\t\n\r\0\x0B ltrim test", "\t\n\r\0\x0B") ); /* with multiple escape sequences as second Argument */ @@ -32,11 +31,8 @@ var_dump( ltrim($str, "\nusi") ); var_dump ( ltrim("@$#ltrim test", "#@$") ); /* with some special characters as second Argument */ - echo "\n *** Output for scalar argument) ***\n"; - var_dump( ltrim( 12345 ) ); /* Scalar argument */ - - echo "\n *** Output for NULL argument) ***\n"; - var_dump( ltrim(NULL) ); /* NULL Argument */ +echo "\n *** Output for scalar argument) ***\n"; +var_dump( ltrim( 12345 ) ); /* Scalar argument */ echo "\nDone\n"; @@ -51,7 +47,6 @@ string(17) "ng heredoc string" string(10) "ltrim test" string(13) " ltrim test" string(18) " ltrim test" -string(18) " ltrim test" string(10) "ltrim test" string(11) " ltrim test" string(10) "ltrim test" @@ -61,7 +56,4 @@ string(10) "ltrim test" *** Output for scalar argument) *** string(5) "12345" - *** Output for NULL argument) *** -string(0) "" - Done diff --git a/ext/standard/tests/strings/md5_file.phpt b/ext/standard/tests/strings/md5_file.phpt Binary files differindex 26eb03bc5a..c975c85cb7 100644 --- a/ext/standard/tests/strings/md5_file.phpt +++ b/ext/standard/tests/strings/md5_file.phpt diff --git a/ext/standard/tests/strings/nl2br.phpt b/ext/standard/tests/strings/nl2br.phpt index b2ff9cf090..c90788fd66 100644 --- a/ext/standard/tests/strings/nl2br.phpt +++ b/ext/standard/tests/strings/nl2br.phpt @@ -4,7 +4,6 @@ nl2br() function <?php var_dump(nl2br("test")); var_dump(nl2br("")); - var_dump(nl2br(NULL)); var_dump(nl2br("\r\n")); var_dump(nl2br("\n")); var_dump(nl2br("\r")); @@ -18,7 +17,6 @@ nl2br() function --EXPECT-- string(4) "test" string(0) "" -string(0) "" string(8) "<br /> " string(7) "<br /> diff --git a/ext/standard/tests/strings/number_format_basic.phpt b/ext/standard/tests/strings/number_format_basic.phpt index 2566f36574..2e54eb1f0d 100644 --- a/ext/standard/tests/strings/number_format_basic.phpt +++ b/ext/standard/tests/strings/number_format_basic.phpt @@ -13,7 +13,6 @@ $values = array(1234.5678, "123456789", "123.456789", "12.3456789e1", - null, true, false); @@ -54,7 +53,6 @@ string(11) "402,653,183" string(11) "123,456,789" string(3) "123" string(3) "123" -string(1) "0" string(1) "1" string(1) "0" @@ -68,7 +66,6 @@ string(14) "402,653,183.00" string(14) "123,456,789.00" string(6) "123.46" string(6) "123.46" -string(4) "0.00" string(4) "1.00" string(4) "0.00" @@ -82,7 +79,6 @@ string(14) "402 653 183.00" string(14) "123 456 789.00" string(6) "123.46" string(6) "123.46" -string(4) "0.00" string(4) "1.00" string(4) "0.00" @@ -96,6 +92,5 @@ string(14) "402 653 183,00" string(14) "123 456 789,00" string(6) "123,46" string(6) "123,46" -string(4) "0,00" string(4) "1,00" string(4) "0,00" diff --git a/ext/standard/tests/strings/printf.phpt b/ext/standard/tests/strings/printf.phpt index db47f58c53..8ff95eb5d6 100644 --- a/ext/standard/tests/strings/printf.phpt +++ b/ext/standard/tests/strings/printf.phpt @@ -50,11 +50,6 @@ try { echo "\n*** Output for scalar argument ***\n"; printf(3); -/* NULL argument */ -echo "\n*** Output for NULL as argument ***\n"; -printf(NULL); - - /* Float type variations */ $counter = 1; @@ -244,8 +239,6 @@ printf() expects at least %d argument, %d given Error found: 5 arguments are required, 3 given *** Output for scalar argument *** 3 -*** Output for NULL as argument *** - *** Output for float type *** diff --git a/ext/standard/tests/strings/printf_64bit.phpt b/ext/standard/tests/strings/printf_64bit.phpt index 2886799cc7..a37ad49c3d 100644 --- a/ext/standard/tests/strings/printf_64bit.phpt +++ b/ext/standard/tests/strings/printf_64bit.phpt @@ -50,11 +50,6 @@ try { echo "\n*** Output for scalar argument ***\n"; printf(3); -/* NULL argument */ -echo "\n*** Output for NULL as argument ***\n"; -printf(NULL); - - /* Float type variations */ $counter = 1; @@ -244,8 +239,6 @@ printf() expects at least 1 argument, 0 given Error found: 5 arguments are required, 3 given *** Output for scalar argument *** 3 -*** Output for NULL as argument *** - *** Output for float type *** diff --git a/ext/standard/tests/strings/printf_variation1.phpt b/ext/standard/tests/strings/printf_variation1.phpt deleted file mode 100644 index 55237168c5..0000000000 --- a/ext/standard/tests/strings/printf_variation1.phpt +++ /dev/null @@ -1,311 +0,0 @@ ---TEST-- -Test printf() function : usage variations - unexpected values for format argument ---FILE-- -<?php -/* -* Testing printf() : with different unexpected values for format argument other than the strings -*/ - -echo "*** Testing printf() : with unexpected values for format argument ***\n"; - -// initialing required variables -$arg1 = "second arg"; -$arg2 = "third arg"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring class -class sample -{ - public function __toString() { - return "Object"; - } -} - -// creating a file resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data -/*10*/ array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*15*/ NULL, - null, - - // boolean data -/*17*/ true, - false, - TRUE, - FALSE, - - // empty data -/*21*/ "", - '', - - // object data -/*23*/ new sample(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource data -/*26*/ $file_handle -); - -// loop through each element of the array for format - -$count = 1; -foreach($values as $value) { - echo "\n-- Iteration $count --\n"; - - // with default argument - try { - $result = printf($value); - echo "\n"; - var_dump($result); - } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; - } - - // with two arguments - try { - $result = printf($value, $arg1); - echo "\n"; - var_dump($result); - } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; - } - - // with three arguments - try { - $result = printf($value, $arg1, $arg2); - echo "\n"; - var_dump($result); - } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; - } - - $count++; -}; - -// close the resource -fclose($file_handle); - -?> ---EXPECT-- -*** Testing printf() : with unexpected values for format argument *** - --- Iteration 1 -- -0 -int(1) -0 -int(1) -0 -int(1) - --- Iteration 2 -- -1 -int(1) -1 -int(1) -1 -int(1) - --- Iteration 3 -- -12345 -int(5) -12345 -int(5) -12345 -int(5) - --- Iteration 4 -- --2345 -int(5) --2345 -int(5) --2345 -int(5) - --- Iteration 5 -- -10.5 -int(4) -10.5 -int(4) -10.5 -int(4) - --- Iteration 6 -- --10.5 -int(5) --10.5 -int(5) --10.5 -int(5) - --- Iteration 7 -- -101234567000 -int(12) -101234567000 -int(12) -101234567000 -int(12) - --- Iteration 8 -- -1.07654321E-9 -int(13) -1.07654321E-9 -int(13) -1.07654321E-9 -int(13) - --- Iteration 9 -- -0.5 -int(3) -0.5 -int(3) -0.5 -int(3) - --- Iteration 10 -- -printf(): Argument #1 ($format) must be of type string, array given -printf(): Argument #1 ($format) must be of type string, array given -printf(): Argument #1 ($format) must be of type string, array given - --- Iteration 11 -- -printf(): Argument #1 ($format) must be of type string, array given -printf(): Argument #1 ($format) must be of type string, array given -printf(): Argument #1 ($format) must be of type string, array given - --- Iteration 12 -- -printf(): Argument #1 ($format) must be of type string, array given -printf(): Argument #1 ($format) must be of type string, array given -printf(): Argument #1 ($format) must be of type string, array given - --- Iteration 13 -- -printf(): Argument #1 ($format) must be of type string, array given -printf(): Argument #1 ($format) must be of type string, array given -printf(): Argument #1 ($format) must be of type string, array given - --- Iteration 14 -- -printf(): Argument #1 ($format) must be of type string, array given -printf(): Argument #1 ($format) must be of type string, array given -printf(): Argument #1 ($format) must be of type string, array given - --- Iteration 15 -- - -int(0) - -int(0) - -int(0) - --- Iteration 16 -- - -int(0) - -int(0) - -int(0) - --- Iteration 17 -- -1 -int(1) -1 -int(1) -1 -int(1) - --- Iteration 18 -- - -int(0) - -int(0) - -int(0) - --- Iteration 19 -- -1 -int(1) -1 -int(1) -1 -int(1) - --- Iteration 20 -- - -int(0) - -int(0) - -int(0) - --- Iteration 21 -- - -int(0) - -int(0) - -int(0) - --- Iteration 22 -- - -int(0) - -int(0) - -int(0) - --- Iteration 23 -- -Object -int(6) -Object -int(6) -Object -int(6) - --- Iteration 24 -- - -int(0) - -int(0) - -int(0) - --- Iteration 25 -- - -int(0) - -int(0) - -int(0) - --- Iteration 26 -- -printf(): Argument #1 ($format) must be of type string, resource given -printf(): Argument #1 ($format) must be of type string, resource given -printf(): Argument #1 ($format) must be of type string, resource given diff --git a/ext/standard/tests/strings/quoted_printable_encode_001.phpt b/ext/standard/tests/strings/quoted_printable_encode_001.phpt index df26d5cf4b..a1e0ec1338 100644 --- a/ext/standard/tests/strings/quoted_printable_encode_001.phpt +++ b/ext/standard/tests/strings/quoted_printable_encode_001.phpt @@ -7,7 +7,6 @@ var_dump(quoted_printable_encode("")); var_dump(quoted_printable_encode("test")); var_dump(quoted_printable_encode(1)); -var_dump(quoted_printable_encode(NULL)); var_dump(quoted_printable_encode(false)); echo "Done\n"; @@ -17,5 +16,4 @@ string(0) "" string(4) "test" string(1) "1" string(0) "" -string(0) "" Done diff --git a/ext/standard/tests/strings/rtrim.phpt b/ext/standard/tests/strings/rtrim.phpt Binary files differindex 2fc531faad..b4cd2ac6ac 100644 --- a/ext/standard/tests/strings/rtrim.phpt +++ b/ext/standard/tests/strings/rtrim.phpt diff --git a/ext/standard/tests/strings/sha1_file.phpt b/ext/standard/tests/strings/sha1_file.phpt index 55130cb98a..62419d708f 100644 --- a/ext/standard/tests/strings/sha1_file.phpt +++ b/ext/standard/tests/strings/sha1_file.phpt @@ -87,6 +87,8 @@ Warning: sha1_file(12): Failed to open stream: No such file or directory in %s o bool(false) -- NULL as filename -- + +Deprecated: sha1_file(): Passing null to parameter #1 ($filename) of type string is deprecated in %s on line %d Path cannot be empty -- Hexadecimal Output for Empty file as Argument -- diff --git a/ext/standard/tests/strings/sprintf_variation1.phpt b/ext/standard/tests/strings/sprintf_variation1.phpt index a75e67b96e..6b9430e386 100644 --- a/ext/standard/tests/strings/sprintf_variation1.phpt +++ b/ext/standard/tests/strings/sprintf_variation1.phpt @@ -12,10 +12,6 @@ echo "*** Testing sprintf() : with unexpected values for format argument ***\n"; $arg1 = "second arg"; $arg2 = "third arg"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - // declaring class class sample { @@ -50,10 +46,6 @@ $values = array( array(1, 2), array('color' => 'red', 'item' => 'pen'), - // null data - NULL, - null, - // boolean data true, false, @@ -67,12 +59,6 @@ $values = array( // object data new sample(), - // undefined data - @$undefined_var, - - // unset data - @$unset_var, - // resource data $file_handle ); @@ -186,9 +172,9 @@ sprintf(): Argument #1 ($format) must be of type string, array given sprintf(): Argument #1 ($format) must be of type string, array given -- Iteration 15 -- -string(0) "" -string(0) "" -string(0) "" +string(1) "1" +string(1) "1" +string(1) "1" -- Iteration 16 -- string(0) "" @@ -206,41 +192,21 @@ string(0) "" string(0) "" -- Iteration 19 -- -string(1) "1" -string(1) "1" -string(1) "1" - --- Iteration 20 -- -string(0) "" -string(0) "" -string(0) "" - --- Iteration 21 -- string(0) "" string(0) "" string(0) "" --- Iteration 22 -- +-- Iteration 20 -- string(0) "" string(0) "" string(0) "" --- Iteration 23 -- +-- Iteration 21 -- string(6) "Object" string(6) "Object" string(6) "Object" --- Iteration 24 -- -string(0) "" -string(0) "" -string(0) "" - --- Iteration 25 -- -string(0) "" -string(0) "" -string(0) "" - --- Iteration 26 -- +-- Iteration 22 -- sprintf(): Argument #1 ($format) must be of type string, resource given sprintf(): Argument #1 ($format) must be of type string, resource given sprintf(): Argument #1 ($format) must be of type string, resource given diff --git a/ext/standard/tests/strings/str_getcsv_001.phpt b/ext/standard/tests/strings/str_getcsv_001.phpt index becff2163b..8bad30b2be 100644 --- a/ext/standard/tests/strings/str_getcsv_001.phpt +++ b/ext/standard/tests/strings/str_getcsv_001.phpt @@ -24,8 +24,6 @@ var_dump(str_getcsv('.foo . . bar .', ' ', '.', '')); print "-----\n"; var_dump(str_getcsv('" "" "', ' ')); print "-----\n"; -var_dump(str_getcsv(NULL)); -print "-----\n"; var_dump(str_getcsv('')); print "-----\n"; @@ -108,8 +106,3 @@ array(1) { NULL } ----- -array(1) { - [0]=> - NULL -} ------ diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt index bcb03237c0..278db455f8 100644 --- a/ext/standard/tests/strings/str_pad.phpt +++ b/ext/standard/tests/strings/str_pad.phpt @@ -21,7 +21,6 @@ echo "\n#### variations with input string and pad-length ####\n"; $input_strings = array( "variation", // normal string "", // empty string - NULL, // NULL true, // boolean 15, // numeric 15.55, // numeric @@ -63,13 +62,7 @@ foreach ( $pad_strings as $pad_string ) { echo "\n#### error conditions ####\n"; -echo "\n--- padding string as null ---\n"; - -try { - str_pad($input_string, 12, NULL); -} catch (\ValueError $e) { - echo $e->getMessage() . "\n"; -} +echo "\n--- empty padding string ---\n"; try { str_pad($input_string, 12, ""); @@ -155,36 +148,6 @@ string(16) "================" string(16) "================" string(16) "================" string(16) "================" -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(0) "" -string(9) " " -string(9) "=========" -string(9) "=========" -string(9) "=========" -string(9) "=========" -string(10) " " -string(10) "==========" -string(10) "==========" -string(10) "==========" -string(10) "==========" -string(16) " " -string(16) "================" -string(16) "================" -string(16) "================" -string(16) "================" string(1) "1" string(1) "1" string(1) "1" @@ -338,7 +301,6 @@ string(16) "\t\variation\t\t" #### error conditions #### ---- padding string as null --- -str_pad(): Argument #3 ($pad_string) must be a non-empty string +--- empty padding string --- str_pad(): Argument #3 ($pad_string) must be a non-empty string str_pad(): Argument #4 ($pad_type) must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH diff --git a/ext/standard/tests/strings/str_repeat.phpt b/ext/standard/tests/strings/str_repeat.phpt Binary files differindex 3069f6bfe9..6eef67ae57 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_replace_variation1.phpt b/ext/standard/tests/strings/str_replace_variation1.phpt index aa7360a7f1..00ed1a8bab 100644 --- a/ext/standard/tests/strings/str_replace_variation1.phpt +++ b/ext/standard/tests/strings/str_replace_variation1.phpt @@ -271,6 +271,8 @@ int(2) -- Iteration 8 -- +Deprecated: str_replace(): Passing null to parameter #1 ($search) of type array|string is deprecated in %s on line %d + Warning: Array to string conversion in %s on line %d array(12) { [0]=> diff --git a/ext/standard/tests/strings/str_replace_variation2.phpt b/ext/standard/tests/strings/str_replace_variation2.phpt Binary files differindex 1e92ff2bd2..77dc6ae822 100644 --- a/ext/standard/tests/strings/str_replace_variation2.phpt +++ b/ext/standard/tests/strings/str_replace_variation2.phpt diff --git a/ext/standard/tests/strings/str_word_count.phpt b/ext/standard/tests/strings/str_word_count.phpt index deb9fe986d..a8c2af9255 100644 --- a/ext/standard/tests/strings/str_word_count.phpt +++ b/ext/standard/tests/strings/str_word_count.phpt @@ -36,10 +36,10 @@ try { 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, "")); +var_dump(str_word_count($str2, 0, "04")); +var_dump(str_word_count($str2, 0, "01")); +var_dump(str_word_count($str2, 0, "014")); +var_dump(str_word_count($str2, 0, "")); var_dump(str_word_count($str2, 1, "04")); var_dump(str_word_count($str2, 1, "01")); var_dump(str_word_count($str2, 1, "014")); diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt Binary files differindex 95a25bd699..3c07539bd5 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 824d7ed101..d5f338844e 100644 --- a/ext/standard/tests/strings/strcmp.phpt +++ b/ext/standard/tests/strings/strcmp.phpt diff --git a/ext/standard/tests/strings/stripos_variation1.phpt b/ext/standard/tests/strings/stripos_variation1.phpt index 47a0b10b5e..e205913fcf 100644 --- a/ext/standard/tests/strings/stripos_variation1.phpt +++ b/ext/standard/tests/strings/stripos_variation1.phpt @@ -24,8 +24,6 @@ $needle = array( //nulls "\0", - NULL, - null, //boolean false FALSE, @@ -121,93 +119,87 @@ int(12) int(0) int(13) -- Iteration 15 -- -int(0) -int(14) --- Iteration 16 -- -int(0) -int(15) --- Iteration 17 -- int(10) int(47) --- Iteration 18 -- +-- Iteration 16 -- int(12) bool(false) --- Iteration 19 -- +-- Iteration 17 -- int(11) bool(false) --- Iteration 20 -- +-- Iteration 18 -- int(13) bool(false) --- Iteration 21 -- +-- Iteration 19 -- int(14) bool(false) --- Iteration 22 -- +-- Iteration 20 -- int(16) bool(false) --- Iteration 23 -- +-- Iteration 21 -- int(17) bool(false) --- Iteration 24 -- +-- Iteration 22 -- int(20) bool(false) --- Iteration 25 -- +-- Iteration 23 -- int(22) -bool(false) --- Iteration 26 -- +int(22) +-- Iteration 24 -- int(23) -bool(false) --- Iteration 27 -- +int(23) +-- Iteration 25 -- int(24) -bool(false) --- Iteration 28 -- +int(24) +-- Iteration 26 -- int(25) -bool(false) --- Iteration 29 -- +int(25) +-- Iteration 27 -- bool(false) bool(false) --- Iteration 30 -- +-- Iteration 28 -- int(27) -bool(false) --- Iteration 31 -- +int(27) +-- Iteration 29 -- int(28) -bool(false) --- Iteration 32 -- +int(28) +-- Iteration 30 -- int(29) -bool(false) --- Iteration 33 -- +int(29) +-- Iteration 31 -- int(31) -bool(false) --- Iteration 34 -- +int(31) +-- Iteration 32 -- int(30) bool(false) --- Iteration 35 -- +-- Iteration 33 -- int(32) -bool(false) --- Iteration 36 -- +int(32) +-- Iteration 34 -- int(33) -bool(false) --- Iteration 37 -- +int(33) +-- Iteration 35 -- int(33) bool(false) --- Iteration 38 -- +-- Iteration 36 -- int(39) int(39) --- Iteration 39 -- +-- Iteration 37 -- int(15) int(48) --- Iteration 40 -- +-- Iteration 38 -- int(15) int(48) --- Iteration 41 -- +-- Iteration 39 -- int(51) int(51) --- Iteration 42 -- +-- Iteration 40 -- int(51) int(51) --- Iteration 43 -- +-- Iteration 41 -- bool(false) bool(false) --- Iteration 44 -- +-- Iteration 42 -- int(0) bool(false) *** Done *** diff --git a/ext/standard/tests/strings/stripos_variation10.phpt b/ext/standard/tests/strings/stripos_variation10.phpt deleted file mode 100644 index 156023c728..0000000000 --- a/ext/standard/tests/strings/stripos_variation10.phpt +++ /dev/null @@ -1,173 +0,0 @@ ---TEST-- -Test stripos() function : usage variations - unexpected inputs for 'needle' argument ---FILE-- -<?php -/* Test stripos() function with unexpected inputs for 'needle' and - * an expected type of input for 'haystack' argument -*/ - -echo "*** Testing stripos() function with unexpected values for needle ***\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"); - -$haystack = "string 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource"; - -// array with different values -$needles = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-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 'needle' array to check the working of stripos() -$counter = 1; -for($index = 0; $index < count($needles); $index ++) { - echo "\n-- Iteration $counter --\n"; - try { - var_dump( stripos($haystack, $needles[$index]) ); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - $counter ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***"; -?> ---EXPECT-- -*** Testing stripos() function with unexpected values for needle *** - --- Iteration 1 -- -int(7) - --- Iteration 2 -- -int(9) - --- Iteration 3 -- -bool(false) - --- Iteration 4 -- -bool(false) - --- Iteration 5 -- -int(16) - --- Iteration 6 -- -int(21) - --- Iteration 7 -- -bool(false) - --- Iteration 8 -- -bool(false) - --- Iteration 9 -- -int(17) - --- Iteration 10 -- -stripos(): Argument #2 ($needle) must be of type string, array given - --- Iteration 11 -- -stripos(): Argument #2 ($needle) must be of type string, array given - --- Iteration 12 -- -stripos(): Argument #2 ($needle) must be of type string, array given - --- Iteration 13 -- -stripos(): Argument #2 ($needle) must be of type string, array given - --- Iteration 14 -- -stripos(): Argument #2 ($needle) must be of type string, array given - --- Iteration 15 -- -int(9) - --- Iteration 16 -- -int(0) - --- Iteration 17 -- -int(9) - --- Iteration 18 -- -int(0) - --- Iteration 19 -- -int(64) - --- Iteration 20 -- -int(0) - --- Iteration 21 -- -int(0) - --- Iteration 22 -- -int(0) - --- Iteration 23 -- -int(0) - --- Iteration 24 -- -stripos(): Argument #2 ($needle) must be of type string, resource given - --- Iteration 25 -- -int(0) - --- Iteration 26 -- -int(0) -*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation11.phpt b/ext/standard/tests/strings/stripos_variation11.phpt deleted file mode 100644 index 6d9df2bd2e..0000000000 --- a/ext/standard/tests/strings/stripos_variation11.phpt +++ /dev/null @@ -1,174 +0,0 @@ ---TEST-- -Test stripos() function : usage variations - unexpected inputs for 'haystack' and 'needle' arguments ---FILE-- -<?php -/* Test stripos() function with unexpected inputs for 'haystack' and 'needle' arguments */ - -echo "*** Testing stripos() function with unexpected values for haystack and needle ***\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 stripos() -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - $haystack = $values[$index]; - try { - var_dump( stripos($values[$index], $values[$index]) ); - } catch (Error $e) { - echo get_class($e) . ": " . $e->getMessage(), "\n"; - } - try { - var_dump( stripos($values[$index], $values[$index], 1) ); - } catch (Error $e) { - echo get_class($e) . ": " . $e->getMessage(), "\n"; - } - $counter ++; -} - -echo "*** Done ***"; -?> ---EXPECT-- -*** Testing stripos() function with unexpected values for haystack and needle *** --- Iteration 1 -- -int(0) -bool(false) --- Iteration 2 -- -int(0) -bool(false) --- Iteration 3 -- -int(0) -bool(false) --- Iteration 4 -- -int(0) -bool(false) --- Iteration 5 -- -int(0) -bool(false) --- Iteration 6 -- -int(0) -bool(false) --- Iteration 7 -- -int(0) -bool(false) --- Iteration 8 -- -int(0) -bool(false) --- Iteration 9 -- -int(0) -bool(false) --- Iteration 10 -- -TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given -TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given --- Iteration 11 -- -TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given -TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given --- Iteration 12 -- -TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given -TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given --- Iteration 13 -- -TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given -TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given --- Iteration 14 -- -TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given -TypeError: stripos(): Argument #1 ($haystack) must be of type string, array given --- Iteration 15 -- -int(0) -bool(false) --- Iteration 16 -- -int(0) -ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --- Iteration 17 -- -int(0) -bool(false) --- Iteration 18 -- -int(0) -ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --- Iteration 19 -- -int(0) -bool(false) --- Iteration 20 -- -int(0) -ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --- Iteration 21 -- -int(0) -ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --- Iteration 22 -- -int(0) -ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --- Iteration 23 -- -int(0) -ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --- Iteration 24 -- -TypeError: stripos(): Argument #1 ($haystack) must be of type string, resource given -TypeError: stripos(): Argument #1 ($haystack) must be of type string, resource given --- Iteration 25 -- -int(0) -ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --- Iteration 26 -- -int(0) -ValueError: stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) -*** Done *** diff --git a/ext/standard/tests/strings/stripos_variation2.phpt b/ext/standard/tests/strings/stripos_variation2.phpt index bc176eecfe..2f95822645 100644 --- a/ext/standard/tests/strings/stripos_variation2.phpt +++ b/ext/standard/tests/strings/stripos_variation2.phpt @@ -24,8 +24,6 @@ $needle = array( //nulls '\0', - NULL, - null, //boolean false FALSE, @@ -123,99 +121,93 @@ int(12) int(0) int(13) -- Iteration 15 -- -int(0) int(14) --- Iteration 16 -- -int(0) -int(15) --- Iteration 17 -- int(14) -int(51) --- Iteration 18 -- +-- Iteration 16 -- int(16) -bool(false) --- Iteration 19 -- +int(16) +-- Iteration 17 -- int(15) bool(false) --- Iteration 20 -- +-- Iteration 18 -- int(17) -bool(false) --- Iteration 21 -- +int(17) +-- Iteration 19 -- int(18) -bool(false) --- Iteration 22 -- +int(18) +-- Iteration 20 -- int(20) -bool(false) --- Iteration 23 -- +int(20) +-- Iteration 21 -- int(21) -bool(false) --- Iteration 24 -- +int(21) +-- Iteration 22 -- int(24) int(24) --- Iteration 25 -- +-- Iteration 23 -- int(26) int(26) --- Iteration 26 -- +-- Iteration 24 -- int(27) int(27) --- Iteration 27 -- +-- Iteration 25 -- int(28) int(28) --- Iteration 28 -- +-- Iteration 26 -- int(29) int(29) --- Iteration 29 -- +-- Iteration 27 -- bool(false) bool(false) --- Iteration 30 -- +-- Iteration 28 -- bool(false) bool(false) --- Iteration 31 -- +-- Iteration 29 -- int(31) int(31) --- Iteration 32 -- +-- Iteration 30 -- int(32) int(32) --- Iteration 33 -- +-- Iteration 31 -- int(33) int(33) --- Iteration 34 -- +-- Iteration 32 -- int(35) int(35) --- Iteration 35 -- +-- Iteration 33 -- int(34) int(34) --- Iteration 36 -- +-- Iteration 34 -- int(36) int(36) --- Iteration 37 -- +-- Iteration 35 -- int(37) int(37) --- Iteration 38 -- +-- Iteration 36 -- int(37) int(37) --- Iteration 39 -- +-- Iteration 37 -- int(43) int(43) --- Iteration 40 -- +-- Iteration 38 -- int(52) int(52) --- Iteration 41 -- +-- Iteration 39 -- int(19) bool(false) --- Iteration 42 -- +-- Iteration 40 -- int(58) int(58) --- Iteration 43 -- +-- Iteration 41 -- bool(false) bool(false) --- Iteration 44 -- +-- Iteration 42 -- bool(false) bool(false) --- Iteration 45 -- +-- Iteration 43 -- bool(false) bool(false) --- Iteration 46 -- +-- Iteration 44 -- int(0) bool(false) *** Done *** diff --git a/ext/standard/tests/strings/stripos_variation7.phpt b/ext/standard/tests/strings/stripos_variation7.phpt deleted file mode 100644 index b9aa7db118..0000000000 --- a/ext/standard/tests/strings/stripos_variation7.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -Test stripos() function : usage variations - empty heredoc string for 'haystack' argument ---FILE-- -<?php -/* Test stripos() function by passing empty heredoc string for haystack - * and with various needles & offsets -*/ - -echo "*** Testing stripos() function: with heredoc strings ***\n"; -echo "-- With empty heredoc string --\n"; -$empty_string = <<<EOD -EOD; -var_dump( stripos($empty_string, "") ); - -try { - stripos($empty_string, "", 1); -} catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; -} -var_dump( stripos($empty_string, FALSE) ); -var_dump( stripos($empty_string, NULL) ); - -echo "*** Done ***"; -?> ---EXPECT-- -*** Testing stripos() function: with heredoc strings *** --- With empty heredoc string -- -int(0) -stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) -int(0) -int(0) -*** Done *** diff --git a/ext/standard/tests/strings/stristr_variation2.phpt b/ext/standard/tests/strings/stristr_variation2.phpt index fdc48a0922..72d5a93df8 100644 --- a/ext/standard/tests/strings/stristr_variation2.phpt +++ b/ext/standard/tests/strings/stristr_variation2.phpt @@ -5,10 +5,6 @@ Test stristr() function : usage variations - test values for $needle argument echo "*** Testing stristr() function: with unexpected inputs for 'needle' argument ***\n"; -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - //defining a class class sample { public function __toString() { @@ -44,21 +40,11 @@ $inputs = array ( TRUE, FALSE, - // null values -/*15*/ NULL, - null, - // objects /*17*/ new sample(), // resource /*18*/ $file_handle, - - // undefined variable -/*19*/ @$undefined_var, - - // unset variable -/*20*/ @$unset_var ); //defining '$pad_length' argument @@ -110,14 +96,6 @@ bool(false) -- Iteration 14 -- string(11) "Hello World" -- Iteration 15 -- -string(11) "Hello World" --- Iteration 16 -- -string(11) "Hello World" --- Iteration 17 -- bool(false) --- Iteration 18 -- +-- Iteration 16 -- stristr(): Argument #2 ($needle) must be of type string, resource given --- Iteration 19 -- -string(11) "Hello World" --- Iteration 20 -- -string(11) "Hello World" diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt Binary files differindex 468dd9acfe..374001eed9 100644 --- a/ext/standard/tests/strings/strlen.phpt +++ b/ext/standard/tests/strings/strlen.phpt diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt Binary files differindex 135030544e..267bc590c5 100644 --- a/ext/standard/tests/strings/strpos.phpt +++ b/ext/standard/tests/strings/strpos.phpt diff --git a/ext/standard/tests/strings/strrchr_variation1.phpt b/ext/standard/tests/strings/strrchr_variation1.phpt Binary files differindex 9617f5fff2..a913a2045a 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 deleted file mode 100644 index 4f28ad4e6b..0000000000 --- a/ext/standard/tests/strings/strrchr_variation10.phpt +++ /dev/null @@ -1,185 +0,0 @@ ---TEST-- -Test strrchr() function : usage variations - unexpected inputs for needle ---FILE-- -<?php -/* Test strrchr() function: with unexpected inputs for needle - * and expected type for haystack -*/ - -echo "*** Testing strrchr() function with unexpected inputs for needle ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring a class -class sample { - public function __toString() { - return "object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -$haystacks = array ( - //integer numeric strings - "0", - "1", - "2", - "-2", - - //float numeric strings - "10.5", - "-10.5", - "10.5e10", - "10.6E-10", - ".5", - - //regular strings - "array", - "a", - "r", - "y", - "ay", - "true", - "false", - "TRUE", - "FALSE", - "NULL", - "null", - "object", - - //empty string - "", - '', - - //resource variable in string form - "\$file_handle", - - //undefined variable in string form - @"$undefined_var", - @"$unset_var" -); - -// array with different values -$needles = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // null values - NULL, - null, - - // objects - new sample(), - - // empty string - "", - '', - - // resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - -// loop through each element of the array and check the working of strrchr() -$count = 1; -for($index = 0; $index < count($haystacks); $index++) { - echo "-- Iteration $count --\n"; - try { - var_dump( strrchr($haystacks[$index], $needles[$index]) ); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - $count ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***"; -?> ---EXPECT-- -*** Testing strrchr() function with unexpected inputs for needle *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -bool(false) --- Iteration 4 -- -string(2) "-2" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(2) "10" --- Iteration 8 -- -string(2) "10" --- Iteration 9 -- -bool(false) --- Iteration 10 -- -strrchr(): Argument #2 ($needle) must be of type string, array given --- Iteration 11 -- -strrchr(): Argument #2 ($needle) must be of type string, array given --- Iteration 12 -- -strrchr(): Argument #2 ($needle) must be of type string, array given --- Iteration 13 -- -strrchr(): Argument #2 ($needle) must be of type string, array given --- Iteration 14 -- -strrchr(): Argument #2 ($needle) must be of type string, array given --- Iteration 15 -- -bool(false) --- Iteration 16 -- -bool(false) --- Iteration 17 -- -bool(false) --- Iteration 18 -- -bool(false) --- Iteration 19 -- -bool(false) --- Iteration 20 -- -bool(false) --- Iteration 21 -- -string(6) "object" --- Iteration 22 -- -bool(false) --- Iteration 23 -- -bool(false) --- Iteration 24 -- -strrchr(): Argument #2 ($needle) must be of type string, resource given --- Iteration 25 -- -bool(false) --- Iteration 26 -- -bool(false) -*** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation11.phpt b/ext/standard/tests/strings/strrchr_variation11.phpt deleted file mode 100644 index 287d81c11c..0000000000 --- a/ext/standard/tests/strings/strrchr_variation11.phpt +++ /dev/null @@ -1,144 +0,0 @@ ---TEST-- -Test strrchr() function : usage variations - unexpected inputs for haystack and needle ---FILE-- -<?php -/* Test strrchr() function with unexpected inputs for haystack and needle */ - -echo "*** Testing strrchr() function: with unexpected inputs for haystack and needle ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// declaring 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.1234567e10, - 10.7654321E-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 strrchr() -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - try { - var_dump( strrchr($values[$index], $values[$index]) ); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - $counter ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***"; -?> ---EXPECT-- -*** Testing strrchr() function: with unexpected inputs for haystack and needle *** --- Iteration 1 -- -string(1) "0" --- Iteration 2 -- -string(1) "1" --- Iteration 3 -- -string(5) "12345" --- Iteration 4 -- -string(5) "-2345" --- Iteration 5 -- -string(4) "10.5" --- Iteration 6 -- -string(5) "-10.5" --- Iteration 7 -- -string(10) "1234567000" --- Iteration 8 -- -string(4) "1E-9" --- Iteration 9 -- -string(3) "0.5" --- Iteration 10 -- -strrchr(): Argument #1 ($haystack) must be of type string, array given --- Iteration 11 -- -strrchr(): Argument #1 ($haystack) must be of type string, array given --- Iteration 12 -- -strrchr(): Argument #1 ($haystack) must be of type string, array given --- Iteration 13 -- -strrchr(): Argument #1 ($haystack) must be of type string, array given --- Iteration 14 -- -strrchr(): Argument #1 ($haystack) must be of type string, array given --- Iteration 15 -- -string(1) "1" --- Iteration 16 -- -bool(false) --- Iteration 17 -- -string(1) "1" --- Iteration 18 -- -bool(false) --- Iteration 19 -- -string(6) "object" --- Iteration 20 -- -bool(false) --- Iteration 21 -- -bool(false) --- Iteration 22 -- -bool(false) --- Iteration 23 -- -bool(false) --- Iteration 24 -- -strrchr(): Argument #1 ($haystack) must be of type string, resource given --- Iteration 25 -- -bool(false) --- Iteration 26 -- -bool(false) -*** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation12.phpt b/ext/standard/tests/strings/strrchr_variation12.phpt Binary files differindex 972ff3e703..abe5bfae65 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 72bb3fb0d3..646f13a702 100644 --- a/ext/standard/tests/strings/strrchr_variation2.phpt +++ b/ext/standard/tests/strings/strrchr_variation2.phpt @@ -24,8 +24,6 @@ $needle = array( //nulls '\0', - NULL, - null, //boolean false FALSE, @@ -121,95 +119,89 @@ bool(false) bool(false) -- Iteration 15 -- -bool(false) +string(1) " " -- Iteration 16 -- -bool(false) +string(47) "$&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 17 -- string(1) " " -- Iteration 18 -- -string(47) "$&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " +string(46) "&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 19 -- -string(1) " " +string(45) "!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 20 -- -string(46) "&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " +string(43) "%\o,()*+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 21 -- -string(45) "!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " +string(5) "\101 " -- Iteration 22 -- -string(43) "%\o,()*+-./:;<=>?@hello123456he \x234 \101 " +string(39) "()*+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 23 -- -string(5) "\101 " +string(37) "*+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 24 -- -string(39) "()*+-./:;<=>?@hello123456he \x234 \101 " +string(36) "+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 25 -- -string(37) "*+-./:;<=>?@hello123456he \x234 \101 " +string(35) "-./:;<=>?@hello123456he \x234 \101 " -- Iteration 26 -- -string(36) "+-./:;<=>?@hello123456he \x234 \101 " +string(34) "./:;<=>?@hello123456he \x234 \101 " -- Iteration 27 -- -string(35) "-./:;<=>?@hello123456he \x234 \101 " +string(34) "./:;<=>?@hello123456he \x234 \101 " -- Iteration 28 -- -string(34) "./:;<=>?@hello123456he \x234 \101 " +string(32) ":;<=>?@hello123456he \x234 \101 " -- Iteration 29 -- -string(34) "./:;<=>?@hello123456he \x234 \101 " +string(31) ";<=>?@hello123456he \x234 \101 " -- Iteration 30 -- -string(32) ":;<=>?@hello123456he \x234 \101 " +string(30) "<=>?@hello123456he \x234 \101 " -- Iteration 31 -- -string(31) ";<=>?@hello123456he \x234 \101 " +string(28) ">?@hello123456he \x234 \101 " -- Iteration 32 -- -string(30) "<=>?@hello123456he \x234 \101 " +string(29) "=>?@hello123456he \x234 \101 " -- Iteration 33 -- -string(28) ">?@hello123456he \x234 \101 " +string(27) "?@hello123456he \x234 \101 " -- Iteration 34 -- -string(29) "=>?@hello123456he \x234 \101 " +string(26) "@hello123456he \x234 \101 " -- Iteration 35 -- -string(27) "?@hello123456he \x234 \101 " +string(26) "@hello123456he \x234 \101 " -- Iteration 36 -- -string(26) "@hello123456he \x234 \101 " +string(2) "1 " -- Iteration 37 -- -string(26) "@hello123456he \x234 \101 " +string(5) "\101 " -- Iteration 38 -- -string(2) "1 " +string(44) "#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " -- Iteration 39 -- string(5) "\101 " -- Iteration 40 -- -string(44) "#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " - --- Iteration 41 -- -string(5) "\101 " - --- Iteration 42 -- bool(false) --- Iteration 43 -- +-- Iteration 41 -- string(7) "4 \101 " --- Iteration 44 -- +-- Iteration 42 -- string(7) "4 \101 " --- Iteration 45 -- +-- Iteration 43 -- string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " *** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation8.phpt b/ext/standard/tests/strings/strrchr_variation8.phpt deleted file mode 100644 index 826db29dfd..0000000000 --- a/ext/standard/tests/strings/strrchr_variation8.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Test strrchr() function : usage variations - empty heredoc string for 'haystack' ---FILE-- -<?php -/* Test strrchr() function by passing empty heredoc string for haystack - * and with various needles -*/ - -echo "*** Testing strrchr() function: with heredoc strings ***\n"; -$empty_str = <<<EOD -EOD; - -$needles = array( - "", - '', - FALSE, - NULL, - "\0", - $empty_str //needle as haystack -); - -//loop through to test strrchr() with each needle -foreach($needles as $needle) { - var_dump( strrchr($empty_str, $needle) ); -} -echo "*** Done ***"; -?> ---EXPECT-- -*** Testing strrchr() function: with heredoc strings *** -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) -*** Done *** diff --git a/ext/standard/tests/strings/strrev.phpt b/ext/standard/tests/strings/strrev.phpt index 6303fccc20..15cf248f55 100644 --- a/ext/standard/tests/strings/strrev.phpt +++ b/ext/standard/tests/strings/strrev.phpt @@ -2,18 +2,16 @@ strrev() function --FILE-- <?php - $i = 0; - $str = ''; +$i = 0; +$str = ''; - while ($i<256) { - $str .= chr($i++); - } +while ($i<256) { + $str .= chr($i++); +} - var_dump(md5(strrev($str))); - var_dump(strrev(NULL)); - var_dump(strrev("")); +var_dump(md5(strrev($str))); +var_dump(strrev("")); ?> --EXPECT-- string(32) "ec6df70f2569891eae50321a9179eb82" string(0) "" -string(0) "" diff --git a/ext/standard/tests/strings/strripos_variation1.phpt b/ext/standard/tests/strings/strripos_variation1.phpt index 75330184ff..57ae8dd11a 100644 --- a/ext/standard/tests/strings/strripos_variation1.phpt +++ b/ext/standard/tests/strings/strripos_variation1.phpt @@ -24,8 +24,6 @@ $needles = array( //nulls /*11*/ "\0", - NULL, - null, //boolean false /*14*/ FALSE, @@ -141,106 +139,96 @@ int(44) int(44) int(43) -- Iteration 15 -- -int(44) -int(44) -int(44) int(43) --- Iteration 16 -- -int(44) -int(44) -int(44) -int(43) --- Iteration 17 -- int(43) int(43) int(43) -int(43) --- Iteration 18 -- +-- Iteration 16 -- int(12) int(12) bool(false) int(12) --- Iteration 19 -- +-- Iteration 17 -- int(11) int(11) bool(false) int(11) --- Iteration 20 -- +-- Iteration 18 -- int(13) int(13) bool(false) int(13) --- Iteration 21 -- +-- Iteration 19 -- int(14) int(14) bool(false) int(14) --- Iteration 22 -- +-- Iteration 20 -- int(17) int(17) bool(false) int(17) --- Iteration 23 -- +-- Iteration 21 -- int(20) int(20) int(20) int(20) --- Iteration 24 -- +-- Iteration 22 -- int(22) int(22) int(22) int(22) --- Iteration 25 -- +-- Iteration 23 -- int(21) int(21) int(21) int(21) --- Iteration 26 -- +-- Iteration 24 -- int(23) int(23) int(23) int(23) --- Iteration 27 -- +-- Iteration 25 -- int(24) int(24) int(24) int(24) --- Iteration 28 -- +-- Iteration 26 -- int(24) int(24) int(24) int(24) --- Iteration 29 -- +-- Iteration 27 -- int(30) int(30) int(30) int(30) --- Iteration 30 -- +-- Iteration 28 -- int(39) int(39) int(39) int(39) --- Iteration 31 -- +-- Iteration 29 -- int(39) int(39) int(39) int(39) --- Iteration 32 -- +-- Iteration 30 -- int(42) int(42) int(42) int(42) --- Iteration 33 -- +-- Iteration 31 -- int(42) int(42) int(42) int(42) --- Iteration 34 -- +-- Iteration 32 -- bool(false) bool(false) bool(false) bool(false) --- Iteration 35 -- +-- Iteration 33 -- int(0) bool(false) bool(false) diff --git a/ext/standard/tests/strings/strripos_variation2.phpt b/ext/standard/tests/strings/strripos_variation2.phpt index 5a409c28d1..12bcc2d22b 100644 --- a/ext/standard/tests/strings/strripos_variation2.phpt +++ b/ext/standard/tests/strings/strripos_variation2.phpt @@ -24,8 +24,6 @@ $needles = array( //nulls /*11*/ '\0', - NULL, - null, //boolean false /*14*/ FALSE, @@ -142,111 +140,101 @@ int(54) int(54) int(53) -- Iteration 15 -- -int(54) -int(54) -int(54) -int(53) --- Iteration 16 -- -int(54) -int(54) -int(54) -int(53) --- Iteration 17 -- int(53) int(53) int(53) int(53) --- Iteration 18 -- +-- Iteration 16 -- int(16) int(16) bool(false) int(16) --- Iteration 19 -- +-- Iteration 17 -- int(15) int(15) bool(false) int(15) --- Iteration 20 -- +-- Iteration 18 -- int(17) int(17) bool(false) int(17) --- Iteration 21 -- +-- Iteration 19 -- int(18) int(18) bool(false) int(18) --- Iteration 22 -- +-- Iteration 20 -- int(21) int(21) int(21) int(21) --- Iteration 23 -- +-- Iteration 21 -- int(24) int(24) int(24) int(24) --- Iteration 24 -- +-- Iteration 22 -- int(26) int(26) int(26) int(26) --- Iteration 25 -- +-- Iteration 23 -- int(25) int(25) int(25) int(25) --- Iteration 26 -- +-- Iteration 24 -- int(27) int(27) int(27) int(27) --- Iteration 27 -- +-- Iteration 25 -- int(28) int(28) int(28) int(28) --- Iteration 28 -- +-- Iteration 26 -- int(28) int(28) int(28) int(28) --- Iteration 29 -- +-- Iteration 27 -- int(34) int(34) int(34) int(34) --- Iteration 30 -- +-- Iteration 28 -- int(43) int(43) int(43) int(43) --- Iteration 31 -- +-- Iteration 29 -- int(19) int(19) bool(false) int(19) --- Iteration 32 -- +-- Iteration 30 -- int(49) int(49) int(49) int(49) --- Iteration 33 -- +-- Iteration 31 -- bool(false) bool(false) bool(false) bool(false) --- Iteration 34 -- +-- Iteration 32 -- bool(false) bool(false) bool(false) bool(false) --- Iteration 35 -- +-- Iteration 33 -- bool(false) bool(false) bool(false) bool(false) --- Iteration 36 -- +-- Iteration 34 -- int(0) bool(false) bool(false) diff --git a/ext/standard/tests/strings/strrpos_variation1.phpt b/ext/standard/tests/strings/strrpos_variation1.phpt deleted file mode 100644 index 509c015e54..0000000000 --- a/ext/standard/tests/strings/strrpos_variation1.phpt +++ /dev/null @@ -1,177 +0,0 @@ ---TEST-- -Test strrpos() function : usage variations - double quoted strings for 'haystack' & 'needle' arguments ---FILE-- -<?php -/* Test strrpos() function by passing double quoted strings for 'haystack' & 'needle' arguments */ - -echo "*** Testing strrpos() function: with double quoted strings ***\n"; -$haystack = "Hello,\t\n\0\n $&!#%()*<=>?@hello123456he \x234 \101 "; -$needle = array( - //regular strings - "l", - "L", - "HELLO", - "hEllo", - - //escape characters - "\t", - "\T", //invalid input - " ", - "\n", - "\N", //invalid input - " -", //new line - - //nulls - "\0", - NULL, - null, - - //boolean false - FALSE, - false, - - //empty string - "", - - //special chars - " ", - "$", - " $", - "&", - "!#", - "()", - "<=>", - ">", - "=>", - "?", - "@", - "@hEllo", - - "12345", //decimal numeric string - "\x23", //hexadecimal numeric string - "#", //respective ASCII char of \x23 - "\101", //octal numeric string - "A", //respective ASCII char of \101 - "456HEE", //numerics + chars - $haystack //haystack as needle -); - -/* loop through to get the position of the needle in haystack string */ -$count = 1; -for($index=0; $index<count($needle); $index++) { - echo "-- Iteration $count --\n"; - var_dump( strrpos($haystack, $needle[$index]) ); - var_dump( strrpos($haystack, $needle[$index], $index) ); - $count++; -} -echo "*** Done ***"; -?> ---EXPECT-- -*** Testing strrpos() function: with double quoted strings *** --- Iteration 1 -- -int(28) -int(28) --- Iteration 2 -- -bool(false) -bool(false) --- Iteration 3 -- -bool(false) -bool(false) --- Iteration 4 -- -bool(false) -bool(false) --- Iteration 5 -- -int(6) -int(6) --- Iteration 6 -- -bool(false) -bool(false) --- Iteration 7 -- -bool(false) -bool(false) --- Iteration 8 -- -int(9) -int(9) --- Iteration 9 -- -bool(false) -bool(false) --- Iteration 10 -- -int(9) -int(9) --- Iteration 11 -- -int(8) -bool(false) --- Iteration 12 -- -int(44) -int(44) --- Iteration 13 -- -int(44) -int(44) --- Iteration 14 -- -int(44) -int(44) --- Iteration 15 -- -int(44) -int(44) --- Iteration 16 -- -int(44) -int(44) --- Iteration 17 -- -int(43) -int(43) --- Iteration 18 -- -int(12) -bool(false) --- Iteration 19 -- -int(11) -bool(false) --- Iteration 20 -- -int(13) -bool(false) --- Iteration 21 -- -int(14) -bool(false) --- Iteration 22 -- -int(17) -bool(false) --- Iteration 23 -- -int(20) -bool(false) --- Iteration 24 -- -int(22) -bool(false) --- Iteration 25 -- -int(21) -bool(false) --- Iteration 26 -- -int(23) -bool(false) --- Iteration 27 -- -int(24) -bool(false) --- Iteration 28 -- -bool(false) -bool(false) --- Iteration 29 -- -int(30) -int(30) --- Iteration 30 -- -int(39) -int(39) --- Iteration 31 -- -int(39) -int(39) --- Iteration 32 -- -int(42) -int(42) --- Iteration 33 -- -int(42) -int(42) --- Iteration 34 -- -bool(false) -bool(false) --- Iteration 35 -- -int(0) -bool(false) -*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation10.phpt b/ext/standard/tests/strings/strrpos_variation10.phpt deleted file mode 100644 index a59827981e..0000000000 --- a/ext/standard/tests/strings/strrpos_variation10.phpt +++ /dev/null @@ -1,147 +0,0 @@ ---TEST-- -Test strrpos() function : usage variations - unexpected inputs for 'needle' argument ---FILE-- -<?php -/* Test strrpos() function with unexpected inputs for 'needle' and - * an expected type of input for 'haystack' argument -*/ - -echo "*** Testing strrpos() function with unexpected values for needle ***\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"); - -$haystack = "string 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource"; - -// array with different values -$needles = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-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 'needle' array to check the working of strrpos() -$counter = 1; -for($index = 0; $index < count($needles); $index ++) { - echo "-- Iteration $counter --\n"; - try { - var_dump( strrpos($haystack, $needles[$index]) ); - } catch (TypeError $e) { - echo $e->getMessage(), "\n"; - } - $counter ++; -} - -fclose($file_handle); //closing the file handle - -echo "*** Done ***"; -?> ---EXPECT-- -*** Testing strrpos() function with unexpected values for needle *** --- Iteration 1 -- -int(42) --- Iteration 2 -- -int(41) --- Iteration 3 -- -bool(false) --- Iteration 4 -- -bool(false) --- Iteration 5 -- -int(27) --- Iteration 6 -- -int(21) --- Iteration 7 -- -bool(false) --- Iteration 8 -- -bool(false) --- Iteration 9 -- -int(28) --- Iteration 10 -- -strrpos(): Argument #2 ($needle) must be of type string, array given --- Iteration 11 -- -strrpos(): Argument #2 ($needle) must be of type string, array given --- Iteration 12 -- -strrpos(): Argument #2 ($needle) must be of type string, array given --- Iteration 13 -- -strrpos(): Argument #2 ($needle) must be of type string, array given --- Iteration 14 -- -strrpos(): Argument #2 ($needle) must be of type string, array given --- Iteration 15 -- -int(41) --- Iteration 16 -- -int(87) --- Iteration 17 -- -int(41) --- Iteration 18 -- -int(87) --- Iteration 19 -- -int(64) --- Iteration 20 -- -int(87) --- Iteration 21 -- -int(87) --- Iteration 22 -- -int(87) --- Iteration 23 -- -int(87) --- Iteration 24 -- -strrpos(): Argument #2 ($needle) must be of type string, resource given --- Iteration 25 -- -int(87) --- Iteration 26 -- -int(87) -*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation11.phpt b/ext/standard/tests/strings/strrpos_variation11.phpt deleted file mode 100644 index da33a21dc5..0000000000 --- a/ext/standard/tests/strings/strrpos_variation11.phpt +++ /dev/null @@ -1,175 +0,0 @@ ---TEST-- -Test strrpos() function : usage variations - unexpected inputs for 'haystack' and 'needle' arguments ---FILE-- -<?php -/* Test strrpos() function with unexpected inputs for 'haystack' and 'needle' arguments */ - -echo "*** Testing strrpos() function with unexpected values for haystack and needle ***\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"; - $haystack = $values[$index]; - try { - var_dump( strrpos($values[$index], $values[$index]) ); - } catch (Error $e) { - echo get_class($e) . ": " . $e->getMessage(), "\n"; - } - - try { - var_dump( strrpos($values[$index], $values[$index], 1) ); - } catch (Error $e) { - echo get_class($e) . ": " . $e->getMessage(), "\n"; - } - $counter ++; -} - -echo "*** Done ***"; -?> ---EXPECT-- -*** Testing strrpos() function with unexpected values for haystack and needle *** --- Iteration 1 -- -int(0) -bool(false) --- Iteration 2 -- -int(0) -bool(false) --- Iteration 3 -- -int(0) -bool(false) --- Iteration 4 -- -int(0) -bool(false) --- Iteration 5 -- -int(0) -bool(false) --- Iteration 6 -- -int(0) -bool(false) --- Iteration 7 -- -int(0) -bool(false) --- Iteration 8 -- -int(0) -bool(false) --- Iteration 9 -- -int(0) -bool(false) --- Iteration 10 -- -TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given -TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given --- Iteration 11 -- -TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given -TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given --- Iteration 12 -- -TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given -TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given --- Iteration 13 -- -TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given -TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given --- Iteration 14 -- -TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given -TypeError: strrpos(): Argument #1 ($haystack) must be of type string, array given --- Iteration 15 -- -int(0) -bool(false) --- Iteration 16 -- -int(0) -ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --- Iteration 17 -- -int(0) -bool(false) --- Iteration 18 -- -int(0) -ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --- Iteration 19 -- -int(0) -bool(false) --- Iteration 20 -- -int(0) -ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --- Iteration 21 -- -int(0) -ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --- Iteration 22 -- -int(0) -ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --- Iteration 23 -- -int(0) -ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --- Iteration 24 -- -TypeError: strrpos(): Argument #1 ($haystack) must be of type string, resource given -TypeError: strrpos(): Argument #1 ($haystack) must be of type string, resource given --- Iteration 25 -- -int(0) -ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) --- Iteration 26 -- -int(0) -ValueError: strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) -*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation2.phpt b/ext/standard/tests/strings/strrpos_variation2.phpt index b6b7cb149d..0022d0e2c3 100644 --- a/ext/standard/tests/strings/strrpos_variation2.phpt +++ b/ext/standard/tests/strings/strrpos_variation2.phpt @@ -24,8 +24,6 @@ $needle = array( //nulls '\0', - NULL, - null, //boolean false FALSE, @@ -113,69 +111,63 @@ int(54) int(54) int(54) -- Iteration 15 -- -int(54) -int(54) --- Iteration 16 -- -int(54) -int(54) --- Iteration 17 -- int(53) int(53) --- Iteration 18 -- +-- Iteration 16 -- int(16) -bool(false) --- Iteration 19 -- +int(16) +-- Iteration 17 -- int(15) bool(false) --- Iteration 20 -- +-- Iteration 18 -- int(17) -bool(false) --- Iteration 21 -- +int(17) +-- Iteration 19 -- int(18) -bool(false) --- Iteration 22 -- +int(18) +-- Iteration 20 -- int(21) int(21) --- Iteration 23 -- +-- Iteration 21 -- int(24) int(24) --- Iteration 24 -- +-- Iteration 22 -- int(26) int(26) --- Iteration 25 -- +-- Iteration 23 -- int(25) int(25) --- Iteration 26 -- +-- Iteration 24 -- int(27) int(27) --- Iteration 27 -- +-- Iteration 25 -- int(28) int(28) --- Iteration 28 -- +-- Iteration 26 -- bool(false) bool(false) --- Iteration 29 -- +-- Iteration 27 -- int(34) int(34) --- Iteration 30 -- +-- Iteration 28 -- int(43) int(43) --- Iteration 31 -- +-- Iteration 29 -- int(19) bool(false) --- Iteration 32 -- +-- Iteration 30 -- int(49) int(49) --- Iteration 33 -- +-- Iteration 31 -- bool(false) bool(false) --- Iteration 34 -- +-- Iteration 32 -- bool(false) bool(false) --- Iteration 35 -- +-- Iteration 33 -- bool(false) bool(false) --- Iteration 36 -- +-- Iteration 34 -- int(0) bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation7.phpt b/ext/standard/tests/strings/strrpos_variation7.phpt index 884a902112..f73d4129d5 100644 --- a/ext/standard/tests/strings/strrpos_variation7.phpt +++ b/ext/standard/tests/strings/strrpos_variation7.phpt @@ -17,7 +17,6 @@ try { echo $exception->getMessage() . "\n"; } var_dump( strrpos($empty_string, FALSE) ); -var_dump( strrpos($empty_string, NULL) ); echo "*** Done ***"; ?> @@ -27,5 +26,4 @@ echo "*** Done ***"; int(0) strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) int(0) -int(0) *** Done *** diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt Binary files differindex da2aa1e22e..52088fb88b 100644 --- a/ext/standard/tests/strings/strstr.phpt +++ b/ext/standard/tests/strings/strstr.phpt diff --git a/ext/standard/tests/strings/strtolower-win32.phpt b/ext/standard/tests/strings/strtolower-win32.phpt Binary files differindex b16e55cc50..368a81ad93 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 0f9b4299cf..3a68588057 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 de26ca5400..98a314a7b4 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 bff3f97d96..864053d22d 100644 --- a/ext/standard/tests/strings/strtoupper1.phpt +++ b/ext/standard/tests/strings/strtoupper1.phpt diff --git a/ext/standard/tests/strings/strtr_variation4.phpt b/ext/standard/tests/strings/strtr_variation4.phpt index 21e5cab773..f89ff654a1 100644 --- a/ext/standard/tests/strings/strtr_variation4.phpt +++ b/ext/standard/tests/strings/strtr_variation4.phpt @@ -19,8 +19,6 @@ EOD; $str_arr = array( "", '', - NULL, - null, FALSE, false, $heredoc_str @@ -64,10 +62,4 @@ string(0) "" -- Iteration 5 -- string(0) "" string(0) "" --- Iteration 6 -- -string(0) "" -string(0) "" --- Iteration 7 -- -string(0) "" -string(0) "" *** Done *** diff --git a/ext/standard/tests/strings/strtr_variation6.phpt b/ext/standard/tests/strings/strtr_variation6.phpt index fcc903d637..438eb168fa 100644 --- a/ext/standard/tests/strings/strtr_variation6.phpt +++ b/ext/standard/tests/strings/strtr_variation6.phpt @@ -8,10 +8,6 @@ Test strtr() function : usage variations - unexpected inputs for 'from' argument echo "*** Testing strtr() function: with unexpected inputs for 'from' ***\n"; -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - //defining a class class sample { public function __toString() { @@ -58,12 +54,6 @@ $from_arr = array ( // resource /*17*/ $file_handle, - - // undefined variable -/*18*/ @$undefined_var, - - // unset variable -/*19*/ @$unset_var ); //defining 'to' argument @@ -84,7 +74,7 @@ for($index = 0; $index < count($from_arr); $index++) { fclose($file_handle); //closing the file handle ?> ---EXPECT-- +--EXPECTF-- *** Testing strtr() function: with unexpected inputs for 'from' *** -- Iteration 1 -- string(6) "a12atm" @@ -113,14 +103,14 @@ string(6) "0a2atm" -- Iteration 13 -- string(6) "012atm" -- Iteration 14 -- + +Deprecated: strtr(): Passing null to parameter #2 ($from) of type array|string is deprecated in %s on line %d string(6) "012atm" -- Iteration 15 -- + +Deprecated: strtr(): Passing null to parameter #2 ($from) of type array|string is deprecated in %s on line %d string(6) "012atm" -- Iteration 16 -- string(6) "012ttm" -- Iteration 17 -- strtr(): Argument #2 ($from) must be of type array|string, resource given --- Iteration 18 -- -string(6) "012atm" --- Iteration 19 -- -string(6) "012atm" diff --git a/ext/standard/tests/strings/strtr_variation8.phpt b/ext/standard/tests/strings/strtr_variation8.phpt index 7ac60532f8..d68c6f04e7 100644 --- a/ext/standard/tests/strings/strtr_variation8.phpt +++ b/ext/standard/tests/strings/strtr_variation8.phpt @@ -8,10 +8,6 @@ Test strtr() function : usage variations - unexpected inputs for 'replace_pairs' echo "*** Testing strtr() function: with unexpected inputs for 'replace_pairs' ***\n"; -//get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - //defining a class class sample { public function __toString() { @@ -58,12 +54,6 @@ $replace_pairs_arr = array ( // resource $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var ); // loop through with each element of the $replace_pairs array to test strtr() function @@ -84,7 +74,7 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECT-- +--EXPECTF-- *** Testing strtr() function: with unexpected inputs for 'replace_pairs' *** -- Iteration 1 -- @@ -127,9 +117,13 @@ strtr(): Argument #2 ($from) must be of type array, string given strtr(): Argument #2 ($from) must be of type array, string given -- Iteration 14 -- + +Deprecated: strtr(): Passing null to parameter #2 ($from) of type array|string is deprecated in %s on line %d strtr(): Argument #2 ($from) must be of type array, string given -- Iteration 15 -- + +Deprecated: strtr(): Passing null to parameter #2 ($from) of type array|string is deprecated in %s on line %d strtr(): Argument #2 ($from) must be of type array, string given -- Iteration 16 -- @@ -137,10 +131,4 @@ strtr(): Argument #2 ($from) must be of type array, string given -- Iteration 17 -- strtr(): Argument #2 ($from) must be of type array|string, resource given - --- Iteration 18 -- -strtr(): Argument #2 ($from) must be of type array, string given - --- Iteration 19 -- -strtr(): Argument #2 ($from) must be of type array, string given *** Done *** diff --git a/ext/standard/tests/strings/substr.phpt b/ext/standard/tests/strings/substr.phpt Binary files differindex 99dcd2bf2f..8f172cee61 100644 --- a/ext/standard/tests/strings/substr.phpt +++ b/ext/standard/tests/strings/substr.phpt diff --git a/ext/standard/tests/strings/substr_count_variation_001.phpt b/ext/standard/tests/strings/substr_count_variation_001.phpt index abfecac097..d76c56d60f 100644 --- a/ext/standard/tests/strings/substr_count_variation_001.phpt +++ b/ext/standard/tests/strings/substr_count_variation_001.phpt @@ -9,10 +9,6 @@ $str = "this is a string"; var_dump( substr_count($str, "t", "5") ); var_dump( substr_count($str, "t", "5", "10") ); -echo "\n-- 3rd or 4th arg as NULL --\n"; -var_dump( substr_count($str, "I", NULL) ); -var_dump( substr_count($str, "i", NULL, 10) ); - echo "\n-- overlapped substrings --\n"; var_dump( substr_count("abcabcabcabcabc", "abca") ); var_dump( substr_count("abcabcabcabcabc", "abca", 2) ); @@ -53,10 +49,6 @@ echo "Done\n"; int(1) int(1) --- 3rd or 4th arg as NULL -- -int(0) -int(2) - -- overlapped substrings -- int(2) int(2) diff --git a/ext/standard/tests/strings/trim1.phpt b/ext/standard/tests/strings/trim1.phpt Binary files differindex e4601db7ac..849b972c11 100644 --- a/ext/standard/tests/strings/trim1.phpt +++ b/ext/standard/tests/strings/trim1.phpt diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt Binary files differindex a54b984b88..1d8ecd7630 100644 --- a/ext/standard/tests/strings/ucfirst.phpt +++ b/ext/standard/tests/strings/ucfirst.phpt diff --git a/ext/standard/tests/strings/vprintf_variation1.phpt b/ext/standard/tests/strings/vprintf_variation1.phpt deleted file mode 100644 index 18cf1a7c04..0000000000 --- a/ext/standard/tests/strings/vprintf_variation1.phpt +++ /dev/null @@ -1,200 +0,0 @@ ---TEST-- -Test vprintf() function : usage variations - unexpected values for the format argument ---FILE-- -<?php -/* - * Test vprintf() when different unexpected format strings are passed to - * the '$format' argument of the function -*/ - -echo "*** Testing vprintf() : with unexpected values for format argument ***\n"; - -// initialising the required variables -$args = array(1, 2); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// declaring a class -class sample -{ - public function __toString() { - return "object"; - } -} - -// Defining resource -$file_handle = fopen(__FILE__, 'r'); - - -//array of values to iterate over -$values = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 10.1234567e10, - 10.7654321E-10, - .5, - - // array data -/*10*/ array(), - array(0), - array(1), - array(1,2), - array('color' => 'red', 'item' => 'pen'), - - // null data -/*15*/ NULL, - null, - - // boolean data -/*17*/ true, - false, - TRUE, - FALSE, - - // empty data -/*21*/ "", - '', - - // object data -/*23*/ new sample(), - - // undefined data -/*24*/ @$undefined_var, - - // unset data -/*25*/ @$unset_var, - - // resource data -/*26*/ $file_handle -); - -// loop through each element of the array for format - -$counter = 1; -foreach($values as $value) { - echo "\n -- Iteration $counter --\n"; - try { - $result = vprintf($value, $args); - echo "\n"; - var_dump($result); - } catch (TypeError $exception) { - echo $exception->getMessage() . "\n"; - } - - $counter++; -} - -// closing the resource -fclose($file_handle); - -?> ---EXPECT-- -*** Testing vprintf() : with unexpected values for format argument *** - - -- Iteration 1 -- -0 -int(1) - - -- Iteration 2 -- -1 -int(1) - - -- Iteration 3 -- -12345 -int(5) - - -- Iteration 4 -- --2345 -int(5) - - -- Iteration 5 -- -10.5 -int(4) - - -- Iteration 6 -- --10.5 -int(5) - - -- Iteration 7 -- -101234567000 -int(12) - - -- Iteration 8 -- -1.07654321E-9 -int(13) - - -- Iteration 9 -- -0.5 -int(3) - - -- Iteration 10 -- -vprintf(): Argument #1 ($format) must be of type string, array given - - -- Iteration 11 -- -vprintf(): Argument #1 ($format) must be of type string, array given - - -- Iteration 12 -- -vprintf(): Argument #1 ($format) must be of type string, array given - - -- Iteration 13 -- -vprintf(): Argument #1 ($format) must be of type string, array given - - -- Iteration 14 -- -vprintf(): Argument #1 ($format) must be of type string, array given - - -- Iteration 15 -- - -int(0) - - -- Iteration 16 -- - -int(0) - - -- Iteration 17 -- -1 -int(1) - - -- Iteration 18 -- - -int(0) - - -- Iteration 19 -- -1 -int(1) - - -- Iteration 20 -- - -int(0) - - -- Iteration 21 -- - -int(0) - - -- Iteration 22 -- - -int(0) - - -- Iteration 23 -- -object -int(6) - - -- Iteration 24 -- - -int(0) - - -- Iteration 25 -- - -int(0) - - -- Iteration 26 -- -vprintf(): Argument #1 ($format) must be of type string, resource given diff --git a/ext/standard/tests/url/get_headers_error_003.phpt b/ext/standard/tests/url/get_headers_error_003.phpt index a8edc2cb21..7ee0b9e210 100644 --- a/ext/standard/tests/url/get_headers_error_003.phpt +++ b/ext/standard/tests/url/get_headers_error_003.phpt @@ -1,7 +1,5 @@ --TEST-- Test get_headers() function : test with context ---CONFLICTS-- -server --FILE-- <?php diff --git a/ext/standard/tests/versioning/version_compare_op_abbrev.phpt b/ext/standard/tests/versioning/version_compare_op_abbrev.phpt new file mode 100644 index 0000000000..241c1559fe --- /dev/null +++ b/ext/standard/tests/versioning/version_compare_op_abbrev.phpt @@ -0,0 +1,21 @@ +--TEST-- +version_compare() no longer supports operator abbreviations +--FILE-- +<?php +$abbrevs = ['', 'l', 'g', 'e', '!', 'n']; +foreach ($abbrevs as $op) { + try { + version_compare('1', '2', $op); + echo "'$op' succeeded\n"; + } catch (ValueError $err) { + echo "'$op' failed\n"; + } +} +?> +--EXPECT-- +'' failed +'l' failed +'g' failed +'e' failed +'!' failed +'n' failed diff --git a/ext/standard/type.c b/ext/standard/type.c index 5a8b2a0b9d..1036dd7d06 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -321,6 +321,19 @@ PHP_FUNCTION(is_array) } /* }}} */ +/* {{{ Returns true if $array is an array whose keys are all numeric, sequential, and start at 0 */ +PHP_FUNCTION(array_is_list) +{ + HashTable *array; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ARRAY_HT(array) + ZEND_PARSE_PARAMETERS_END(); + + RETURN_BOOL(zend_array_is_list(array)); +} +/* }}} */ + /* {{{ Returns true if variable is an object Warning: This function is special-cased by zend_compile.c and so is usually bypassed */ PHP_FUNCTION(is_object) @@ -390,8 +403,8 @@ PHP_FUNCTION(is_callable) zval *var, *callable_name = NULL; zend_string *name; char *error; - zend_bool retval; - zend_bool syntax_only = 0; + bool retval; + bool syntax_only = 0; int check_flags = 0; ZEND_PARSE_PARAMETERS_START(1, 3) diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c index 3671cc3213..0dc9098af0 100644 --- a/ext/standard/uniqid.c +++ b/ext/standard/uniqid.c @@ -32,6 +32,7 @@ #endif #include "php_lcg.h" +#include "php_random.h" #ifdef HAVE_GETTIMEOFDAY ZEND_TLS struct timeval prev_tv = { 0, 0 }; @@ -40,7 +41,7 @@ ZEND_TLS struct timeval prev_tv = { 0, 0 }; PHP_FUNCTION(uniqid) { char *prefix = ""; - zend_bool more_entropy = 0; + bool more_entropy = 0; zend_string *uniqid; int sec, usec; size_t prefix_len = 0; @@ -71,7 +72,14 @@ PHP_FUNCTION(uniqid) * digits for usecs. */ if (more_entropy) { - uniqid = strpprintf(0, "%s%08x%05x%.8F", prefix, sec, usec, php_combined_lcg() * 10); + uint32_t bytes; + double seed; + if (php_random_bytes_silent(&bytes, sizeof(uint32_t)) == FAILURE) { + seed = php_combined_lcg() * 10; + } else { + seed = ((double) bytes / UINT32_MAX) * 10.0; + } + uniqid = strpprintf(0, "%s%08x%05x%.8F", prefix, sec, usec, seed); } else { uniqid = strpprintf(0, "%s%08x%05x", prefix, sec, usec); } diff --git a/ext/standard/url.c b/ext/standard/url.c index a33091a86b..d1baff1049 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -95,13 +95,13 @@ static const char *binary_strcspn(const char *s, const char *e, const char *char /* {{{ php_url_parse */ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length) { - zend_bool has_port; + bool has_port; return php_url_parse_ex2(str, length, &has_port); } /* {{{ php_url_parse_ex2 */ -PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, zend_bool *has_port) +PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, bool *has_port) { char port_buf[6]; php_url *ret = ecalloc(1, sizeof(php_url)); @@ -335,7 +335,7 @@ PHP_FUNCTION(parse_url) php_url *resource; zend_long key = -1; zval tmp; - zend_bool has_port; + bool has_port; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STRING(str, str_len) @@ -458,7 +458,7 @@ static int php_htoi(char *s) static const unsigned char hexchars[] = "0123456789ABCDEF"; -static zend_always_inline zend_string *php_url_encode_impl(const char *s, size_t len, zend_bool raw) /* {{{ */ { +static zend_always_inline zend_string *php_url_encode_impl(const char *s, size_t len, bool raw) /* {{{ */ { register unsigned char c; unsigned char *to; unsigned char const *from, *end; @@ -683,7 +683,7 @@ PHP_FUNCTION(get_headers) size_t url_len; php_stream *stream; zval *prev_val, *hdr = NULL; - zend_bool format = 0; + bool format = 0; zval *zcontext = NULL; php_stream_context *context; diff --git a/ext/standard/url.h b/ext/standard/url.h index a751aa4ee1..6483b7211b 100644 --- a/ext/standard/url.h +++ b/ext/standard/url.h @@ -31,7 +31,7 @@ typedef struct php_url { PHPAPI void php_url_free(php_url *theurl); PHPAPI php_url *php_url_parse(char const *str); PHPAPI php_url *php_url_parse_ex(char const *str, size_t length); -PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, zend_bool *has_port); +PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, bool *has_port); PHPAPI size_t php_url_decode(char *str, size_t len); /* return value: length of decoded string */ PHPAPI size_t php_raw_url_decode(char *str, size_t len); /* return value: length of decoded string */ PHPAPI zend_string *php_url_encode(char const *s, size_t len); diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index bef17733e2..7cfd848717 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -619,7 +619,7 @@ PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, co } -static char *url_adapt_ext(const char *src, size_t srclen, size_t *newlen, zend_bool do_flush, url_adapt_state_ex_t *ctx) +static char *url_adapt_ext(const char *src, size_t srclen, size_t *newlen, bool do_flush, url_adapt_state_ex_t *ctx) { char *retval; @@ -690,7 +690,7 @@ static inline void php_url_scanner_session_handler_impl(char *output, size_t out } if (ZSTR_LEN(url_state->url_app.s) != 0) { - *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode & (PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_CONT | PHP_OUTPUT_HANDLER_FLUSH | PHP_OUTPUT_HANDLER_FINAL) ? 1 : 0), url_state); + *handled_output = url_adapt_ext(output, output_len, &len, (bool) (mode & (PHP_OUTPUT_HANDLER_END | PHP_OUTPUT_HANDLER_CONT | PHP_OUTPUT_HANDLER_FLUSH | PHP_OUTPUT_HANDLER_FINAL) ? 1 : 0), url_state); if (sizeof(unsigned int) < sizeof(size_t)) { if (len > UINT_MAX) len = UINT_MAX; @@ -842,7 +842,7 @@ static inline int php_url_scanner_reset_var_impl(zend_string *name, int encode, smart_str form_app = {0}; zend_string *encoded; int ret = SUCCESS; - zend_bool sep_removed = 0; + bool sep_removed = 0; url_adapt_state_ex_t *url_state; if (type) { diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 758f79ff11..6c5574f991 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -42,7 +42,7 @@ static int le_bucket; PHP_METHOD(php_user_filter, filter) { zval *in, *out, *consumed; - zend_bool closing; + bool closing; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrzb", &in, &out, &consumed, &closing) == FAILURE) { RETURN_THROWS(); } diff --git a/ext/standard/user_filters.stub.php b/ext/standard/user_filters.stub.php index 4065750312..7beb014f62 100755 --- a/ext/standard/user_filters.stub.php +++ b/ext/standard/user_filters.stub.php @@ -4,6 +4,11 @@ class php_user_filter { + /** @var string */ + public $filtername = ""; + /** @var string */ + public $params = ""; + /** * @param resource $in * @param resource $out diff --git a/ext/standard/user_filters_arginfo.h b/ext/standard/user_filters_arginfo.h index aabb25c9d1..a982adbf72 100644 --- a/ext/standard/user_filters_arginfo.h +++ b/ext/standard/user_filters_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: b3876ce9055a9417d0d1db9f97235513740de956 */ + * Stub hash: e3ab7a87eb78ef3a7f96ad18f5dff6c6d8032ca2 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_php_user_filter_filter, 0, 0, 4) ZEND_ARG_INFO(0, in) diff --git a/ext/standard/var.c b/ext/standard/var.c index fef62dd482..5c13846a82 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -130,9 +130,9 @@ again: GC_ADDREF(myht); GC_PROTECT_RECURSION(myht); } - count = zend_array_count(myht); + count = zend_hash_num_elements(myht); php_printf("%sarray(%d) {\n", COMMON, count); - ZEND_HASH_FOREACH_KEY_VAL_IND(myht, num, key, val) { + ZEND_HASH_FOREACH_KEY_VAL(myht, num, key, val) { php_array_element_dump(val, num, key, level); } ZEND_HASH_FOREACH_END(); if (!(GC_FLAGS(myht) & GC_IMMUTABLE)) { @@ -299,7 +299,11 @@ again: case IS_STRING: php_printf("%sstring(%zd) \"", COMMON, Z_STRLEN_P(struc)); PHPWRITE(Z_STRVAL_P(struc), Z_STRLEN_P(struc)); - php_printf("\" refcount(%u)\n", Z_REFCOUNTED_P(struc) ? Z_REFCOUNT_P(struc) : 1); + if (Z_REFCOUNTED_P(struc)) { + php_printf("\" refcount(%u)\n", Z_REFCOUNT_P(struc)); + } else { + PUTS("\" interned\n"); + } break; case IS_ARRAY: myht = Z_ARRVAL_P(struc); @@ -311,9 +315,14 @@ again: GC_ADDREF(myht); GC_PROTECT_RECURSION(myht); } - count = zend_array_count(myht); - php_printf("%sarray(%d) refcount(%u){\n", COMMON, count, Z_REFCOUNTED_P(struc) ? Z_REFCOUNT_P(struc) - 1 : 1); - ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, val) { + count = zend_hash_num_elements(myht); + if (Z_REFCOUNTED_P(struc)) { + /* -1 because of ADDREF above. */ + php_printf("%sarray(%d) refcount(%u){\n", COMMON, count, Z_REFCOUNT_P(struc) - 1); + } else { + php_printf("%sarray(%d) interned {\n", COMMON, count); + } + ZEND_HASH_FOREACH_KEY_VAL(myht, index, key, val) { zval_array_element_dump(val, index, key, level); } ZEND_HASH_FOREACH_END(); if (!(GC_FLAGS(myht) & GC_IMMUTABLE)) { @@ -529,7 +538,7 @@ again: buffer_append_spaces(buf, level - 1); } smart_str_appendl(buf, "array (\n", 8); - ZEND_HASH_FOREACH_KEY_VAL_IND(myht, index, key, val) { + ZEND_HASH_FOREACH_KEY_VAL(myht, index, key, val) { php_array_element_export(val, index, key, level, buf); } ZEND_HASH_FOREACH_END(); if (!(GC_FLAGS(myht) & GC_IMMUTABLE)) { @@ -611,7 +620,7 @@ PHPAPI void php_var_export(zval *struc, int level) /* {{{ */ PHP_FUNCTION(var_export) { zval *var; - zend_bool return_output = 0; + bool return_output = 0; smart_str buf = {0}; ZEND_PARSE_PARAMETERS_START(1, 2) @@ -638,7 +647,7 @@ static inline zend_long php_add_var_hash(php_serialize_data_t data, zval *var) / { zval *zv; zend_ulong key; - zend_bool is_ref = Z_ISREF_P(var); + bool is_ref = Z_ISREF_P(var); data->n += 1; @@ -698,7 +707,7 @@ static inline void php_var_serialize_string(smart_str *buf, char *str, size_t le } /* }}} */ -static inline zend_bool php_var_serialize_class_name(smart_str *buf, zval *struc) /* {{{ */ +static inline bool php_var_serialize_class_name(smart_str *buf, zval *struc) /* {{{ */ { PHP_CLASS_ATTRIBUTES; @@ -868,7 +877,7 @@ static int php_var_serialize_get_sleep_props( } /* }}} */ -static void php_var_serialize_nested_data(smart_str *buf, zval *struc, HashTable *ht, uint32_t count, zend_bool incomplete_class, php_serialize_data_t var_hash) /* {{{ */ +static void php_var_serialize_nested_data(smart_str *buf, zval *struc, HashTable *ht, uint32_t count, bool incomplete_class, php_serialize_data_t var_hash) /* {{{ */ { smart_str_append_unsigned(buf, count); smart_str_appendl(buf, ":{", 2); @@ -878,7 +887,7 @@ static void php_var_serialize_nested_data(smart_str *buf, zval *struc, HashTable zend_ulong index; ZEND_HASH_FOREACH_KEY_VAL_IND(ht, index, key, data) { - if (incomplete_class && strcmp(ZSTR_VAL(key), MAGIC_MEMBER) == 0) { + if (incomplete_class && zend_string_equals_literal(key, MAGIC_MEMBER)) { continue; } @@ -989,7 +998,7 @@ again: case IS_OBJECT: { zend_class_entry *ce = Z_OBJCE_P(struc); - zend_bool incomplete_class; + bool incomplete_class; uint32_t count; if (ce->__serialize) { @@ -1208,7 +1217,7 @@ PHPAPI void php_unserialize_with_options(zval *return_value, const char *buf, co zend_string *lcname; ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(classes), entry) { - convert_to_string_ex(entry); + convert_to_string(entry); lcname = zend_string_tolower(Z_STR_P(entry)); zend_hash_add_empty_element(class_hash, lcname); zend_string_release_ex(lcname, 0); @@ -1300,7 +1309,7 @@ PHP_FUNCTION(unserialize) /* {{{ Returns the allocated by PHP memory */ PHP_FUNCTION(memory_get_usage) { - zend_bool real_usage = 0; + bool real_usage = 0; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL @@ -1313,7 +1322,7 @@ PHP_FUNCTION(memory_get_usage) { /* {{{ Returns the peak allocated by PHP memory */ PHP_FUNCTION(memory_get_peak_usage) { - zend_bool real_usage = 0; + bool real_usage = 0; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index 1b191a0367..56fe1fc784 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -29,6 +29,10 @@ #define VAR_WAKEUP_FLAG 1 #define VAR_UNSERIALIZE_FLAG 2 +/* Each element is encoded using at least 2 characters. */ +#define IS_FAKE_ELEM_COUNT(num_elems, serialized_len) \ + ((num_elems) > (serialized_len) / 2) + typedef struct { zend_long used_slots; void *next; @@ -217,7 +221,7 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx) zend_long i; var_entries *var_hash = (*var_hashx)->entries.next; var_dtor_entries *var_dtor_hash = (*var_hashx)->first_dtor; - zend_bool delayed_call_failed = 0; + bool delayed_call_failed = 0; zval wakeup_name; ZVAL_UNDEF(&wakeup_name); @@ -338,12 +342,9 @@ static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t } static inline int unserialize_allowed_class( - zend_string *class_name, php_unserialize_data_t *var_hashx) + zend_string *lcname, php_unserialize_data_t *var_hashx) { HashTable *classes = (*var_hashx)->allowed_classes; - zend_string *lcname; - int res; - ALLOCA_FLAG(use_heap) if(classes == NULL) { return 1; @@ -352,11 +353,7 @@ static inline int unserialize_allowed_class( return 0; } - ZSTR_ALLOCA_ALLOC(lcname, ZSTR_LEN(class_name), use_heap); - zend_str_tolower_copy(ZSTR_VAL(lcname), ZSTR_VAL(class_name), ZSTR_LEN(class_name)); - res = zend_hash_exists(classes, lcname); - ZSTR_ALLOCA_FREE(lcname, use_heap); - return res; + return zend_hash_exists(classes, lcname); } #define YYFILL(n) do { } while (0) @@ -446,7 +443,7 @@ static inline size_t parse_uiv(const unsigned char *p) static int php_var_unserialize_internal(UNSERIALIZE_PARAMETER, int as_key); -static zend_always_inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend_long elements, zend_object *obj) +static zend_always_inline int process_nested_array_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend_long elements) { if (var_hash) { if ((*var_hash)->max_depth > 0 && (*var_hash)->cur_depth >= (*var_hash)->max_depth) { @@ -463,7 +460,6 @@ static zend_always_inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTab while (elements-- > 0) { zval key, *data, d, *old_data; zend_ulong idx; - zend_property_info *info = NULL; ZVAL_UNDEF(&key); @@ -475,118 +471,190 @@ static zend_always_inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTab data = NULL; ZVAL_UNDEF(&d); - if (!obj) { - if (Z_TYPE(key) == IS_LONG) { - idx = Z_LVAL(key); + if (Z_TYPE(key) == IS_LONG) { + idx = Z_LVAL(key); numeric_key: - if (UNEXPECTED((old_data = zend_hash_index_find(ht, idx)) != NULL)) { - //??? update hash - var_push_dtor(var_hash, old_data); - data = zend_hash_index_update(ht, idx, &d); - } else { - data = zend_hash_index_add_new(ht, idx, &d); - } - } else if (Z_TYPE(key) == IS_STRING) { - if (UNEXPECTED(ZEND_HANDLE_NUMERIC(Z_STR(key), idx))) { - goto numeric_key; - } - if (UNEXPECTED((old_data = zend_hash_find(ht, Z_STR(key))) != NULL)) { - //??? update hash - var_push_dtor(var_hash, old_data); - data = zend_hash_update(ht, Z_STR(key), &d); - } else { - data = zend_hash_add_new(ht, Z_STR(key), &d); - } + if (UNEXPECTED((old_data = zend_hash_index_find(ht, idx)) != NULL)) { + //??? update hash + var_push_dtor(var_hash, old_data); + data = zend_hash_index_update(ht, idx, &d); } else { - zval_ptr_dtor(&key); - goto failure; + data = zend_hash_index_add_new(ht, idx, &d); + } + } else if (Z_TYPE(key) == IS_STRING) { + if (UNEXPECTED(ZEND_HANDLE_NUMERIC(Z_STR(key), idx))) { + goto numeric_key; + } + if (UNEXPECTED((old_data = zend_hash_find(ht, Z_STR(key))) != NULL)) { + //??? update hash + var_push_dtor(var_hash, old_data); + data = zend_hash_update(ht, Z_STR(key), &d); + } else { + data = zend_hash_add_new(ht, Z_STR(key), &d); + } + } else { + zval_ptr_dtor(&key); + goto failure; + } + + if (!php_var_unserialize_internal(data, p, max, var_hash, 0)) { + zval_ptr_dtor(&key); + goto failure; + } + + if (BG(unserialize).level > 1) { + var_push_dtor(var_hash, data); + } + zval_ptr_dtor_str(&key); + + if (elements && *(*p-1) != ';' && *(*p-1) != '}') { + (*p)--; + goto failure; + } + } + + if (var_hash) { + (*var_hash)->cur_depth--; + } + return 1; + +failure: + if (var_hash) { + (*var_hash)->cur_depth--; + } + return 0; +} + +static int is_property_visibility_changed(zend_class_entry *ce, zval *key) +{ + if (zend_hash_num_elements(&ce->properties_info) > 0) { + zend_property_info *existing_propinfo; + const char *unmangled_class = NULL; + const char *unmangled_prop; + size_t unmangled_prop_len; + + if (UNEXPECTED(zend_unmangle_property_name_ex(Z_STR_P(key), &unmangled_class, &unmangled_prop, &unmangled_prop_len) == FAILURE)) { + zval_ptr_dtor_str(key); + return -1; + } + + if (unmangled_class == NULL) { + existing_propinfo = zend_hash_find_ptr(&ce->properties_info, Z_STR_P(key)); + if (existing_propinfo != NULL) { + zval_ptr_dtor_str(key); + ZVAL_STR_COPY(key, existing_propinfo->name); + return 1; } } else { - if (EXPECTED(Z_TYPE(key) == IS_STRING)) { + if (!strcmp(unmangled_class, "*") + || !strcasecmp(unmangled_class, ZSTR_VAL(ce->name))) { + existing_propinfo = zend_hash_str_find_ptr( + &ce->properties_info, unmangled_prop, unmangled_prop_len); + if (existing_propinfo != NULL) { + zval_ptr_dtor_str(key); + ZVAL_STR_COPY(key, existing_propinfo->name); + return 1; + } + } + } + } + return 0; +} + + +static zend_always_inline int process_nested_object_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend_long elements, zend_object *obj) +{ + if (var_hash) { + if ((*var_hash)->max_depth > 0 && (*var_hash)->cur_depth >= (*var_hash)->max_depth) { + php_error_docref(NULL, E_WARNING, + "Maximum depth of " ZEND_LONG_FMT " exceeded. " + "The depth limit can be changed using the max_depth unserialize() option " + "or the unserialize_max_depth ini setting", + (*var_hash)->max_depth); + return 0; + } + (*var_hash)->cur_depth++; + } + + while (elements-- > 0) { + zval key, *data, d, *old_data; + zend_property_info *info = NULL; + + ZVAL_UNDEF(&key); + + if (!php_var_unserialize_internal(&key, p, max, NULL, 1)) { + zval_ptr_dtor(&key); + goto failure; + } + + data = NULL; + ZVAL_UNDEF(&d); + + if (EXPECTED(Z_TYPE(key) == IS_STRING)) { string_key: - if (obj && zend_hash_num_elements(&obj->ce->properties_info) > 0) { - zend_property_info *existing_propinfo; - zend_string *new_key; - const char *unmangled_class = NULL; - const char *unmangled_prop; - size_t unmangled_prop_len; - zend_string *unmangled; - - if (UNEXPECTED(zend_unmangle_property_name_ex(Z_STR(key), &unmangled_class, &unmangled_prop, &unmangled_prop_len) == FAILURE)) { - zval_ptr_dtor(&key); - goto failure; - } + if ((old_data = zend_hash_find(ht, Z_STR(key))) != NULL) { + if (Z_TYPE_P(old_data) == IS_INDIRECT) { +declared_property: + /* This is a property with a declaration */ + old_data = Z_INDIRECT_P(old_data); + info = zend_get_typed_property_info_for_slot(obj, old_data); + if (info) { + if (Z_ISREF_P(old_data)) { + /* If the value is overwritten, remove old type source from ref. */ + ZEND_REF_DEL_TYPE_SOURCE(Z_REF_P(old_data), info); + } - unmangled = zend_string_init(unmangled_prop, unmangled_prop_len, 0); - - existing_propinfo = zend_hash_find_ptr(&obj->ce->properties_info, unmangled); - if ((unmangled_class == NULL || !strcmp(unmangled_class, "*") || !strcasecmp(unmangled_class, ZSTR_VAL(obj->ce->name))) - && (existing_propinfo != NULL) - && (existing_propinfo->flags & ZEND_ACC_PPP_MASK)) { - if (existing_propinfo->flags & ZEND_ACC_PROTECTED) { - new_key = zend_mangle_property_name( - "*", 1, ZSTR_VAL(unmangled), ZSTR_LEN(unmangled), 0); - zend_string_release_ex(unmangled, 0); - } else if (existing_propinfo->flags & ZEND_ACC_PRIVATE) { - if (unmangled_class != NULL && strcmp(unmangled_class, "*") != 0) { - new_key = zend_mangle_property_name( - unmangled_class, strlen(unmangled_class), - ZSTR_VAL(unmangled), ZSTR_LEN(unmangled), - 0); - } else { - new_key = zend_mangle_property_name( - ZSTR_VAL(existing_propinfo->ce->name), ZSTR_LEN(existing_propinfo->ce->name), - ZSTR_VAL(unmangled), ZSTR_LEN(unmangled), - 0); - } - zend_string_release_ex(unmangled, 0); - } else { - ZEND_ASSERT(existing_propinfo->flags & ZEND_ACC_PUBLIC); - new_key = unmangled; + if ((*var_hash)->ref_props) { + /* Remove old entry from ref_props table, if it exists. */ + zend_hash_index_del( + (*var_hash)->ref_props, (zend_uintptr_t) old_data); } - zval_ptr_dtor_str(&key); - ZVAL_STR(&key, new_key); + } + var_push_dtor(var_hash, old_data); + Z_TRY_DELREF_P(old_data); + ZVAL_NULL(old_data); + data = old_data; + } else { + int ret = is_property_visibility_changed(obj->ce, &key); + + if (EXPECTED(!ret)) { + var_push_dtor(var_hash, old_data); + data = zend_hash_update(ht, Z_STR(key), &d); + } else if (ret < 0) { + goto failure; } else { - zend_string_release_ex(unmangled, 0); + goto second_try; } } + } else { + int ret = is_property_visibility_changed(obj->ce, &key); - if ((old_data = zend_hash_find(ht, Z_STR(key))) != NULL) { - if (Z_TYPE_P(old_data) == IS_INDIRECT) { - /* This is a property with a declaration */ - old_data = Z_INDIRECT_P(old_data); - info = zend_get_typed_property_info_for_slot(obj, old_data); - if (info) { - if (Z_ISREF_P(old_data)) { - /* If the value is overwritten, remove old type source from ref. */ - ZEND_REF_DEL_TYPE_SOURCE(Z_REF_P(old_data), info); - } - - if ((*var_hash)->ref_props) { - /* Remove old entry from ref_props table, if it exists. */ - zend_hash_index_del( - (*var_hash)->ref_props, (zend_uintptr_t) old_data); - } + if (EXPECTED(!ret)) { + data = zend_hash_add_new(ht, Z_STR(key), &d); + } else if (ret < 0) { + goto failure; + } else { +second_try: + if ((old_data = zend_hash_find(ht, Z_STR(key))) != NULL) { + if (Z_TYPE_P(old_data) == IS_INDIRECT) { + goto declared_property; + } else { + var_push_dtor(var_hash, old_data); + data = zend_hash_update(ht, Z_STR(key), &d); } - var_push_dtor(var_hash, old_data); - Z_TRY_DELREF_P(old_data); - ZVAL_COPY_VALUE(old_data, &d); - data = old_data; } else { - var_push_dtor(var_hash, old_data); - data = zend_hash_update_ind(ht, Z_STR(key), &d); + data = zend_hash_add_new(ht, Z_STR(key), &d); } - } else { - data = zend_hash_add_new(ht, Z_STR(key), &d); } - } else if (Z_TYPE(key) == IS_LONG) { - /* object properties should include no integers */ - convert_to_string(&key); - goto string_key; - } else { - zval_ptr_dtor(&key); - goto failure; } + zval_ptr_dtor_str(&key); + } else if (Z_TYPE(key) == IS_LONG) { + /* object properties should include no integers */ + convert_to_string(&key); + goto string_key; + } else { + zval_ptr_dtor(&key); + goto failure; } if (!php_var_unserialize_internal(data, p, max, var_hash, 0)) { @@ -595,7 +663,6 @@ string_key: * The data is still stored in the property. */ ZEND_REF_ADD_TYPE_SOURCE(Z_REF_P(data), info); } - zval_ptr_dtor(&key); goto failure; } @@ -603,7 +670,6 @@ string_key: if (!zend_verify_prop_assignable_by_ref(info, data, /* strict */ 1)) { zval_ptr_dtor(data); ZVAL_UNDEF(data); - zval_ptr_dtor_nogc(&key); goto failure; } @@ -624,7 +690,6 @@ string_key: if (BG(unserialize).level > 1) { var_push_dtor(var_hash, data); } - zval_ptr_dtor_str(&key); if (elements && *(*p-1) != ';' && *(*p-1) != '}') { (*p)--; @@ -688,10 +753,10 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce) #ifdef PHP_WIN32 # pragma optimize("", off) #endif -static inline int object_common(UNSERIALIZE_PARAMETER, zend_long elements, zend_bool has_unserialize) +static inline int object_common(UNSERIALIZE_PARAMETER, zend_long elements, bool has_unserialize) { HashTable *ht; - zend_bool has_wakeup; + bool has_wakeup; if (has_unserialize) { zval ary, *tmp; @@ -703,7 +768,7 @@ static inline int object_common(UNSERIALIZE_PARAMETER, zend_long elements, zend_ array_init_size(&ary, elements); /* Avoid reallocation due to packed -> mixed conversion. */ zend_hash_real_init_mixed(Z_ARRVAL(ary)); - if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_ARRVAL(ary), elements, NULL)) { + if (!process_nested_array_data(UNSERIALIZE_PASSTHRU, Z_ARRVAL(ary), elements)) { ZVAL_DEREF(rval); GC_ADD_FLAGS(Z_OBJ_P(rval), IS_OBJ_DESTRUCTOR_CALLED); zval_ptr_dtor(&ary); @@ -731,7 +796,7 @@ static inline int object_common(UNSERIALIZE_PARAMETER, zend_long elements, zend_ } zend_hash_extend(ht, zend_hash_num_elements(ht) + elements, HT_FLAGS(ht) & HASH_FLAG_PACKED); - if (!process_nested_data(UNSERIALIZE_PASSTHRU, ht, elements, Z_OBJ_P(rval))) { + if (!process_nested_object_data(UNSERIALIZE_PASSTHRU, ht, elements, Z_OBJ_P(rval))) { if (has_wakeup) { ZVAL_DEREF(rval); GC_ADD_FLAGS(Z_OBJ_P(rval), IS_OBJ_DESTRUCTOR_CALLED); @@ -1001,7 +1066,7 @@ use_double: *p = YYCURSOR; if (!var_hash) return 0; - if (elements < 0 || elements >= HT_MAX_SIZE || elements > max - YYCURSOR) { + if (elements < 0 || elements >= HT_MAX_SIZE || IS_FAKE_ELEM_COUNT(elements, max - YYCURSOR)) { return 0; } @@ -1021,7 +1086,7 @@ use_double: * prohibit "r:" references to non-objects, as we only generate them for objects. */ HT_ALLOW_COW_VIOLATION(Z_ARRVAL_P(rval)); - if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_ARRVAL_P(rval), elements, NULL)) { + if (!process_nested_array_data(UNSERIALIZE_PASSTHRU, Z_ARRVAL_P(rval), elements)) { return 0; } @@ -1034,9 +1099,9 @@ object ":" uiv ":" ["] { char *str; zend_string *class_name; zend_class_entry *ce; - zend_bool incomplete_class = 0; - zend_bool custom_object = 0; - zend_bool has_unserialize = 0; + bool incomplete_class = 0; + bool custom_object = 0; + bool has_unserialize = 0; zval user_func; zval retval; @@ -1067,22 +1132,55 @@ object ":" uiv ":" ["] { return 0; } - class_name = zend_string_init(str, len, 0); - if (!zend_is_valid_class_name(class_name)) { - zend_string_release_ex(class_name, 0); + if (len == 0) { + /* empty class names are not allowed */ + return 0; + } + + if (str[0] == '\000') { + /* runtime definition keys are not allowed */ return 0; } + if (str[0] == '\\') { + /* class name can't start from namespace separator */ + return 0; + } + + class_name = zend_string_init(str, len, 0); + do { - if(!unserialize_allowed_class(class_name, var_hash)) { + zend_string *lc_name = zend_string_tolower(class_name); + + if(!unserialize_allowed_class(lc_name, var_hash)) { + zend_string_release_ex(lc_name, 0); + if (!zend_is_valid_class_name(class_name)) { + zend_string_release_ex(class_name, 0); + return 0; + } incomplete_class = 1; ce = PHP_IC_ENTRY; break; } + ce = zend_hash_find_ptr(EG(class_table), lc_name); + if (ce + && (ce->ce_flags & ZEND_ACC_LINKED) + && !(ce->ce_flags & ZEND_ACC_ANON_CLASS)) { + zend_string_release_ex(lc_name, 0); + break; + } + + if (!zend_is_valid_class_name(class_name)) { + zend_string_release_ex(lc_name, 0); + zend_string_release_ex(class_name, 0); + return 0; + } + /* Try to find class directly */ BG(serialize_lock)++; - ce = zend_lookup_class(class_name); + ce = zend_lookup_class_ex(class_name, lc_name, 0); + zend_string_release_ex(lc_name, 0); if (ce) { BG(serialize_lock)--; if (EG(exception)) { @@ -1169,7 +1267,7 @@ object ":" uiv ":" ["] { } elements = parse_iv2(*p + 2, p); - if (elements < 0 || elements > max - YYCURSOR) { + if (elements < 0 || IS_FAKE_ELEM_COUNT(elements, max - YYCURSOR)) { zend_string_release_ex(class_name, 0); return 0; } diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c index dbdae6ecf7..f4f20c9850 100644 --- a/ext/standard/versioning.c +++ b/ext/standard/versioning.c @@ -203,37 +203,38 @@ php_version_compare(const char *orig_ver1, const char *orig_ver2) PHP_FUNCTION(version_compare) { - char *v1, *v2, *op = NULL; - size_t v1_len, v2_len, op_len = 0; + char *v1, *v2; + zend_string *op = NULL; + size_t v1_len, v2_len; int compare; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STRING(v1, v1_len) Z_PARAM_STRING(v2, v2_len) Z_PARAM_OPTIONAL - Z_PARAM_STRING_OR_NULL(op, op_len) + Z_PARAM_STR_OR_NULL(op) ZEND_PARSE_PARAMETERS_END(); compare = php_version_compare(v1, v2); if (!op) { RETURN_LONG(compare); } - if (!strncmp(op, "<", op_len) || !strncmp(op, "lt", op_len)) { + if (zend_string_equals_literal(op, "<") || zend_string_equals_literal(op, "lt")) { RETURN_BOOL(compare == -1); } - if (!strncmp(op, "<=", op_len) || !strncmp(op, "le", op_len)) { + if (zend_string_equals_literal(op, "<=") || zend_string_equals_literal(op, "le")) { RETURN_BOOL(compare != 1); } - if (!strncmp(op, ">", op_len) || !strncmp(op, "gt", op_len)) { + if (zend_string_equals_literal(op, ">") || zend_string_equals_literal(op, "gt")) { RETURN_BOOL(compare == 1); } - if (!strncmp(op, ">=", op_len) || !strncmp(op, "ge", op_len)) { + if (zend_string_equals_literal(op, ">=") || zend_string_equals_literal(op, "ge")) { RETURN_BOOL(compare != -1); } - if (!strncmp(op, "==", op_len) || !strncmp(op, "=", op_len) || !strncmp(op, "eq", op_len)) { + if (zend_string_equals_literal(op, "==") || zend_string_equals_literal(op, "=") || zend_string_equals_literal(op, "eq")) { RETURN_BOOL(compare == 0); } - if (!strncmp(op, "!=", op_len) || !strncmp(op, "<>", op_len) || !strncmp(op, "ne", op_len)) { + if (zend_string_equals_literal(op, "!=") || zend_string_equals_literal(op, "<>") || zend_string_equals_literal(op, "ne")) { RETURN_BOOL(compare != 0); } |