diff options
Diffstat (limited to 'ext/standard')
443 files changed, 1362 insertions, 12558 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index 297b0c0f38..c1cae18f58 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -799,13 +799,13 @@ PHP_FUNCTION(count) /* first, we check if the handler is defined */ if (Z_OBJ_HT_P(array)->count_elements) { RETVAL_LONG(1); - if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_LVAL_P(return_value))) { + if (SUCCESS == Z_OBJ_HT(*array)->count_elements(Z_OBJ_P(array), &Z_LVAL_P(return_value))) { return; } } /* if not and the object implements Countable we call its count() method */ if (instanceof_function(Z_OBJCE_P(array), zend_ce_countable)) { - zend_call_method_with_0_params(array, NULL, NULL, "count", &retval); + zend_call_method_with_0_params(Z_OBJ_P(array), NULL, NULL, "count", &retval); if (Z_TYPE(retval) != IS_UNDEF) { RETVAL_LONG(zval_get_long(&retval)); zval_ptr_dtor(&retval); @@ -1700,16 +1700,16 @@ static zend_always_inline int php_valid_var_name(const char *var_name, size_t va } /* }}} */ -PHPAPI int php_prefix_varname(zval *result, const zval *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore) /* {{{ */ +PHPAPI int php_prefix_varname(zval *result, zend_string *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore) /* {{{ */ { - ZVAL_NEW_STR(result, zend_string_alloc(Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0)); - memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix)); + ZVAL_NEW_STR(result, zend_string_alloc(ZSTR_LEN(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0)); + memcpy(Z_STRVAL_P(result), ZSTR_VAL(prefix), ZSTR_LEN(prefix)); if (add_underscore) { - Z_STRVAL_P(result)[Z_STRLEN_P(prefix)] = '_'; + Z_STRVAL_P(result)[ZSTR_LEN(prefix)] = '_'; } - memcpy(Z_STRVAL_P(result) + Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); + memcpy(Z_STRVAL_P(result) + ZSTR_LEN(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1); return SUCCESS; } @@ -1888,7 +1888,7 @@ static zend_long php_extract_overwrite(zend_array *arr, zend_array *symbol_table } /* }}} */ -static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -1944,7 +1944,7 @@ static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *s } /* }}} */ -static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -1995,7 +1995,7 @@ static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbo } /* }}} */ -static zend_long php_extract_ref_prefix_same(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_ref_prefix_same(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2069,7 +2069,7 @@ static zend_long php_extract_ref_prefix_same(zend_array *arr, zend_array *symbol } /* }}} */ -static zend_long php_extract_prefix_same(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_prefix_same(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2135,7 +2135,7 @@ static zend_long php_extract_prefix_same(zend_array *arr, zend_array *symbol_tab } /* }}} */ -static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2182,7 +2182,7 @@ static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_ } /* }}} */ -static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2229,7 +2229,7 @@ static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_tabl } /* }}} */ -static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2283,7 +2283,7 @@ static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *sym } /* }}} */ -static zend_long php_extract_prefix_invalid(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */ +static zend_long php_extract_prefix_invalid(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */ { zend_long count = 0; zend_string *var_name; @@ -2425,9 +2425,10 @@ static zend_long php_extract_skip(zend_array *arr, zend_array *symbol_table) /* Imports variables into symbol table from an array */ PHP_FUNCTION(extract) { - zval *var_array_param, *prefix = NULL; + zval *var_array_param; zend_long extract_refs; zend_long extract_type = EXTR_OVERWRITE; + zend_string *prefix = NULL; zend_long count; zend_array *symbol_table; @@ -2435,7 +2436,7 @@ PHP_FUNCTION(extract) Z_PARAM_ARRAY_EX2(var_array_param, 0, 1, 0) Z_PARAM_OPTIONAL Z_PARAM_LONG(extract_type) - Z_PARAM_ZVAL(prefix) + Z_PARAM_STR(prefix) ZEND_PARSE_PARAMETERS_END(); extract_refs = (extract_type & EXTR_REFS); @@ -2455,8 +2456,7 @@ PHP_FUNCTION(extract) } if (prefix) { - convert_to_string(prefix); - if (Z_STRLEN_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRLEN_P(prefix))) { + if (ZSTR_LEN(prefix) && !php_valid_var_name(ZSTR_VAL(prefix), ZSTR_LEN(prefix))) { php_error_docref(NULL, E_WARNING, "prefix is not a valid identifier"); return; } @@ -3226,7 +3226,7 @@ PHP_FUNCTION(array_pop) } ZVAL_COPY_DEREF(return_value, val); - if (!p->key && Z_ARRVAL_P(stack)->nNextFreeElement > 0 && p->h >= (zend_ulong)(Z_ARRVAL_P(stack)->nNextFreeElement - 1)) { + if (!p->key && (zend_long)p->h == (Z_ARRVAL_P(stack)->nNextFreeElement - 1)) { Z_ARRVAL_P(stack)->nNextFreeElement = Z_ARRVAL_P(stack)->nNextFreeElement - 1; } @@ -3468,14 +3468,14 @@ PHP_FUNCTION(array_splice) Returns elements specified by offset and length */ PHP_FUNCTION(array_slice) { - zval *input, /* Input array */ - *z_length = NULL, /* How many elements to get */ - *entry; /* An array entry */ - zend_long offset, /* Offset to get elements from */ - length = 0; - zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array or not */ - int num_in, /* Number of elements in the input array */ - pos; /* Current position in the array */ + zval *input; /* Input array */ + zval *entry; /* An array entry */ + zend_long offset; /* Offset to get elements from */ + zend_long length = 0; /* How many elements to get */ + zend_bool length_is_null = 1; /* Whether an explicit length has been omitted */ + zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array */ + uint32_t num_in; /* Number of elements in the input array */ + uint32_t pos; /* Current position in the array */ zend_string *string_key; zend_ulong num_key; @@ -3483,7 +3483,7 @@ PHP_FUNCTION(array_slice) Z_PARAM_ARRAY(input) Z_PARAM_LONG(offset) Z_PARAM_OPTIONAL - Z_PARAM_ZVAL(z_length) + Z_PARAM_LONG_EX(length, length_is_null, 1, 0) Z_PARAM_BOOL(preserve_keys) ZEND_PARSE_PARAMETERS_END(); @@ -3491,14 +3491,12 @@ PHP_FUNCTION(array_slice) num_in = zend_hash_num_elements(Z_ARRVAL_P(input)); /* We want all entries from offset to the end if length is not passed or is null */ - if (ZEND_NUM_ARGS() < 3 || Z_TYPE_P(z_length) == IS_NULL) { + if (length_is_null) { length = num_in; - } else { - length = zval_get_long(z_length); } /* Clamp the offset.. */ - if (offset > num_in) { + if (offset > (zend_long) num_in) { ZVAL_EMPTY_ARRAY(return_value); return; } else if (offset < 0 && (offset = (num_in + offset)) < 0) { @@ -4150,9 +4148,12 @@ static inline zval *array_column_fetch_prop(zval *data, zval *name, zval *rv) /* /* The has_property check is first performed in "exists" mode (which returns true for * properties that are null but exist) and then in "has" mode to handle objects that * implement __isset (which is not called in "exists" mode). */ - if (Z_OBJ_HANDLER_P(data, has_property)(data, name, ZEND_PROPERTY_EXISTS, NULL) - || Z_OBJ_HANDLER_P(data, has_property)(data, name, ZEND_PROPERTY_ISSET, NULL)) { - prop = Z_OBJ_HANDLER_P(data, read_property)(data, name, BP_VAR_R, NULL, rv); + zend_string *str, *tmp_str; + + str = zval_get_tmp_string(name, &tmp_str); + if (Z_OBJ_HANDLER_P(data, has_property)(Z_OBJ_P(data), str, ZEND_PROPERTY_EXISTS, NULL) + || Z_OBJ_HANDLER_P(data, has_property)(Z_OBJ_P(data), str, ZEND_PROPERTY_ISSET, NULL)) { + prop = Z_OBJ_HANDLER_P(data, read_property)(Z_OBJ_P(data), str, BP_VAR_R, NULL, rv); if (prop) { ZVAL_DEREF(prop); if (prop != rv) { @@ -4160,6 +4161,7 @@ static inline zval *array_column_fetch_prop(zval *data, zval *name, zval *rv) /* } } } + zend_tmp_string_release(tmp_str); } else if (Z_TYPE_P(data) == IS_ARRAY) { if (Z_TYPE_P(name) == IS_STRING) { prop = zend_symtable_find(Z_ARRVAL_P(data), Z_STR_P(name)); diff --git a/ext/standard/assert.c b/ext/standard/assert.c index eb1b59db74..28decb5033 100644 --- a/ext/standard/assert.c +++ b/ext/standard/assert.c @@ -29,7 +29,6 @@ ZEND_BEGIN_MODULE_GLOBALS(assert) zend_bool active; zend_bool bail; zend_bool warning; - zend_bool quiet_eval; zend_bool exception; ZEND_END_MODULE_GLOBALS(assert) @@ -46,7 +45,6 @@ enum { ASSERT_CALLBACK, ASSERT_BAIL, ASSERT_WARNING, - ASSERT_QUIET_EVAL, ASSERT_EXCEPTION }; @@ -81,7 +79,6 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("assert.bail", "0", PHP_INI_ALL, OnUpdateBool, bail, zend_assert_globals, assert_globals) STD_PHP_INI_ENTRY("assert.warning", "1", PHP_INI_ALL, OnUpdateBool, warning, zend_assert_globals, assert_globals) PHP_INI_ENTRY("assert.callback", NULL, PHP_INI_ALL, OnChangeCallback) - STD_PHP_INI_ENTRY("assert.quiet_eval", "0", PHP_INI_ALL, OnUpdateBool, quiet_eval, zend_assert_globals, assert_globals) STD_PHP_INI_ENTRY("assert.exception", "0", PHP_INI_ALL, OnUpdateBool, exception, zend_assert_globals, assert_globals) PHP_INI_END() @@ -104,7 +101,6 @@ PHP_MINIT_FUNCTION(assert) /* {{{ */ REGISTER_LONG_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ASSERT_EXCEPTION", ASSERT_EXCEPTION, CONST_CS|CONST_PERSISTENT); INIT_CLASS_ENTRY(ce, "AssertionError", NULL); @@ -147,9 +143,6 @@ PHP_FUNCTION(assert) { zval *assertion; zval *description = NULL; - int val; - char *myeval = NULL; - char *compiled_string_description; if (! ASSERTG(active)) { RETURN_TRUE; @@ -161,51 +154,7 @@ PHP_FUNCTION(assert) Z_PARAM_ZVAL(description) ZEND_PARSE_PARAMETERS_END(); - if (Z_TYPE_P(assertion) == IS_STRING) { - zval retval; - int old_error_reporting = 0; /* shut up gcc! */ - - if (zend_forbid_dynamic_call("assert() with string argument") == FAILURE) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, "Calling assert() with a string argument is deprecated"); - - myeval = Z_STRVAL_P(assertion); - - if (ASSERTG(quiet_eval)) { - old_error_reporting = EG(error_reporting); - EG(error_reporting) = 0; - } - - compiled_string_description = zend_make_compiled_string_description("assert code"); - if (zend_eval_stringl(myeval, Z_STRLEN_P(assertion), &retval, compiled_string_description) == FAILURE) { - efree(compiled_string_description); - if (!description) { - zend_throw_error(NULL, "Failure evaluating code: %s%s", PHP_EOL, myeval); - } else { - zend_string *str = zval_get_string(description); - zend_throw_error(NULL, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, ZSTR_VAL(str), myeval); - zend_string_release_ex(str, 0); - } - if (ASSERTG(bail)) { - zend_bailout(); - } - RETURN_FALSE; - } - efree(compiled_string_description); - - if (ASSERTG(quiet_eval)) { - EG(error_reporting) = old_error_reporting; - } - - convert_to_boolean(&retval); - val = Z_TYPE(retval) == IS_TRUE; - } else { - val = zend_is_true(assertion); - } - - if (val) { + if (zend_is_true(assertion)) { RETURN_TRUE; } @@ -220,8 +169,8 @@ PHP_FUNCTION(assert) const char *filename = zend_get_executed_filename(); ZVAL_STRING(&args[0], SAFE_STRING(filename)); - ZVAL_LONG (&args[1], lineno); - ZVAL_STRING(&args[2], SAFE_STRING(myeval)); + ZVAL_LONG(&args[1], lineno); + ZVAL_NULL(&args[2]); ZVAL_FALSE(&retval); @@ -255,18 +204,10 @@ PHP_FUNCTION(assert) } } else if (ASSERTG(warning)) { if (!description) { - if (myeval) { - php_error_docref(NULL, E_WARNING, "Assertion \"%s\" failed", myeval); - } else { - php_error_docref(NULL, E_WARNING, "Assertion failed"); - } + php_error_docref(NULL, E_WARNING, "Assertion failed"); } else { zend_string *str = zval_get_string(description); - if (myeval) { - php_error_docref(NULL, E_WARNING, "%s: \"%s\" failed", ZSTR_VAL(str), myeval); - } else { - php_error_docref(NULL, E_WARNING, "%s failed", ZSTR_VAL(str)); - } + php_error_docref(NULL, E_WARNING, "%s failed", ZSTR_VAL(str)); zend_string_release_ex(str, 0); } } @@ -320,18 +261,6 @@ PHP_FUNCTION(assert_options) RETURN_LONG(oldint); break; - case ASSERT_QUIET_EVAL: - oldint = ASSERTG(quiet_eval); - if (ac == 2) { - zend_string *value_str = zval_get_string(value); - key = zend_string_init("assert.quiet_eval", sizeof("assert.quiet_eval")-1, 0); - zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0); - zend_string_release_ex(key, 0); - zend_string_release_ex(value_str, 0); - } - RETURN_LONG(oldint); - break; - case ASSERT_WARNING: oldint = ASSERTG(warning); if (ac == 2) { diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index d281730afa..ccd14de59b 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1099,12 +1099,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_fgetc, 0) ZEND_ARG_INFO(0, fp) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetss, 0, 0, 1) - ZEND_ARG_INFO(0, fp) - ZEND_ARG_INFO(0, length) - ZEND_ARG_INFO(0, allowable_tags) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_fscanf, 0, 0, 2) ZEND_ARG_INFO(0, stream) ZEND_ARG_INFO(0, format) @@ -2392,7 +2386,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setlocale, 0, 0, 2) ZEND_ARG_VARIADIC_INFO(0, locales) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_str, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_str, 0, 0, 2) ZEND_ARG_INFO(0, encoded_string) ZEND_ARG_INFO(1, result) ZEND_END_ARG_INFO() @@ -3140,7 +3134,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(feof, arginfo_feof) PHP_FE(fgetc, arginfo_fgetc) PHP_FE(fgets, arginfo_fgets) - PHP_DEP_FE(fgetss, arginfo_fgetss) PHP_FE(fread, arginfo_fread) PHP_NAMED_FE(fopen, php_if_fopen, arginfo_fopen) PHP_FE(fpassthru, arginfo_fpassthru) diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h index 2fff4e736e..9c949e166c 100644 --- a/ext/standard/basic_functions.h +++ b/ext/standard/basic_functions.h @@ -156,7 +156,7 @@ PHP_RSHUTDOWN_FUNCTION(browscap); /* Left for BC (not binary safe!) */ PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers); PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, char *opt, char *headers); -PHPAPI int php_prefix_varname(zval *result, const zval *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore); +PHPAPI int php_prefix_varname(zval *result, zend_string *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore); #define MT_N (624) diff --git a/ext/standard/file.c b/ext/standard/file.c index cc3d4d2699..df4c50545b 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -691,7 +691,7 @@ PHP_FUNCTION(file_put_contents) if (Z_OBJ_HT_P(data) != NULL) { zval out; - if (zend_std_cast_object_tostring(data, &out, IS_STRING) == SUCCESS) { + if (zend_std_cast_object_tostring(Z_OBJ_P(data), &out, IS_STRING) == SUCCESS) { numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRLEN(out)); if (numbytes != Z_STRLEN(out)) { php_error_docref(NULL, E_WARNING, "Only "ZEND_LONG_FMT" of %zd bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out)); @@ -1090,55 +1090,6 @@ PHPAPI PHP_FUNCTION(fgetc) } /* }}} */ -/* {{{ proto string fgetss(resource fp [, int length [, string allowable_tags]]) - Get a line from file pointer and strip HTML tags */ -PHPAPI PHP_FUNCTION(fgetss) -{ - zval *fd; - zend_long bytes = 0; - size_t len = 0; - size_t actual_len, retval_len; - char *buf = NULL, *retval; - php_stream *stream; - char *allowed_tags=NULL; - size_t allowed_tags_len=0; - - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_RESOURCE(fd) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(bytes) - Z_PARAM_STRING(allowed_tags, allowed_tags_len) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); - - PHP_STREAM_TO_ZVAL(stream, fd); - - if (ZEND_NUM_ARGS() >= 2) { - if (bytes <= 0) { - php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0"); - RETURN_FALSE; - } - - len = (size_t) bytes; - buf = safe_emalloc(sizeof(char), (len + 1), 0); - /*needed because recv doesn't set null char at end*/ - memset(buf, 0, len + 1); - } - - if ((retval = php_stream_get_line(stream, buf, len, &actual_len)) == NULL) { - if (buf != NULL) { - efree(buf); - } - RETURN_FALSE; - } - - retval_len = php_strip_tags(retval, actual_len, &stream->fgetss_state, allowed_tags, allowed_tags_len); - - // TODO: avoid reallocation ??? - RETVAL_STRINGL(retval, retval_len); - efree(retval); -} -/* }}} */ - /* {{{ proto mixed fscanf(resource stream, string format [, string ...]) Implements a mostly ANSI compatible fscanf() */ PHP_FUNCTION(fscanf) @@ -1986,8 +1937,6 @@ PHP_FUNCTION(fgetcsv) char enclosure = '"'; /* allow this to be set as parameter */ int escape = (unsigned char) '\\'; - /* first section exactly as php_fgetss */ - zend_long len = 0; size_t buf_len; char *buf; diff --git a/ext/standard/file.h b/ext/standard/file.h index 3a059b5c83..f479989ea2 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -35,7 +35,6 @@ PHPAPI PHP_FUNCTION(fread); PHPAPI PHP_FUNCTION(fgetc); PHPAPI PHP_FUNCTION(fgets); PHP_FUNCTION(fscanf); -PHPAPI PHP_FUNCTION(fgetss); PHP_FUNCTION(fgetcsv); PHP_FUNCTION(fputcsv); PHPAPI PHP_FUNCTION(fwrite); diff --git a/ext/standard/filters.c b/ext/standard/filters.c index 9d90558f59..5df7c623fd 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -166,129 +166,6 @@ static const php_stream_filter_factory strfilter_tolower_factory = { }; /* }}} */ -/* {{{ strip_tags filter implementation */ -typedef struct _php_strip_tags_filter { - const char *allowed_tags; - int allowed_tags_len; - uint8_t state; - uint8_t persistent; -} php_strip_tags_filter; - -static int php_strip_tags_filter_ctor(php_strip_tags_filter *inst, zend_string *allowed_tags, int persistent) -{ - if (allowed_tags != NULL) { - if (NULL == (inst->allowed_tags = pemalloc(ZSTR_LEN(allowed_tags) + 1, persistent))) { - return FAILURE; - } - memcpy((char *)inst->allowed_tags, ZSTR_VAL(allowed_tags), ZSTR_LEN(allowed_tags) + 1); - inst->allowed_tags_len = (int)ZSTR_LEN(allowed_tags); - } else { - inst->allowed_tags = NULL; - } - inst->state = 0; - inst->persistent = persistent; - - return SUCCESS; -} - -static void php_strip_tags_filter_dtor(php_strip_tags_filter *inst) -{ - if (inst->allowed_tags != NULL) { - pefree((void *)inst->allowed_tags, inst->persistent); - } -} - -static php_stream_filter_status_t strfilter_strip_tags_filter( - php_stream *stream, - php_stream_filter *thisfilter, - php_stream_bucket_brigade *buckets_in, - php_stream_bucket_brigade *buckets_out, - size_t *bytes_consumed, - int flags - ) -{ - php_stream_bucket *bucket; - size_t consumed = 0; - php_strip_tags_filter *inst = (php_strip_tags_filter *) Z_PTR(thisfilter->abstract); - - while (buckets_in->head) { - bucket = php_stream_bucket_make_writeable(buckets_in->head); - consumed = bucket->buflen; - - bucket->buflen = php_strip_tags(bucket->buf, bucket->buflen, &(inst->state), inst->allowed_tags, inst->allowed_tags_len); - - php_stream_bucket_append(buckets_out, bucket); - } - - if (bytes_consumed) { - *bytes_consumed = consumed; - } - - return PSFS_PASS_ON; -} - -static void strfilter_strip_tags_dtor(php_stream_filter *thisfilter) -{ - assert(Z_PTR(thisfilter->abstract) != NULL); - - php_strip_tags_filter_dtor((php_strip_tags_filter *)Z_PTR(thisfilter->abstract)); - - pefree(Z_PTR(thisfilter->abstract), ((php_strip_tags_filter *)Z_PTR(thisfilter->abstract))->persistent); -} - -static const php_stream_filter_ops strfilter_strip_tags_ops = { - strfilter_strip_tags_filter, - strfilter_strip_tags_dtor, - "string.strip_tags" -}; - -static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zval *filterparams, uint8_t persistent) -{ - php_strip_tags_filter *inst; - php_stream_filter *filter = NULL; - zend_string *allowed_tags = NULL; - - php_error_docref(NULL, E_DEPRECATED, "The string.strip_tags filter is deprecated"); - - inst = pemalloc(sizeof(php_strip_tags_filter), persistent); - - if (filterparams != NULL) { - if (Z_TYPE_P(filterparams) == IS_ARRAY) { - smart_str tags_ss = {0}; - zval *tmp; - - ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(filterparams), tmp) { - convert_to_string_ex(tmp); - smart_str_appendc(&tags_ss, '<'); - smart_str_append(&tags_ss, Z_STR_P(tmp)); - smart_str_appendc(&tags_ss, '>'); - } ZEND_HASH_FOREACH_END(); - smart_str_0(&tags_ss); - allowed_tags = tags_ss.s; - } else { - allowed_tags = zval_get_string(filterparams); - } - } - - if (php_strip_tags_filter_ctor(inst, allowed_tags, persistent) == SUCCESS) { - filter = php_stream_filter_alloc(&strfilter_strip_tags_ops, inst, persistent); - } else { - pefree(inst, persistent); - } - - if (allowed_tags) { - zend_string_release(allowed_tags); - } - - return filter; -} - -static const php_stream_filter_factory strfilter_strip_tags_factory = { - strfilter_strip_tags_create -}; - -/* }}} */ - /* {{{ base64 / quoted_printable stream filter implementation */ typedef enum _php_conv_err_t { @@ -2037,7 +1914,6 @@ static const struct { { &strfilter_rot13_ops, &strfilter_rot13_factory }, { &strfilter_toupper_ops, &strfilter_toupper_factory }, { &strfilter_tolower_ops, &strfilter_tolower_factory }, - { &strfilter_strip_tags_ops, &strfilter_strip_tags_factory }, { &strfilter_convert_ops, &strfilter_convert_factory }, { &consumed_filter_ops, &consumed_filter_factory }, { &chunked_filter_ops, &chunked_filter_factory }, diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index f38fae5f53..0df21e37d7 100644 --- a/ext/standard/incomplete_class.c +++ b/ext/standard/incomplete_class.c @@ -32,7 +32,7 @@ static zend_object_handlers php_incomplete_object_handlers; /* {{{ incomplete_class_message */ -static void incomplete_class_message(zval *object, int error_type) +static void incomplete_class_message(zend_object *object, int error_type) { zend_string *class_name; @@ -47,7 +47,7 @@ static void incomplete_class_message(zval *object, int error_type) } /* }}} */ -static zval *incomplete_class_get_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */ +static zval *incomplete_class_get_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */ { incomplete_class_message(object, E_NOTICE); @@ -60,27 +60,27 @@ static zval *incomplete_class_get_property(zval *object, zval *member, int type, } /* }}} */ -static zval *incomplete_class_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */ +static zval *incomplete_class_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) /* {{{ */ { incomplete_class_message(object, E_NOTICE); return value; } /* }}} */ -static zval *incomplete_class_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */ +static zval *incomplete_class_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) /* {{{ */ { incomplete_class_message(object, E_NOTICE); return &EG(error_zval); } /* }}} */ -static void incomplete_class_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */ +static void incomplete_class_unset_property(zend_object *object, zend_string *member, void **cache_slot) /* {{{ */ { incomplete_class_message(object, E_NOTICE); } /* }}} */ -static int incomplete_class_has_property(zval *object, zval *member, int check_empty, void **cache_slot) /* {{{ */ +static int incomplete_class_has_property(zend_object *object, zend_string *member, int check_empty, void **cache_slot) /* {{{ */ { incomplete_class_message(object, E_NOTICE); return 0; @@ -89,10 +89,7 @@ static int incomplete_class_has_property(zval *object, zval *member, int check_e static zend_function *incomplete_class_get_method(zend_object **object, zend_string *method, const zval *key) /* {{{ */ { - zval zobject; - - ZVAL_OBJ(&zobject, *object); - incomplete_class_message(&zobject, E_ERROR); + incomplete_class_message(*object, E_ERROR); return NULL; } /* }}} */ @@ -132,15 +129,14 @@ PHPAPI zend_class_entry *php_create_incomplete_class(void) /* {{{ php_lookup_class_name */ -PHPAPI zend_string *php_lookup_class_name(zval *object) +PHPAPI zend_string *php_lookup_class_name(zend_object *object) { - zval *val; - HashTable *object_properties; - - object_properties = Z_OBJPROP_P(object); + if (object->properties) { + zval *val = zend_hash_str_find(object->properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1); - if ((val = zend_hash_str_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1)) != NULL && Z_TYPE_P(val) == IS_STRING) { - return zend_string_copy(Z_STR_P(val)); + if (val != NULL && Z_TYPE_P(val) == IS_STRING) { + return zend_string_copy(Z_STR_P(val)); + } } return NULL; diff --git a/ext/standard/password.c b/ext/standard/password.c index 3f1ff6dd55..4a4d99dc6e 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -52,19 +52,6 @@ void php_password_algo_unregister(const char *ident) { zend_hash_str_del(&php_password_algos, ident, strlen(ident)); } -static int php_password_salt_is_alphabet(const char *str, const size_t len) /* {{{ */ -{ - size_t i = 0; - - for (i = 0; i < len; i++) { - if (!((str[i] >= 'A' && str[i] <= 'Z') || (str[i] >= 'a' && str[i] <= 'z') || (str[i] >= '0' && str[i] <= '9') || str[i] == '.' || str[i] == '/')) { - return FAILURE; - } - } - return SUCCESS; -} -/* }}} */ - static int php_password_salt_to64(const char *str, const size_t str_len, const size_t out_len, char *ret) /* {{{ */ { size_t pos = 0; @@ -123,65 +110,11 @@ static zend_string* php_password_make_salt(size_t length) /* {{{ */ /* }}} */ static zend_string* php_password_get_salt(zval *unused_, size_t required_salt_len, HashTable *options) { - zend_string *buffer; - zval *option_buffer; - - if (!options || !(option_buffer = zend_hash_str_find(options, "salt", sizeof("salt") - 1))) { - return php_password_make_salt(required_salt_len); - } - - php_error_docref(NULL, E_DEPRECATED, "Use of the 'salt' option to password_hash is deprecated"); - - switch (Z_TYPE_P(option_buffer)) { - case IS_STRING: - buffer = zend_string_copy(Z_STR_P(option_buffer)); - break; - case IS_LONG: - case IS_DOUBLE: - case IS_OBJECT: - buffer = zval_get_string(option_buffer); - break; - case IS_FALSE: - case IS_TRUE: - case IS_NULL: - case IS_RESOURCE: - case IS_ARRAY: - default: - php_error_docref(NULL, E_WARNING, "Non-string salt parameter supplied"); - return NULL; - } - - /* XXX all the crypt related APIs work with int for string length. - That should be revised for size_t and then we maybe don't require - the > INT_MAX check. */ - if (ZEND_SIZE_T_INT_OVFL(ZSTR_LEN(buffer))) { - php_error_docref(NULL, E_WARNING, "Supplied salt is too long"); - zend_string_release_ex(buffer, 0); - return NULL; - } - - if (ZSTR_LEN(buffer) < required_salt_len) { - php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd expecting %zd", ZSTR_LEN(buffer), required_salt_len); - zend_string_release_ex(buffer, 0); - return NULL; + if (options && zend_hash_str_exists(options, "salt", sizeof("salt") - 1)) { + php_error_docref(NULL, E_WARNING, "The 'salt' option is no longer supported. The provided salt has been been ignored"); } - if (php_password_salt_is_alphabet(ZSTR_VAL(buffer), ZSTR_LEN(buffer)) == FAILURE) { - zend_string *salt = zend_string_alloc(required_salt_len, 0); - if (php_password_salt_to64(ZSTR_VAL(buffer), ZSTR_LEN(buffer), required_salt_len, ZSTR_VAL(salt)) == FAILURE) { - php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd", ZSTR_LEN(buffer)); - zend_string_release_ex(salt, 0); - zend_string_release_ex(buffer, 0); - return NULL; - } - zend_string_release_ex(buffer, 0); - return salt; - } else { - zend_string *salt = zend_string_alloc(required_salt_len, 0); - memcpy(ZSTR_VAL(salt), ZSTR_VAL(buffer), required_salt_len); - zend_string_release_ex(buffer, 0); - return salt; - } + return php_password_make_salt(required_salt_len); } /* bcrypt implementation */ diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h index d768f25bdb..eeb4461965 100644 --- a/ext/standard/php_incomplete_class.h +++ b/ext/standard/php_incomplete_class.h @@ -27,7 +27,7 @@ #define PHP_SET_CLASS_ATTRIBUTES(struc) \ /* OBJECTS_FIXME: Fix for new object model */ \ if (Z_OBJCE_P(struc) == BG(incomplete_class)) { \ - class_name = php_lookup_class_name(struc); \ + class_name = php_lookup_class_name(Z_OBJ_P(struc)); \ if (!class_name) { \ class_name = zend_string_init(INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1, 0); \ } \ @@ -51,7 +51,7 @@ extern "C" { #endif PHPAPI zend_class_entry *php_create_incomplete_class(void); -PHPAPI zend_string *php_lookup_class_name(zval *object); +PHPAPI zend_string *php_lookup_class_name(zend_object *object); PHPAPI void php_store_class_name(zval *object, const char *name, size_t len); #ifdef __cplusplus diff --git a/ext/standard/random.c b/ext/standard/random.c index f6568a658f..01d99a5eef 100644 --- a/ext/standard/random.c +++ b/ext/standard/random.c @@ -194,7 +194,7 @@ PHP_FUNCTION(random_bytes) zend_long size; zend_string *bytes; - ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 1) + ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_LONG(size) ZEND_PARSE_PARAMETERS_END(); @@ -268,7 +268,7 @@ PHP_FUNCTION(random_int) zend_long max; zend_long result; - ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 2, 2) + ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_LONG(min) Z_PARAM_LONG(max) ZEND_PARSE_PARAMETERS_END(); diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 9b6e05de65..8fe7b2d225 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -1671,8 +1671,7 @@ PHP_FUNCTION(sapi_windows_vt100_support) php_stream_cast(stream, PHP_STREAM_AS_FD, (void*)&fileno, 0); } else { - zend_internal_type_error( - ZEND_ARG_USES_STRICT_TYPES(), + zend_type_error( "%s() was not able to analyze the specified stream", get_active_function_name() ); diff --git a/ext/standard/string.c b/ext/standard/string.c index 91cb14da4b..1f18bb23d8 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1813,79 +1813,34 @@ PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end) } /* }}} */ -/* {{{ php_needle_char - */ -static int php_needle_char(zval *needle, char *target) -{ - switch (Z_TYPE_P(needle)) { - case IS_LONG: - *target = (char)Z_LVAL_P(needle); - return SUCCESS; - case IS_NULL: - case IS_FALSE: - *target = '\0'; - return SUCCESS; - case IS_TRUE: - *target = '\1'; - return SUCCESS; - case IS_DOUBLE: - *target = (char)(int)Z_DVAL_P(needle); - return SUCCESS; - case IS_OBJECT: - *target = (char) zval_get_long(needle); - return SUCCESS; - default: - php_error_docref(NULL, E_WARNING, "needle is not a string or an integer"); - return FAILURE; - } -} -/* }}} */ - /* {{{ proto string stristr(string haystack, string needle[, bool part]) Finds first occurrence of a string within another, case insensitive */ PHP_FUNCTION(stristr) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; size_t found_offset; char *haystack_dup; - char needle_char[2]; + char *orig_needle; zend_bool part = 0; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_BOOL(part) ZEND_PARSE_PARAMETERS_END(); - haystack_dup = estrndup(ZSTR_VAL(haystack), ZSTR_LEN(haystack)); - - if (Z_TYPE_P(needle) == IS_STRING) { - char *orig_needle; - if (!Z_STRLEN_P(needle)) { - php_error_docref(NULL, E_WARNING, "Empty needle"); - efree(haystack_dup); - RETURN_FALSE; - } - orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle)); - found = php_stristr(haystack_dup, orig_needle, ZSTR_LEN(haystack), Z_STRLEN_P(needle)); - efree(orig_needle); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - efree(haystack_dup); - RETURN_FALSE; - } - needle_char[1] = 0; - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = php_stristr(haystack_dup, needle_char, ZSTR_LEN(haystack), 1); + if (!ZSTR_LEN(needle)) { + php_error_docref(NULL, E_WARNING, "Empty needle"); + RETURN_FALSE; } + haystack_dup = estrndup(ZSTR_VAL(haystack), ZSTR_LEN(haystack)); + orig_needle = estrndup(ZSTR_VAL(needle), ZSTR_LEN(needle)); + found = php_stristr(haystack_dup, orig_needle, ZSTR_LEN(haystack), ZSTR_LEN(needle)); + efree(orig_needle); + if (found) { found_offset = found - haystack_dup; if (part) { @@ -1905,40 +1860,25 @@ PHP_FUNCTION(stristr) Finds first occurrence of a string within another */ PHP_FUNCTION(strstr) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; - char needle_char[2]; zend_long found_offset; zend_bool part = 0; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_BOOL(part) ZEND_PARSE_PARAMETERS_END(); - if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRLEN_P(needle)) { - php_error_docref(NULL, E_WARNING, "Empty needle"); - RETURN_FALSE; - } - - found = php_memnstr(ZSTR_VAL(haystack), Z_STRVAL_P(needle), Z_STRLEN_P(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - RETURN_FALSE; - } - needle_char[1] = 0; - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = php_memnstr(ZSTR_VAL(haystack), needle_char, 1, ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); + if (!ZSTR_LEN(needle)) { + php_error_docref(NULL, E_WARNING, "Empty needle"); + RETURN_FALSE; } + found = php_memnstr(ZSTR_VAL(haystack), ZSTR_VAL(needle), ZSTR_LEN(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); + if (found) { found_offset = found - ZSTR_VAL(haystack); if (part) { @@ -1959,15 +1899,13 @@ PHP_FUNCTION(strstr) Finds position of first occurrence of a string within another */ PHP_FUNCTION(strpos) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; - char needle_char[2]; - zend_long offset = 0; + zend_long offset = 0; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END(); @@ -1980,32 +1918,15 @@ PHP_FUNCTION(strpos) RETURN_FALSE; } - if (Z_TYPE_P(needle) == IS_STRING) { - if (!Z_STRLEN_P(needle)) { - php_error_docref(NULL, E_WARNING, "Empty needle"); - RETURN_FALSE; - } - - found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset, - Z_STRVAL_P(needle), - Z_STRLEN_P(needle), - ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - RETURN_FALSE; - } - needle_char[1] = 0; - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset, - needle_char, - 1, - ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); + if (!ZSTR_LEN(needle)) { + php_error_docref(NULL, E_WARNING, "Empty needle"); + RETURN_FALSE; } + found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset, + ZSTR_VAL(needle), ZSTR_LEN(needle), + ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); + if (found) { RETURN_LONG(found - ZSTR_VAL(haystack)); } else { @@ -2019,15 +1940,13 @@ PHP_FUNCTION(strpos) PHP_FUNCTION(stripos) { const char *found = NULL; - zend_string *haystack; + zend_string *haystack, *needle; zend_long offset = 0; - char needle_char[2]; - zval *needle; zend_string *needle_dup = NULL, *haystack_dup; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END(); @@ -2044,33 +1963,14 @@ PHP_FUNCTION(stripos) RETURN_FALSE; } - if (Z_TYPE_P(needle) == IS_STRING) { - if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > ZSTR_LEN(haystack)) { - RETURN_FALSE; - } - - haystack_dup = php_string_tolower(haystack); - needle_dup = php_string_tolower(Z_STR_P(needle)); - found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset, - ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack)); - } else { - if (php_needle_char(needle, needle_char) != SUCCESS) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - haystack_dup = php_string_tolower(haystack); - needle_char[0] = tolower(needle_char[0]); - needle_char[1] = '\0'; - found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset, - needle_char, - sizeof(needle_char) - 1, - ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack)); + if (ZSTR_LEN(needle) == 0 || ZSTR_LEN(needle) > ZSTR_LEN(haystack)) { + RETURN_FALSE; } + haystack_dup = php_string_tolower(haystack); + needle_dup = php_string_tolower(needle); + found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset, + ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack)); if (found) { RETVAL_LONG(found - ZSTR_VAL(haystack_dup)); @@ -2089,38 +1989,20 @@ PHP_FUNCTION(stripos) Finds position of last occurrence of a string within another string */ PHP_FUNCTION(strrpos) { - zval *zneedle; zend_string *haystack; + char *needle; size_t needle_len; zend_long offset = 0; - char ord_needle[2]; - const char *p, *e, *found, *needle; + const char *p, *e, *found; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(zneedle) + Z_PARAM_STRING(needle, needle_len) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); - if (Z_TYPE_P(zneedle) == IS_STRING) { - needle = Z_STRVAL_P(zneedle); - needle_len = Z_STRLEN_P(zneedle); - } else { - if (php_needle_char(zneedle, ord_needle) != SUCCESS) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - ord_needle[1] = '\0'; - needle = ord_needle; - needle_len = 1; - } - - if ((ZSTR_LEN(haystack) == 0) || (needle_len == 0)) { + if (ZSTR_LEN(haystack) == 0 || needle_len == 0) { RETURN_FALSE; } @@ -2156,49 +2038,29 @@ PHP_FUNCTION(strrpos) Finds position of last occurrence of a string within another string */ PHP_FUNCTION(strripos) { - zval *zneedle; zend_string *needle; zend_string *haystack; zend_long offset = 0; const char *p, *e, *found; - zend_string *needle_dup, *haystack_dup, *ord_needle = NULL; - ALLOCA_FLAG(use_heap); + zend_string *needle_dup, *haystack_dup; ZEND_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(zneedle) + Z_PARAM_STR(needle) Z_PARAM_OPTIONAL Z_PARAM_LONG(offset) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); - ZSTR_ALLOCA_ALLOC(ord_needle, 1, use_heap); - if (Z_TYPE_P(zneedle) == IS_STRING) { - needle = Z_STR_P(zneedle); - } else { - if (php_needle_char(zneedle, ZSTR_VAL(ord_needle)) != SUCCESS) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - ZSTR_VAL(ord_needle)[1] = '\0'; - needle = ord_needle; - } - - if ((ZSTR_LEN(haystack) == 0) || (ZSTR_LEN(needle) == 0)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); + if (ZSTR_LEN(haystack) == 0 || ZSTR_LEN(needle) == 0) { RETURN_FALSE; } if (ZSTR_LEN(needle) == 1) { /* Single character search can shortcut memcmps Can also avoid tolower emallocs */ + char lowered; if (offset >= 0) { if ((size_t)offset > ZSTR_LEN(haystack)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } @@ -2207,22 +2069,19 @@ PHP_FUNCTION(strripos) } else { p = ZSTR_VAL(haystack); if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) + (size_t)offset; } /* Borrow that ord_needle buffer to avoid repeatedly tolower()ing needle */ - *ZSTR_VAL(ord_needle) = tolower(*ZSTR_VAL(needle)); + lowered = tolower(*ZSTR_VAL(needle)); while (e >= p) { - if (tolower(*e) == *ZSTR_VAL(ord_needle)) { - ZSTR_ALLOCA_FREE(ord_needle, use_heap); + if (tolower(*e) == lowered) { RETURN_LONG(e - p + (offset > 0 ? offset : 0)); } e--; } - ZSTR_ALLOCA_FREE(ord_needle, use_heap); RETURN_FALSE; } @@ -2230,7 +2089,6 @@ PHP_FUNCTION(strripos) if (offset >= 0) { if ((size_t)offset > ZSTR_LEN(haystack)) { zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } @@ -2239,7 +2097,6 @@ PHP_FUNCTION(strripos) } else { if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) { zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } @@ -2256,11 +2113,9 @@ PHP_FUNCTION(strripos) RETVAL_LONG(found - ZSTR_VAL(haystack_dup)); zend_string_release_ex(needle_dup, 0); zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); } else { zend_string_release_ex(needle_dup, 0); zend_string_release_ex(haystack_dup, 0); - ZSTR_ALLOCA_FREE(ord_needle, use_heap); RETURN_FALSE; } } @@ -2270,31 +2125,16 @@ PHP_FUNCTION(strripos) Finds the last occurrence of a character in a string within another */ PHP_FUNCTION(strrchr) { - zval *needle; - zend_string *haystack; + zend_string *haystack, *needle; const char *found = NULL; zend_long found_offset; ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(haystack) - Z_PARAM_ZVAL(needle) + Z_PARAM_STR(needle) ZEND_PARSE_PARAMETERS_END(); - if (Z_TYPE_P(needle) == IS_STRING) { - found = zend_memrchr(ZSTR_VAL(haystack), *Z_STRVAL_P(needle), ZSTR_LEN(haystack)); - } else { - char needle_chr; - if (php_needle_char(needle, &needle_chr) != SUCCESS) { - RETURN_FALSE; - } - - php_error_docref(NULL, E_DEPRECATED, - "Non-string needles will be interpreted as strings in the future. " \ - "Use an explicit chr() call to preserve the current behavior"); - - found = zend_memrchr(ZSTR_VAL(haystack), needle_chr, ZSTR_LEN(haystack)); - } - + found = zend_memrchr(ZSTR_VAL(haystack), *ZSTR_VAL(needle), ZSTR_LEN(haystack)); if (found) { found_offset = found - ZSTR_VAL(haystack); RETURN_STRINGL(found, ZSTR_LEN(haystack) - found_offset); @@ -2752,8 +2592,8 @@ PHP_FUNCTION(quotemeta) old_end = ZSTR_VAL(old) + ZSTR_LEN(old); - if (ZSTR_VAL(old) == old_end) { - RETURN_FALSE; + if (ZSTR_LEN(old) == 0) { + RETURN_EMPTY_STRING(); } str = zend_string_safe_alloc(2, ZSTR_LEN(old), 0, 0); @@ -4918,7 +4758,7 @@ PHP_FUNCTION(setlocale) } /* }}} */ -/* {{{ proto void parse_str(string encoded_string [, array &result]) +/* {{{ proto void parse_str(string encoded_string, array &result) Parses GET/POST/COOKIE data and sets global variables */ PHP_FUNCTION(parse_str) { @@ -4927,38 +4767,18 @@ PHP_FUNCTION(parse_str) char *res = NULL; size_t arglen; - ZEND_PARSE_PARAMETERS_START(1, 2) + ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STRING(arg, arglen) - Z_PARAM_OPTIONAL Z_PARAM_ZVAL(arrayArg) ZEND_PARSE_PARAMETERS_END(); - res = estrndup(arg, arglen); - - if (arrayArg == NULL) { - zval tmp; - zend_array *symbol_table; - if (zend_forbid_dynamic_call("parse_str() with a single argument") == FAILURE) { - efree(res); - return; - } - - php_error_docref(NULL, E_DEPRECATED, "Calling parse_str() without the result argument is deprecated"); - - symbol_table = zend_rebuild_symbol_table(); - ZVAL_ARR(&tmp, symbol_table); - sapi_module.treat_data(PARSE_STRING, res, &tmp); - if (UNEXPECTED(zend_hash_del(symbol_table, ZSTR_KNOWN(ZEND_STR_THIS)) == SUCCESS)) { - zend_throw_error(NULL, "Cannot re-assign $this"); - } - } else { - arrayArg = zend_try_array_init(arrayArg); - if (!arrayArg) { - return; - } - - sapi_module.treat_data(PARSE_STRING, res, arrayArg); + arrayArg = zend_try_array_init(arrayArg); + if (!arrayArg) { + return; } + + res = estrndup(arg, arglen); + sapi_module.treat_data(PARSE_STRING, res, arrayArg); } /* }}} */ diff --git a/ext/standard/tests/array/005.phpt b/ext/standard/tests/array/005.phpt index c82f5f7fd0..c51e98a67b 100644 --- a/ext/standard/tests/array/005.phpt +++ b/ext/standard/tests/array/005.phpt @@ -33,18 +33,6 @@ $mixed_array = array( /* Testing Error Conditions */ echo "\n*** Testing Error Conditions ***\n"; -/* Zero argument */ -var_dump( array_shift() ); - -/* Scalar argument */ -var_dump( array_shift($number) ); - -/* String argument */ -var_dump( array_shift($str) ); - -/* Invalid Number of arguments */ -var_dump( array_shift($mixed_array[1],$mixed_array[2]) ); - /* Empty Array as argument */ var_dump( array_shift($empty_array) ); @@ -83,18 +71,6 @@ echo"Done"; ?> --EXPECTF-- *** Testing Error Conditions *** - -Warning: array_shift() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: array_shift() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_shift() expects exactly 1 parameter, 2 given in %s on line %d -NULL NULL *** Testing with various array inputs *** diff --git a/ext/standard/tests/array/009.phpt b/ext/standard/tests/array/009.phpt index 017456917e..c62be0d27c 100644 --- a/ext/standard/tests/array/009.phpt +++ b/ext/standard/tests/array/009.phpt @@ -69,51 +69,6 @@ foreach ($varient_arrays as $sub_array ) { echo "\n"; } -/*test these functions on array which is already unset */ -echo "\n-- Testing variation: when array is unset --\n"; -$unset_array = array (1); -unset($unset_array); - -var_dump( current($unset_array) ); -var_dump( key($unset_array) ); -var_dump( next($unset_array) ); -var_dump( reset($unset_array) ); - - -echo "\n*** Testing error conditions ***\n"; -//Zero argument, expected 1 argument -var_dump( key() ); -var_dump( current() ); -var_dump( reset() ); -var_dump( next() ); - -// args more than expected, expected 1 argument -$temp_array = array(1); -var_dump( key($temp_array, $temp_array) ); -var_dump( current($temp_array, $temp_array) ); -var_dump( reset($temp_array, $temp_array) ); -var_dump( next($temp_array, $temp_array) ); - -// invalid args type, valid argument: array -$int_var = 1; -$float_var = 1.5; -$string = "string"; -var_dump( key($int_var) ); -var_dump( key($float_var) ); -var_dump( key($string) ); - -var_dump( current($int_var) ); -var_dump( current($float_var) ); -var_dump( current($string) ); - -var_dump( next($int_var) ); -var_dump( next($float_var) ); -var_dump( next($string) ); - -var_dump( reset($int_var) ); -var_dump( reset($float_var) ); -var_dump( reset($string) ); - echo "Done\n"; ?> --EXPECTF-- @@ -456,84 +411,4 @@ array(5) { string(4) "zero" } - --- Testing variation: when array is unset -- - -Notice: Undefined variable: unset_array in %s on line %d - -Warning: current() expects parameter 1 to be array, null given in %s on line %d -NULL - -Notice: Undefined variable: unset_array in %s on line %d - -Warning: key() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, null given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, null given in %s on line %d -NULL - -*** Testing error conditions *** - -Warning: key() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: current() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: reset() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: next() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: key() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: current() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: reset() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: next() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: key() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: key() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: key() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: current() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: current() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: current() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: next() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, float given in %s on line %d -NULL - -Warning: reset() expects parameter 1 to be array, string given in %s on line %d -NULL Done diff --git a/ext/standard/tests/array/array_change_key_case_variation.phpt b/ext/standard/tests/array/array_change_key_case_variation.phpt index 3f8d502ffe..f2b185523f 100644 --- a/ext/standard/tests/array/array_change_key_case_variation.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation.phpt @@ -6,13 +6,16 @@ Test array_change_key_case() function - 2 $item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four"); /* use 'case' argument other than CASE_LOWER & CASE_UPPER */ -var_dump(array_change_key_case($item, "CASE_UPPER")); +try { + var_dump(array_change_key_case($item, "CASE_UPPER")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(array_change_key_case($item, 5)); /* when keys are different in terms of only case */ /* should return one value key pair with key being in lowercase */ var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) ) ); -var_dump( array_change_key_case( array("ONE" => 1, "one" => 6, "One" => 5), "CASE_UPPER" ) ); /* should return one value key pair with key being in uppercase */ var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3), CASE_UPPER ) ); @@ -21,8 +24,7 @@ var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5 ) echo "end\n"; ?> --EXPECTF-- -Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d -NULL +array_change_key_case() expects parameter 2 to be int, string given array(4) { ["ONE"]=> int(1) @@ -37,9 +39,6 @@ array(1) { ["one"]=> int(4) } - -Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d -NULL array(1) { ["ONE"]=> int(3) diff --git a/ext/standard/tests/array/array_column_error.phpt b/ext/standard/tests/array/array_column_error.phpt index 26a09aff24..9223248520 100644 --- a/ext/standard/tests/array/array_column_error.phpt +++ b/ext/standard/tests/array/array_column_error.phpt @@ -11,18 +11,6 @@ Test array_column() function: error conditions echo "*** Testing array_column() : error conditions ***\n"; -echo "\n-- Testing array_column() function with Zero arguments --\n"; -var_dump(array_column()); - -echo "\n-- Testing array_column() function with One argument --\n"; -var_dump(array_column(array())); - -echo "\n-- Testing array_column() function with string as first parameter --\n"; -var_dump(array_column('foo', 0)); - -echo "\n-- Testing array_column() function with int as first parameter --\n"; -var_dump(array_column(1, 'foo')); - echo "\n-- Testing array_column() column key parameter should be a string or an integer (testing bool) --\n"; var_dump(array_column(array(), true)); @@ -40,26 +28,6 @@ echo "Done\n"; --EXPECTF-- *** Testing array_column() : error conditions *** --- Testing array_column() function with Zero arguments -- - -Warning: array_column() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing array_column() function with One argument -- - -Warning: array_column() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing array_column() function with string as first parameter -- - -Warning: array_column() expects parameter 1 to be array, string given in %s on line %d -NULL - --- Testing array_column() function with int as first parameter -- - -Warning: array_column() expects parameter 1 to be array, int given in %s on line %d -NULL - -- Testing array_column() column key parameter should be a string or an integer (testing bool) -- Warning: array_column(): The column key should be either a string or an integer in %s on line %d diff --git a/ext/standard/tests/array/array_diff_uassoc_error.phpt b/ext/standard/tests/array/array_diff_uassoc_error.phpt index d90c80f20b..f6c6905780 100644 --- a/ext/standard/tests/array/array_diff_uassoc_error.phpt +++ b/ext/standard/tests/array/array_diff_uassoc_error.phpt @@ -27,36 +27,32 @@ function key_compare_func($a, $b) //Test array_diff_uassoc with one more than the expected number of arguments echo "\n-- Testing array_diff_uassoc() function with more than expected no. of arguments --\n"; -var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) ); -var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) ); +try { + var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // Testing array_diff_uassoc with one less than the expected number of arguments echo "\n-- Testing array_diff_uassoc() function with less than expected no. of arguments --\n"; var_dump( array_diff_uassoc($array1, $array2) ); -// Testing array_diff_uassoc with no arguments -echo "\n-- Testing array_diff_uassoc() function with no arguments --\n"; -var_dump( array_diff_uassoc() ); ?> ===DONE=== --EXPECTF-- *** Testing array_diff_uassoc() : error conditions *** -- Testing array_diff_uassoc() function with more than expected no. of arguments -- - -Warning: array_diff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %s on line %d -NULL - -Warning: array_diff_uassoc() expects parameter 6 to be a valid callback, array must have exactly two members in %s on line %d -NULL +array_diff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members +array_diff_uassoc() expects parameter 6 to be a valid callback, array must have exactly two members -- Testing array_diff_uassoc() function with less than expected no. of arguments -- Warning: array_diff_uassoc(): at least 3 parameters are required, 2 given in %s on line %d NULL - --- Testing array_diff_uassoc() function with no arguments -- - -Warning: array_diff_uassoc(): at least 3 parameters are required, 0 given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/array/array_diff_ukey_variation10.phpt b/ext/standard/tests/array/array_diff_ukey_variation10.phpt index 09b4a70237..e80f02629e 100644 --- a/ext/standard/tests/array/array_diff_ukey_variation10.phpt +++ b/ext/standard/tests/array/array_diff_ukey_variation10.phpt @@ -14,27 +14,23 @@ $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); $array2 = array("a" => "green", "yellow", "red"); //function name within double quotes -var_dump( array_diff_ukey($array1, $array1, "unknown_function") ); +try { + var_dump( array_diff_ukey($array1, $array1, "unknown_function") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //function name within single quotes -var_dump( array_diff_ukey($array1, $array1, 'unknown_function') ); - -//function name without quotes -var_dump( array_diff_ukey($array1, $array1, unknown_function) ); +try { + var_dump( array_diff_ukey($array1, $array1, 'unknown_function') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing array_diff_ukey() : usage variation *** - -Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL - -Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL - -Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d - -Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL +array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name +array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name ===DONE=== diff --git a/ext/standard/tests/array/array_fill_error.phpt b/ext/standard/tests/array/array_fill_error.phpt index 2fbdb850c3..386404a336 100644 --- a/ext/standard/tests/array/array_fill_error.phpt +++ b/ext/standard/tests/array/array_fill_error.phpt @@ -10,44 +10,16 @@ Test array_fill() function : error conditions echo "*** Testing array_fill() : error conditions ***\n"; -// Zero arguments -echo "-- Testing array_fill() function with Zero arguments --\n"; -var_dump( array_fill() ); - -// More than expected number of arguments -echo "-- Testing array_fill() function with more than expected no. of arguments --\n"; +// calling array_fill with negative values for 'num' parameter $start_key = 0; -$num = 2; -$val = 1; -$extra_arg = 10; -var_dump( array_fill($start_key,$num,$val, $extra_arg) ); - -// Less than the expected number of arguments -echo "-- Testing array_fill() function with less than expected no. of arguments --\n"; -$start_key = 0; -$num = 2; -var_dump( array_fill($start_key,$num) ); - -//calling array_fill with negative values for 'num' parameter $num = -1; +$val = 1; var_dump( array_fill($start_key,$num,$val) ); echo "Done"; ?> --EXPECTF-- *** Testing array_fill() : error conditions *** --- Testing array_fill() function with Zero arguments -- - -Warning: array_fill() expects exactly 3 parameters, 0 given in %s on line %d -NULL --- Testing array_fill() function with more than expected no. of arguments -- - -Warning: array_fill() expects exactly 3 parameters, 4 given in %s on line %d -NULL --- Testing array_fill() function with less than expected no. of arguments -- - -Warning: array_fill() expects exactly 3 parameters, 2 given in %s on line %d -NULL Warning: array_fill(): Number of elements can't be negative in %s on line %d bool(false) diff --git a/ext/standard/tests/array/array_fill_keys.phpt b/ext/standard/tests/array/array_fill_keys.phpt index 12adde72e7..fb222a414b 100644 --- a/ext/standard/tests/array/array_fill_keys.phpt +++ b/ext/standard/tests/array/array_fill_keys.phpt @@ -4,15 +4,12 @@ basic array_fill_keys test precision=14 --FILE-- <?php - var_dump(array_fill_keys('test', 1)); var_dump(array_fill_keys(array(), 1)); var_dump(array_fill_keys(array('foo', 'bar'), NULL)); var_dump(array_fill_keys(array('5', 'foo', 10, 1.23), 123)); var_dump(array_fill_keys(array('test', TRUE, 10, 100), '')); ?> ---EXPECTF-- -Warning: array_fill_keys() expects parameter 1 to be array, string given in %s on line %d -NULL +--EXPECT-- array(0) { } array(2) { diff --git a/ext/standard/tests/array/array_fill_keys_variation3.phpt b/ext/standard/tests/array/array_fill_keys_variation3.phpt index 84cc928cbc..b1abbcfe1b 100644 --- a/ext/standard/tests/array/array_fill_keys_variation3.phpt +++ b/ext/standard/tests/array/array_fill_keys_variation3.phpt @@ -12,33 +12,18 @@ Test array_fill_keys() function : variation of parameter echo "*** Testing array_fill_keys() : parameter variations ***\n"; -$simpleStr = "simple"; $fp = fopen(__FILE__, "r"); -$bool = false; -$float = 2.4; $array = array("one", "two"); -$nullVal = null; - -echo "\n-- Testing array_fill_keys() function with both wrong arguments --\n"; -var_dump( array_fill_keys($bool, $float) ); echo "\n-- Testing array_fill_keys() function with unusual second arguments --\n"; var_dump( array_fill_keys($array, $fp) ); -echo "\n-- Testing array_fill_keys() function with mixed array --\n"; -var_dump( array_fill_keys($nullVal, $simpleStr) ); - fclose($fp); echo "Done"; ?> --EXPECTF-- *** Testing array_fill_keys() : parameter variations *** --- Testing array_fill_keys() function with both wrong arguments -- - -Warning: array_fill_keys() expects parameter 1 to be array, bool given in %sarray_fill_keys_variation3.php on line %d -NULL - -- Testing array_fill_keys() function with unusual second arguments -- array(2) { ["one"]=> @@ -46,9 +31,4 @@ array(2) { ["two"]=> resource(%d) of type (stream) } - --- Testing array_fill_keys() function with mixed array -- - -Warning: array_fill_keys() expects parameter 1 to be array, null given in %sarray_fill_keys_variation3.php on line %d -NULL Done diff --git a/ext/standard/tests/array/array_filter.phpt b/ext/standard/tests/array/array_filter.phpt index ba27a59c96..1488aedd09 100644 --- a/ext/standard/tests/array/array_filter.phpt +++ b/ext/standard/tests/array/array_filter.phpt @@ -26,9 +26,6 @@ var_dump(array_filter($array2, "even")); var_dump(array_filter($array3, "even")); var_dump(array_filter(array())); -var_dump(array_filter(array(), array())); -var_dump(array_filter("", null)); -var_dump(array_filter($array1, 1)); echo '== DONE =='; ?> @@ -81,13 +78,4 @@ array(2) { } array(0) { } - -Warning: array_filter() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d -NULL - -Warning: array_filter() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d -NULL == DONE == diff --git a/ext/standard/tests/array/array_filter_variation10.phpt b/ext/standard/tests/array/array_filter_variation10.phpt index 4749fe8e45..a32fdadc05 100644 --- a/ext/standard/tests/array/array_filter_variation10.phpt +++ b/ext/standard/tests/array/array_filter_variation10.phpt @@ -48,7 +48,11 @@ var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_KEY)); var_dump(array_filter($mixed, 'is_numeric', 0)); -var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_BOTH)); +try { + var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_BOTH)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -88,14 +92,5 @@ array(2) { ["b"]=> int(2) } - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48 -array(0) { -} +is_numeric() expects exactly 1 parameter, 2 given Done diff --git a/ext/standard/tests/array/array_filter_variation9.phpt b/ext/standard/tests/array/array_filter_variation9.phpt index ed89d13d35..1755a322b0 100644 --- a/ext/standard/tests/array/array_filter_variation9.phpt +++ b/ext/standard/tests/array/array_filter_variation9.phpt @@ -22,10 +22,18 @@ var_dump( array_filter($input, 'is_int') ); var_dump( array_filter($input, 'chr') ); // using language construct 'echo' as 'callback' -var_dump( array_filter($input, 'echo') ); +try { + var_dump( array_filter($input, 'echo') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // using language construct 'exit' as 'callback' -var_dump( array_filter($input, 'exit') ); +try { + var_dump( array_filter($input, 'exit') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -63,10 +71,6 @@ array(8) { [7]=> NULL } - -Warning: array_filter() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL - -Warning: array_filter() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL +array_filter() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name +array_filter() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt index 122d1e4767..f4b91503bc 100644 --- a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt +++ b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt @@ -14,26 +14,23 @@ $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); $array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); //function name within double quotes -var_dump( array_intersect_ukey($array1, $array2, "unknown_function") ); +try { + var_dump( array_intersect_ukey($array1, $array2, "unknown_function") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //function name within single quotes -var_dump( array_intersect_ukey($array1, $array2, 'unknown_function') ); +try { + var_dump( array_intersect_ukey($array1, $array2, 'unknown_function') ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} -//function name without quotes -var_dump( array_intersect_ukey($array1, $array2, unknown_function) ); ?> ===DONE=== --EXPECTF-- *** Testing array_intersect_ukey() : usage variation *** - -Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL - -Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL - -Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d - -Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d -NULL +array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name +array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name ===DONE=== diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt index 61faf0158d..e917815337 100644 --- a/ext/standard/tests/array/array_key_exists.phpt +++ b/ext/standard/tests/array/array_key_exists.phpt @@ -69,24 +69,8 @@ foreach ($search_arrays_v as $search_array) { } echo "\n*** Testing error conditions ***\n"; -//Zeor args -var_dump( array_key_exists() ); // first args as array var_dump( array_key_exists(array(), array()) ); -// second args as string -var_dump( array_key_exists("", "") ); -// second args a integer -var_dump( array_key_exists(1, 1) ); -// second args as NULL -var_dump( array_key_exists(1, NULL) ); -// second args as boolean -var_dump( array_key_exists(1, true) ); -// first args as boolean -var_dump( array_key_exists(false, true) ); -// second args as float -var_dump( array_key_exists(false, 17.5) ); -// args more than expected -var_dump( array_key_exists(1, array(), array()) ); // first argument as floating point value var_dump( array_key_exists(17.5, array(1,23) ) ) ; @@ -249,33 +233,9 @@ bool(true) *** Testing error conditions *** -Warning: array_key_exists() expects exactly 2 parameters, 0 given in %s on line %d -NULL - Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d bool(false) -Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, int given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, null given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, float given in %s on line %d -NULL - -Warning: array_key_exists() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d bool(false) diff --git a/ext/standard/tests/array/array_keys_error.phpt b/ext/standard/tests/array/array_keys_error.phpt index 46a989b839..0febae29c7 100644 --- a/ext/standard/tests/array/array_keys_error.phpt +++ b/ext/standard/tests/array/array_keys_error.phpt @@ -3,32 +3,19 @@ Test array_keys() function (error conditions) --FILE-- <?php -echo "\n*** Testing error conditions ***"; -var_dump(array_keys(100)); -var_dump(array_keys("string")); -var_dump(array_keys(new stdclass)); // object -var_dump(array_keys()); // Zero arguments -var_dump(array_keys(array(), "", TRUE, 100)); // args > expected +echo "\n*** Testing error conditions ***\n"; +try { + var_dump(array_keys(new stdclass)); // object +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(array_keys(array(1,2,3, new stdClass => array()))); // (W)illegal offset echo "Done\n"; ?> --EXPECTF-- *** Testing error conditions *** -Warning: array_keys() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_keys() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: array_keys() expects parameter 1 to be array, object given in %s on line %d -NULL - -Warning: array_keys() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: array_keys() expects at most 3 parameters, 4 given in %s on line %d -NULL +array_keys() expects parameter 1 to be array, object given Warning: Illegal offset type in %s on line %d array(3) { diff --git a/ext/standard/tests/array/array_map_error.phpt b/ext/standard/tests/array/array_map_error.phpt index 56dd033521..d15f28425e 100644 --- a/ext/standard/tests/array/array_map_error.phpt +++ b/ext/standard/tests/array/array_map_error.phpt @@ -9,10 +9,6 @@ Test array_map() function : error conditions echo "*** Testing array_map() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing array_map() function with Zero arguments --\n"; -var_dump( array_map() ); - // Testing array_map with one less than the expected number of arguments echo "\n-- Testing array_map() function with one less than expected no. of arguments --\n"; function callback1() { @@ -45,15 +41,8 @@ echo "Done"; --EXPECTF-- *** Testing array_map() : error conditions *** --- Testing array_map() function with Zero arguments -- - -Warning: array_map() expects at least 2 parameters, 0 given in %s on line %d%d -NULL - -- Testing array_map() function with one less than expected no. of arguments -- - -Warning: array_map() expects at least 2 parameters, 1 given in %s on line %d%d -NULL +Exception: array_map() expects at least 2 parameters, 1 given -- Testing array_map() function with less no. of arrays than callback function arguments -- Exception: Too few arguments to function callback2(), 1 passed and exactly 2 expected diff --git a/ext/standard/tests/array/array_map_object1.phpt b/ext/standard/tests/array/array_map_object1.phpt index b808381048..43cc4484e6 100644 --- a/ext/standard/tests/array/array_map_object1.phpt +++ b/ext/standard/tests/array/array_map_object1.phpt @@ -22,13 +22,17 @@ echo "-- simple class with public variable and method --\n"; class SimpleClass { public $var1 = 1; - public function square($n) { + public static function square($n) { return $n * $n; } } function test($cb, $args) { echo join('::', $cb) . "\n"; - var_dump(array_map($cb, $args)); + try { + var_dump(array_map($cb, $args)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } test(array('SimpleClass', 'square'), array(1, 2)); @@ -36,7 +40,7 @@ echo "\n-- simple class with private variable and method --\n"; class SimpleClassPri { private $var1 = 10; - private function add($n) { + private static function add($n) { return $var + $n; } } @@ -46,7 +50,7 @@ echo "\n-- simple class with protected variable and method --\n"; class SimpleClassPro { protected $var1 = 5; - protected function mul($n) { + protected static function mul($n) { return $var1 * $n; } } @@ -62,14 +66,14 @@ echo "\n-- abstract class --\n"; abstract class AbstractClass { protected $var2 = 5; - abstract function emptyFunction(); + abstract static function emptyFunction(); } // class deriving the above abstract class class ChildClass extends AbstractClass { private $var3; - public function emptyFunction() { + public static function emptyFunction() { echo "defined in child\n"; } } @@ -79,7 +83,7 @@ echo "\n-- class with final method --\n"; class FinalClass { private $var4; - final function finalMethod() { + final static function finalMethod() { echo "This function can't be overloaded\n"; } } @@ -126,8 +130,6 @@ test(array('InterClass', 'square'), array(1, 2)); *** Testing array_map() : object functionality *** -- simple class with public variable and method -- SimpleClass::square - -Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method SimpleClass::square() should not be called statically in %sarray_map_object1.php on line %d array(2) { [0]=> int(1) @@ -137,26 +139,18 @@ array(2) { -- simple class with private variable and method -- SimpleClassPri::add - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add() -- simple class with protected variable and method -- SimpleClassPro::mul - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul() -- class without members -- EmptyClass - -Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, array must have exactly two members -- abstract class -- ChildClass::emptyFunction - -Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method ChildClass::emptyFunction() should not be called statically in %sarray_map_object1.php on line %d defined in child defined in child array(2) { @@ -168,8 +162,6 @@ array(2) { -- class with final method -- FinalClass::finalMethod - -Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method FinalClass::finalMethod() should not be called statically in %sarray_map_object1.php on line %d This function can't be overloaded This function can't be overloaded array(2) { @@ -188,13 +180,9 @@ array(2) { int(4) } StaticClass::cube - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube() StaticClass::retVal - -Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal() in %sarray_map_object1.php on line %d -NULL +array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal() -- class implementing an interface -- InterClass::square array(2) { diff --git a/ext/standard/tests/array/array_map_object2.phpt b/ext/standard/tests/array/array_map_object2.phpt index 7cfb528bf2..e5218ccbe4 100644 --- a/ext/standard/tests/array/array_map_object2.phpt +++ b/ext/standard/tests/array/array_map_object2.phpt @@ -26,21 +26,25 @@ class SimpleClass } echo "-- with non-existent class --\n"; -var_dump( array_map(array('non-existent', 'square'), array(1, 2)) ); +try { + var_dump( array_map(array('non-existent', 'square'), array(1, 2)) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- with existent class and non-existent method --\n"; -var_dump( array_map(array('SimpleClass', 'non-existent'), array(1, 2)) ); +try { + var_dump( array_map(array('SimpleClass', 'non-existent'), array(1, 2)) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> --EXPECTF-- *** Testing array_map() : with non-existent class and method *** -- with non-existent class -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'non-existent' not found in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'non-existent' not found -- with existent class and non-existent method -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'SimpleClass' does not have a method 'non-existent' in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'SimpleClass' does not have a method 'non-existent' Done diff --git a/ext/standard/tests/array/array_map_object3.phpt b/ext/standard/tests/array/array_map_object3.phpt index 114d1d3134..2f1536df5c 100644 --- a/ext/standard/tests/array/array_map_object3.phpt +++ b/ext/standard/tests/array/array_map_object3.phpt @@ -51,13 +51,21 @@ echo "-- accessing parent method from child class --\n"; var_dump( array_map(array('ChildClass', 'staticParent1'), $arr1) ); echo "-- accessing child method from parent class --\n"; -var_dump( array_map(array('ParentClass', 'staticChild'), $arr1) ); +try { + var_dump( array_map(array('ParentClass', 'staticChild'), $arr1) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- accessing parent method using child class object --\n"; var_dump( array_map(array($childobj, 'staticParent1'), $arr1) ); echo "-- accessing child method using parent class object --\n"; -var_dump( array_map(array($parentobj, 'staticChild'), $arr1) ); +try { + var_dump( array_map(array($parentobj, 'staticChild'), $arr1) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -73,9 +81,7 @@ array(3) { int(7) } -- accessing child method from parent class -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' -- accessing parent method using child class object -- array(3) { [0]=> @@ -86,7 +92,5 @@ array(3) { int(7) } -- accessing child method using parent class object -- - -Warning: array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' Done diff --git a/ext/standard/tests/array/array_map_variation12.phpt b/ext/standard/tests/array/array_map_variation12.phpt index b258c2d31b..67abde0108 100644 --- a/ext/standard/tests/array/array_map_variation12.phpt +++ b/ext/standard/tests/array/array_map_variation12.phpt @@ -20,10 +20,18 @@ echo "-- with built-in function 'pow' and two parameters --\n"; var_dump( array_map('pow', $array1, $array2)); echo "-- with built-in function 'pow' and one parameter --\n"; -var_dump( array_map('pow', $array1)); +try { + var_dump( array_map('pow', $array1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- with language construct --\n"; -var_dump( array_map('echo', $array1)); +try { + var_dump( array_map('echo', $array1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -39,22 +47,7 @@ array(3) { int(243) } -- with built-in function 'pow' and one parameter -- - -Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d -array(3) { - [0]=> - NULL - [1]=> - NULL - [2]=> - NULL -} +pow() expects exactly 2 parameters, 1 given -- with language construct -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_map_variation14.phpt b/ext/standard/tests/array/array_map_variation14.phpt index 771d3f949e..2764cb7374 100644 --- a/ext/standard/tests/array/array_map_variation14.phpt +++ b/ext/standard/tests/array/array_map_variation14.phpt @@ -36,10 +36,18 @@ echo "-- with undefined variable --\n"; var_dump( array_map(@$undefined_var, $arr1) ); echo "-- with empty string --\n"; -var_dump( array_map("", $arr1, $arr2) ); +try { + var_dump( array_map("", $arr1, $arr2) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "-- with empty array --\n"; -var_dump( array_map(array(), $arr1, $arr2) ); +try { + var_dump( array_map(array(), $arr1, $arr2) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -115,11 +123,7 @@ array(2) { int(2) } -- with empty string -- - -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name -- with empty array -- - -Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, array must have exactly two members Done diff --git a/ext/standard/tests/array/array_map_variation15.phpt b/ext/standard/tests/array/array_map_variation15.phpt index b29af47713..f36d55bd5f 100644 --- a/ext/standard/tests/array/array_map_variation15.phpt +++ b/ext/standard/tests/array/array_map_variation15.phpt @@ -18,13 +18,15 @@ $arr1 = array(1, 2); $arr2 = array("one", "two"); $arr3 = array(1.1, 2.2); -var_dump( array_map('non_existent', $arr1, $arr2, $arr3) ); +try { + var_dump( array_map('non_existent', $arr1, $arr2, $arr3) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_map() : non existent 'callback' function *** - -Warning: array_map() expects parameter 1 to be a valid callback, function 'non_existent' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'non_existent' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_map_variation16.phpt b/ext/standard/tests/array/array_map_variation16.phpt index c4987cb385..0c80337c76 100644 --- a/ext/standard/tests/array/array_map_variation16.phpt +++ b/ext/standard/tests/array/array_map_variation16.phpt @@ -30,8 +30,12 @@ $callback_names = array( ); for($count = 0; $count < count($callback_names); $count++) { - echo "-- Iteration ".($count + 1)." --\n"; - var_dump( array_map($callback_names[$count], $arr1) ); + echo "-- Iteration ".($count + 1)." --\n"; + try { + var_dump( array_map($callback_names[$count], $arr1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } echo "Done"; @@ -39,35 +43,19 @@ echo "Done"; --EXPECTF-- *** Testing array_map() : non-permmited built-in functions *** -- Iteration 1 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name -- Iteration 2 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'array' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'array' not found or invalid function name -- Iteration 3 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'empty' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'empty' not found or invalid function name -- Iteration 4 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'eval' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'eval' not found or invalid function name -- Iteration 5 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'exit' not found or invalid function name -- Iteration 6 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'isset' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'isset' not found or invalid function name -- Iteration 7 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'list' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'list' not found or invalid function name -- Iteration 8 -- - -Warning: array_map() expects parameter 1 to be a valid callback, function 'print' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function 'print' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_map_variation17.phpt b/ext/standard/tests/array/array_map_variation17.phpt index 1cfbdd7beb..4558dc999f 100644 --- a/ext/standard/tests/array/array_map_variation17.phpt +++ b/ext/standard/tests/array/array_map_variation17.phpt @@ -66,93 +66,77 @@ $unexpected_callbacks = array( // loop through each element of $inputs to check the behavior of array_map for($count = 0; $count < count($unexpected_callbacks); $count++) { - echo "\n-- Iteration ".($count + 1)." --"; - var_dump( array_map($unexpected_callbacks[$count], $arr1)); + echo "\n-- Iteration ".($count + 1)." --\n"; + try { + var_dump( array_map($unexpected_callbacks[$count], $arr1)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; fclose($fp); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing array_map() : unexpected values for 'callback' argument *** -- Iteration 1 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 2 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 3 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 4 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 5 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 6 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 7 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 8 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 9 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 10 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 11 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 12 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 13 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 14 -- -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name -- Iteration 15 -- -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name -- Iteration 16 -- -Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, array must have exactly two members -- Iteration 17 -- -Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object -- Iteration 18 -- -Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object -- Iteration 19 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given -- Iteration 20 -- -Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d -NULL +array_map() expects parameter 1 to be a valid callback, no array or string given Done diff --git a/ext/standard/tests/array/array_merge.phpt b/ext/standard/tests/array/array_merge.phpt index e6a8096282..98cb3a318f 100644 --- a/ext/standard/tests/array/array_merge.phpt +++ b/ext/standard/tests/array/array_merge.phpt @@ -78,12 +78,13 @@ var_dump(array_merge($begin_array[6])); echo "\n*** Testing array_merge() with typecasting non-array to array ***\n"; var_dump(array_merge($begin_array[4], (array)"type1", (array)10, (array)12.34)); -echo "\n*** Testing error conditions ***"; +echo "\n*** Testing error conditions ***\n"; /* Invalid arguments */ -var_dump(array_merge()); -var_dump(array_merge(100, 200)); -var_dump(array_merge($begin_array[0], $begin_array[1], 100)); -var_dump(array_merge($begin_array[0], $begin_array[1], $arr4)); +try { + var_dump(array_merge()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -746,17 +747,5 @@ array(7) { } *** Testing error conditions *** -Warning: array_merge() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d -NULL - -Warning: array_merge(): Expected parameter 3 to be an array, int given in %s on line %d -NULL - -Notice: Undefined variable: arr4 in %s on line %d - -Warning: array_merge(): Expected parameter 3 to be an array, null given in %s on line %d -NULL +array_merge() expects at least 1 parameter, 0 given Done diff --git a/ext/standard/tests/array/array_merge_recursive_error.phpt b/ext/standard/tests/array/array_merge_recursive_error.phpt index ffa9cc998e..f741220837 100644 --- a/ext/standard/tests/array/array_merge_recursive_error.phpt +++ b/ext/standard/tests/array/array_merge_recursive_error.phpt @@ -11,7 +11,11 @@ echo "*** Testing array_merge_recursive() : error conditions ***\n"; // Zero arguments echo "\n-- Testing array_merge_recursive() function with Zero arguments --\n"; -var_dump( array_merge_recursive() ); +try { + var_dump( array_merge_recursive() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> @@ -19,7 +23,5 @@ echo "Done"; *** Testing array_merge_recursive() : error conditions *** -- Testing array_merge_recursive() function with Zero arguments -- - -Warning: array_merge_recursive() expects at least 1 parameter, 0 given in %s on line %d -NULL +array_merge_recursive() expects at least 1 parameter, 0 given Done diff --git a/ext/standard/tests/array/array_multisort_error.phpt b/ext/standard/tests/array/array_multisort_error.phpt index 3e78b78ac0..105662be07 100644 --- a/ext/standard/tests/array/array_multisort_error.phpt +++ b/ext/standard/tests/array/array_multisort_error.phpt @@ -10,10 +10,6 @@ Test array_multisort() function : error conditions echo "*** Testing array_multisort() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing array_multisort() function with Zero arguments --\n"; -var_dump( array_multisort() ); - echo "\n-- Testing array_multisort() function with repeated flags --\n"; $ar1 = array(1); var_dump( array_multisort($ar1, SORT_ASC, SORT_ASC) ); @@ -27,11 +23,6 @@ var_dump( array_multisort($ar1, SORT_STRING, SORT_NUMERIC) ); --EXPECTF-- *** Testing array_multisort() : error conditions *** --- Testing array_multisort() function with Zero arguments -- - -Warning: array_multisort() expects at least 1 parameter, 0 given in %sarray_multisort_error.php on line %d -NULL - -- Testing array_multisort() function with repeated flags -- Warning: array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified in %sarray_multisort_error.php on line %d diff --git a/ext/standard/tests/array/array_multisort_variation1.phpt b/ext/standard/tests/array/array_multisort_variation1.phpt index 9a33a270f1..677a87103f 100644 --- a/ext/standard/tests/array/array_multisort_variation1.phpt +++ b/ext/standard/tests/array/array_multisort_variation1.phpt @@ -11,8 +11,8 @@ Test array_multisort() function : usage variation echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/standard/tests/array/array_multisort_variation2.phpt b/ext/standard/tests/array/array_multisort_variation2.phpt index 8c26a8347b..f9a00e9701 100644 --- a/ext/standard/tests/array/array_multisort_variation2.phpt +++ b/ext/standard/tests/array/array_multisort_variation2.phpt @@ -11,8 +11,8 @@ Test array_multisort() function : usage variation echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/standard/tests/array/array_multisort_variation3.phpt b/ext/standard/tests/array/array_multisort_variation3.phpt index 28130e31fd..c625d2a566 100644 --- a/ext/standard/tests/array/array_multisort_variation3.phpt +++ b/ext/standard/tests/array/array_multisort_variation3.phpt @@ -11,8 +11,8 @@ Test array_multisort() function : usage variation echo "*** Testing array_multisort() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/standard/tests/array/array_multisort_variation8.phpt b/ext/standard/tests/array/array_multisort_variation8.phpt index 6d89dd0c6c..e6ff858b16 100644 --- a/ext/standard/tests/array/array_multisort_variation8.phpt +++ b/ext/standard/tests/array/array_multisort_variation8.phpt @@ -11,7 +11,7 @@ Test array_multisort() function : usage variation - test sort order of all types echo "*** Testing array_multisort() : usage variation - test sort order of all types***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { // We're testing sort order not errors so ignore. } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/array/array_pad.phpt b/ext/standard/tests/array/array_pad.phpt index c267516730..fd5fa520b6 100644 --- a/ext/standard/tests/array/array_pad.phpt +++ b/ext/standard/tests/array/array_pad.phpt @@ -3,9 +3,6 @@ array_pad() tests --FILE-- <?php -var_dump(array_pad()); -var_dump(array_pad(array())); -var_dump(array_pad(array(), 1)); var_dump(array_pad(array(), 1, 0)); var_dump(array_pad(array(), 0, 0)); @@ -16,19 +13,10 @@ var_dump(array_pad(array("", -1, 2.0), 2, array())); var_dump(array_pad(array("", -1, 2.0), -3, array())); var_dump(array_pad(array("", -1, 2.0), -4, array())); var_dump(array_pad(array("", -1, 2.0), 2000000, 0)); -var_dump(array_pad("", 2000000, 0)); echo "Done\n"; ?> --EXPECTF-- -Warning: array_pad() expects exactly 3 parameters, 0 given in %s on line %d -NULL - -Warning: array_pad() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: array_pad() expects exactly 3 parameters, 2 given in %s on line %d -NULL array(1) { [0]=> int(0) @@ -95,7 +83,4 @@ array(4) { Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d bool(false) - -Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d -NULL Done diff --git a/ext/standard/tests/array/array_push.phpt b/ext/standard/tests/array/array_push.phpt index 52e754f94d..227a520ac1 100644 --- a/ext/standard/tests/array/array_push.phpt +++ b/ext/standard/tests/array/array_push.phpt @@ -31,16 +31,7 @@ $mixed_array = array( ); /* Error Conditions */ -echo "\n*** Testing Error Conditions ***\n"; - -/* Zero argument */ -var_dump( array_push() ); - -/* Scalar argument */ -var_dump( array_push($number, 22) ); - -/* String argument */ -var_dump( array_push($str, 22) ); +echo "\n*** Testing Edge Conditions ***\n"; /* Invalid Number of arguments */ var_dump( array_push($mixed_array[1],1,2) ); @@ -70,16 +61,7 @@ var_dump( $mixed_array[2] ); echo"\nDone"; ?> --EXPECTF-- -*** Testing Error Conditions *** - -Warning: array_push() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: array_push() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_push() expects parameter 1 to be array, string given in %s on line %d -NULL +*** Testing Edge Conditions *** int(11) int(1) diff --git a/ext/standard/tests/array/array_rand.phpt b/ext/standard/tests/array/array_rand.phpt index db432dc9b4..72999eda5f 100644 --- a/ext/standard/tests/array/array_rand.phpt +++ b/ext/standard/tests/array/array_rand.phpt @@ -3,10 +3,8 @@ array_rand() tests --FILE-- <?php -var_dump(array_rand()); var_dump(array_rand(array())); var_dump(array_rand(array(), 0)); -var_dump(array_rand(0, 0)); var_dump(array_rand(array(1,2,3), 0)); var_dump(array_rand(array(1,2,3), -1)); var_dump(array_rand(array(1,2,3), 10)); @@ -16,18 +14,12 @@ var_dump(array_rand(array(1,2,3), 2)); echo "Done\n"; ?> --EXPECTF-- -Warning: array_rand() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: array_rand(): Array is empty in %s on line %d NULL Warning: array_rand(): Array is empty in %s on line %d NULL -Warning: array_rand() expects parameter 1 to be array, int given in %s on line %d -NULL - Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d NULL diff --git a/ext/standard/tests/array/array_search1.phpt b/ext/standard/tests/array/array_search1.phpt index 49563f9712..10c1672e54 100644 --- a/ext/standard/tests/array/array_search1.phpt +++ b/ext/standard/tests/array/array_search1.phpt @@ -5,8 +5,6 @@ array_search() tests $a = array(1=>0, 2=>1, 4=>3, "a"=>"b", "c"=>"d"); -var_dump(array_search(1)); -var_dump(array_search(1,1)); var_dump(array_search("a",$a)); var_dump(array_search("0",$a, true)); var_dump(array_search("0",$a)); @@ -18,12 +16,7 @@ var_dump(array_search(-1,$a, true)); echo "Done\n"; ?> ---EXPECTF-- -Warning: array_search() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: array_search() expects parameter 2 to be array, int given in %s on line %d -NULL +--EXPECT-- int(1) bool(false) int(1) diff --git a/ext/standard/tests/array/array_search_variation3.phpt b/ext/standard/tests/array/array_search_variation3.phpt index 41b0b5bb20..596c36f805 100644 --- a/ext/standard/tests/array/array_search_variation3.phpt +++ b/ext/standard/tests/array/array_search_variation3.phpt @@ -33,9 +33,17 @@ class array_search_check { $array_search_obj = new array_search_check(); //creating new object //error: as wrong datatype for second argument -var_dump( array_search("array_var", $array_search_obj) ); +try { + var_dump( array_search("array_var", $array_search_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //error: as wrong datatype for second argument -var_dump( array_search("foo", $array_search_obj) ); +try { + var_dump( array_search("foo", $array_search_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //element found as "one" exists in array $array_var var_dump( array_search("one", $array_search_obj->array_var) ); @@ -48,11 +56,7 @@ string(5) "three" int(5) *** Testing objects with array_search() *** - -Warning: array_search() expects parameter 2 to be array, object given in %s on line %d -NULL - -Warning: array_search() expects parameter 2 to be array, object given in %s on line %d -NULL +array_search() expects parameter 2 to be array, object given +array_search() expects parameter 2 to be array, object given int(1) Done diff --git a/ext/standard/tests/array/array_slice.phpt b/ext/standard/tests/array/array_slice.phpt index 59d804350b..d19f5195d6 100644 --- a/ext/standard/tests/array/array_slice.phpt +++ b/ext/standard/tests/array/array_slice.phpt @@ -20,26 +20,6 @@ $var_array = array( $num = 4; $str = "john"; -/* Zero args */ -echo"\n*** Output for Zero Argument ***\n"; -array_slice(); - -/* Single args */ -echo"\n*** Output for Single array Argument ***\n"; -array_slice($var_array); - -/* More than valid no. of args (ie. >4 ) */ -echo"\n*** Output for invalid number of Arguments ***\n"; -array_slice($var_array, 2, 4, true, 3); - -/* Scalar arg */ -echo"\n*** Output for scalar Argument ***\n"; -array_slice($num, 2); - -/* String arg */ -echo"\n*** Output for string Argument ***\n"; -array_slice($str, 2); - $counter = 1; foreach ($var_array as $sub_array) { @@ -89,26 +69,6 @@ foreach ($var_array as $sub_array) ?> --EXPECTF-- -*** Output for Zero Argument *** - -Warning: array_slice() expects at least 2 parameters, 0 given in %s on line %d - -*** Output for Single array Argument *** - -Warning: array_slice() expects at least 2 parameters, 1 given in %s on line %d - -*** Output for invalid number of Arguments *** - -Warning: array_slice() expects at most 4 parameters, 5 given in %s on line %d - -*** Output for scalar Argument *** - -Warning: array_slice() expects parameter 1 to be array, int given in %s on line %d - -*** Output for string Argument *** - -Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d - *** Iteration 1 *** *** Variation with first two Arguments *** diff --git a/ext/standard/tests/array/array_slice_variation1.phpt b/ext/standard/tests/array/array_slice_variation1.phpt index 7b6d712a1f..46f33b9503 100644 --- a/ext/standard/tests/array/array_slice_variation1.phpt +++ b/ext/standard/tests/array/array_slice_variation1.phpt @@ -15,12 +15,20 @@ var_dump(array_slice(range(1, 3), -1, NULL, 1)); $a = 'foo'; -var_dump(array_slice(range(1, 3), 0, $a)); -var_dump(array_slice(range(1, 3), 0, $a)); +try { + var_dump(array_slice(range(1, 3), 0, $a)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(array_slice(range(1, 3), 0, $a)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump($a); ?> ---EXPECT-- +--EXPECTF-- array(3) { [0]=> int(1) @@ -53,8 +61,6 @@ array(1) { [2]=> int(3) } -array(0) { -} -array(0) { -} +array_slice() expects parameter 3 to be int, string given +array_slice() expects parameter 3 to be int, string given string(3) "foo" diff --git a/ext/standard/tests/array/array_slice_variation2.phpt b/ext/standard/tests/array/array_slice_variation2.phpt deleted file mode 100644 index a76d68e6e0..0000000000 --- a/ext/standard/tests/array/array_slice_variation2.phpt +++ /dev/null @@ -1,303 +0,0 @@ ---TEST-- -Test array_slice() function : usage variations - Pass different data types as $offset arg ---SKIPIF-- -<?php if (PHP_INT_SIZE > 4) die("skip this test is for 32bit platform only"); ?> ---FILE-- -<?php -/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]]) - * Description: Returns elements specified by offset and length - * Source code: ext/standard/array.c - */ - -/* - * Pass different data types as $offset argument to array_slice() to test behaviour - */ - -echo "*** Testing array_slice() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$input_array = array('one' => 1, 2, 'three' => 3, 4); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $offset argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, -); - -// loop through each element of $inputs to check the behavior of array_slice() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( array_slice($input_array, $input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing array_slice() : usage variations *** - --- Iteration 1 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 2 -- -array(3) { - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 3 -- -array(0) { -} - --- Iteration 4 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 5 -- -array(0) { -} - --- Iteration 6 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 7 -- - -Warning: array_slice() expects parameter 2 to be int, float given in %s on line %d -NULL - --- Iteration 8 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 9 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 10 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 11 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 12 -- -array(3) { - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 13 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 14 -- -array(3) { - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 15 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 16 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: array_slice() expects parameter 2 to be int, array given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d -NULL - --- Iteration 22 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} - --- Iteration 23 -- -array(4) { - ["one"]=> - int(1) - [0]=> - int(2) - ["three"]=> - int(3) - [1]=> - int(4) -} -Done diff --git a/ext/standard/tests/array/array_unshift.phpt b/ext/standard/tests/array/array_unshift.phpt index 9b474277a9..9ebe83391e 100644 --- a/ext/standard/tests/array/array_unshift.phpt +++ b/ext/standard/tests/array/array_unshift.phpt @@ -7,8 +7,6 @@ $a = array(); $s = ""; var_dump(array_unshift($a, $s)); var_dump($a); -var_dump(array_unshift($s, $a)); -var_dump($a); var_dump(array_unshift($a, $a)); var_dump($a); @@ -20,13 +18,6 @@ array(1) { [0]=> string(0) "" } - -Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d -NULL -array(1) { - [0]=> - string(0) "" -} int(2) array(2) { [0]=> diff --git a/ext/standard/tests/array/array_walk.phpt b/ext/standard/tests/array/array_walk.phpt index 7cd8a8cf7a..cf792bfa19 100644 --- a/ext/standard/tests/array/array_walk.phpt +++ b/ext/standard/tests/array/array_walk.phpt @@ -3,12 +3,6 @@ array_walk() tests --FILE-- <?php -var_dump(array_walk()); -$var = 1; -var_dump(array_walk($var,1)); -$var = array(); -var_dump(array_walk($var,"")); - function foo($v1, $v2, $v3) { var_dump($v1); var_dump($v2); @@ -31,14 +25,6 @@ try { echo "Done\n"; ?> --EXPECTF-- -Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL int(1) int(0) string(4) "data" diff --git a/ext/standard/tests/array/array_walk_closure.phpt b/ext/standard/tests/array/array_walk_closure.phpt index 0a5d854582..7ac62d7484 100644 --- a/ext/standard/tests/array/array_walk_closure.phpt +++ b/ext/standard/tests/array/array_walk_closure.phpt @@ -3,14 +3,6 @@ array_walk() closure tests --FILE-- <?php -var_dump(array_walk()); - -$ar = false; -var_dump(array_walk($ar, $ar)); - -$ar = NULL; -var_dump(array_walk($ar, $ar)); - $ar = ["one" => 1, "two"=>2, "three" => 3]; var_dump(array_walk($ar, function(){ var_dump(func_get_args());})); @@ -94,14 +86,6 @@ try { echo "Done\n"; ?> --EXPECTF-- -Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, bool given in %s on line %d -NULL - -Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d -NULL array(2) { [0]=> int(1) diff --git a/ext/standard/tests/array/array_walk_error2.phpt b/ext/standard/tests/array/array_walk_error2.phpt index a4026180fb..73445892a6 100644 --- a/ext/standard/tests/array/array_walk_error2.phpt +++ b/ext/standard/tests/array/array_walk_error2.phpt @@ -61,7 +61,5 @@ Exception: Too few arguments to function callback2(), 3 passed and exactly 4 exp Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected -- Testing array_walk() function with too many callback parameters -- - -Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d -NULL +Exception: array_walk() expects at most 3 parameters, 4 given Done diff --git a/ext/standard/tests/array/array_walk_objects.phpt b/ext/standard/tests/array/array_walk_objects.phpt index fc04304fc5..9f3ac8c1cd 100644 --- a/ext/standard/tests/array/array_walk_objects.phpt +++ b/ext/standard/tests/array/array_walk_objects.phpt @@ -24,7 +24,11 @@ array_walk($t, "walk"); $var = array(); array_walk($var, "walk"); $var = ""; -array_walk($var, "walk"); +try { + array_walk($var, "walk"); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -39,6 +43,5 @@ string(10) "%r\0%r*%r\0%rvar_pro" string(14) "test_protected" string(7) "var_pub" string(11) "test_public" - -Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d +array_walk() expects parameter 1 to be array, string given Done diff --git a/ext/standard/tests/array/array_walk_rec_objects.phpt b/ext/standard/tests/array/array_walk_rec_objects.phpt index a83c227a3b..097143e8ec 100644 --- a/ext/standard/tests/array/array_walk_rec_objects.phpt +++ b/ext/standard/tests/array/array_walk_rec_objects.phpt @@ -24,7 +24,11 @@ array_walk_recursive($t, "walk"); $var = array(); array_walk_recursive($var, "walk"); $var = ""; -array_walk_recursive($var, "walk"); +try { + array_walk_recursive($var, "walk"); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -39,6 +43,5 @@ string(10) "%r\0%r*%r\0%rvar_pro" string(14) "test_protected" string(7) "var_pub" string(11) "test_public" - -Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d +array_walk_recursive() expects parameter 1 to be array, string given Done diff --git a/ext/standard/tests/array/array_walk_recursive1.phpt b/ext/standard/tests/array/array_walk_recursive1.phpt index 962f133e4c..f952b4410b 100644 --- a/ext/standard/tests/array/array_walk_recursive1.phpt +++ b/ext/standard/tests/array/array_walk_recursive1.phpt @@ -3,12 +3,6 @@ array_walk_recursive() tests --FILE-- <?php -var_dump(array_walk_recursive()); -$var = 1; -var_dump(array_walk_recursive($var,1)); -$var = array(); -var_dump(array_walk_recursive($var,"")); - function foo($v1, $v2, $v3) { var_dump($v1); var_dump($v2); @@ -31,14 +25,6 @@ try { echo "Done\n"; ?> --EXPECTF-- -Warning: array_walk_recursive() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d -NULL int(1) int(0) string(4) "data" diff --git a/ext/standard/tests/array/array_walk_recursive_error2.phpt b/ext/standard/tests/array/array_walk_recursive_error2.phpt index b162a1c9dc..e9bd7ea175 100644 --- a/ext/standard/tests/array/array_walk_recursive_error2.phpt +++ b/ext/standard/tests/array/array_walk_recursive_error2.phpt @@ -61,7 +61,5 @@ Exception: Too few arguments to function callback2(), 3 passed and exactly 4 exp Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected -- Testing array_walk_recursive() function with too many callback parameters -- - -Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d -NULL +Exception: array_walk_recursive() expects at most 3 parameters, 4 given Done diff --git a/ext/standard/tests/array/array_walk_recursive_variation7.phpt b/ext/standard/tests/array/array_walk_recursive_variation7.phpt index 06dc1aaa09..a0c159d71d 100644 --- a/ext/standard/tests/array/array_walk_recursive_variation7.phpt +++ b/ext/standard/tests/array/array_walk_recursive_variation7.phpt @@ -29,9 +29,6 @@ var_dump( array_walk_recursive($input, function($value, $key) { var_dump($key); echo "-- Anonymous function with three arguments --\n"; var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10)); -echo "-- Anonymous function with one more argument --\n"; -var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30)); - echo "-- Anonymous function with null argument --\n"; var_dump( array_walk_recursive( $input, function() { echo "1\n"; })); echo "Done" @@ -80,10 +77,6 @@ int(0) int(10) bool(true) --- Anonymous function with one more argument -- - -Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d -NULL -- Anonymous function with null argument -- 1 1 diff --git a/ext/standard/tests/array/array_walk_recursive_variation8.phpt b/ext/standard/tests/array/array_walk_recursive_variation8.phpt index 2db8067fe0..51eba1e0e0 100644 --- a/ext/standard/tests/array/array_walk_recursive_variation8.phpt +++ b/ext/standard/tests/array/array_walk_recursive_variation8.phpt @@ -25,7 +25,11 @@ echo "-- With 'min' built-in function --\n"; var_dump( array_walk_recursive($input, "min")); echo "-- With 'echo' language construct --\n"; -var_dump( array_walk_recursive($input, "echo")); +try { + var_dump( array_walk_recursive($input, "echo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -36,7 +40,5 @@ bool(true) -- With 'min' built-in function -- bool(true) -- With 'echo' language construct -- - -Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_walk_recursive() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name Done diff --git a/ext/standard/tests/array/array_walk_variation7.phpt b/ext/standard/tests/array/array_walk_variation7.phpt index 671ad44309..0354782eda 100644 --- a/ext/standard/tests/array/array_walk_variation7.phpt +++ b/ext/standard/tests/array/array_walk_variation7.phpt @@ -29,9 +29,6 @@ var_dump( array_walk($input, function($value, $key) { var_dump($key); var_dump($ echo "-- Anonymous function with three arguments --\n"; var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10)); -echo "-- Anonymous function with one more argument --\n"; -var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30)); - echo "-- Anonymous function with null argument --\n"; var_dump( array_walk( $input, function() { echo "1\n"; })); echo "Done" @@ -80,10 +77,6 @@ int(0) int(10) bool(true) --- Anonymous function with one more argument -- - -Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d -NULL -- Anonymous function with null argument -- 1 1 diff --git a/ext/standard/tests/array/array_walk_variation8.phpt b/ext/standard/tests/array/array_walk_variation8.phpt index 829baf1add..baa5f3914b 100644 --- a/ext/standard/tests/array/array_walk_variation8.phpt +++ b/ext/standard/tests/array/array_walk_variation8.phpt @@ -25,7 +25,11 @@ echo "-- With 'min' built-in function --\n"; var_dump( array_walk($input, "min")); echo "-- With 'echo' language construct --\n"; -var_dump( array_walk($input, "echo")); +try { + var_dump( array_walk($input, "echo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done" ?> @@ -36,7 +40,5 @@ bool(true) -- With 'min' built-in function -- bool(true) -- With 'echo' language construct -- - -Warning: array_walk() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL +array_walk() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name Done diff --git a/ext/standard/tests/array/bug35014.phpt b/ext/standard/tests/array/bug35014.phpt index f858bf107b..b674590fd6 100644 --- a/ext/standard/tests/array/bug35014.phpt +++ b/ext/standard/tests/array/bug35014.phpt @@ -7,7 +7,6 @@ precision=14 --FILE-- <?php $tests = array( - 'foo', array(), array(0), array(3), @@ -22,9 +21,7 @@ foreach ($tests as $v) { var_dump(array_product($v)); } ?> ---EXPECTF-- -Warning: array_product() expects parameter 1 to be array, string given in %s on line %d -NULL +--EXPECT-- int(1) int(0) int(3) diff --git a/ext/standard/tests/array/bug35014_64bit.phpt b/ext/standard/tests/array/bug35014_64bit.phpt index 5caf48c6ee..3b3d29b5be 100644 --- a/ext/standard/tests/array/bug35014_64bit.phpt +++ b/ext/standard/tests/array/bug35014_64bit.phpt @@ -7,7 +7,6 @@ precision=14 --FILE-- <?php $tests = array( - 'foo', array(), array(0), array(3), @@ -22,9 +21,7 @@ foreach ($tests as $v) { var_dump(array_product($v)); } ?> ---EXPECTF-- -Warning: array_product() expects parameter 1 to be array, string given in %s on line %d -NULL +--EXPECT-- int(1) int(0) int(3) diff --git a/ext/standard/tests/array/bug40191.phpt b/ext/standard/tests/array/bug40191.phpt index f5e439821d..b94e709364 100644 --- a/ext/standard/tests/array/bug40191.phpt +++ b/ext/standard/tests/array/bug40191.phpt @@ -8,12 +8,14 @@ $arrObj->append('foo'); $arrObj->append('bar'); $arrObj->append('foo'); -$arr = array_unique($arrObj); -var_dump($arr); +try { + $arr = array_unique($arrObj); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> ---EXPECTF-- -Warning: array_unique() expects parameter 1 to be array, object given in %s on line %d -NULL +--EXPECT-- +array_unique() expects parameter 1 to be array, object given Done diff --git a/ext/standard/tests/array/bug67693.phpt b/ext/standard/tests/array/bug67693.phpt index 516436c511..c9aa2d86fa 100644 --- a/ext/standard/tests/array/bug67693.phpt +++ b/ext/standard/tests/array/bug67693.phpt @@ -16,9 +16,9 @@ echo"\nDone"; ?> --EXPECT-- array(2) { - [0]=> + [-1]=> int(0) - [1]=> + [0]=> int(0) } diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt index 175cfe7118..1fd2e8e6ca 100644 --- a/ext/standard/tests/array/count_recursive.phpt +++ b/ext/standard/tests/array/count_recursive.phpt @@ -111,16 +111,6 @@ for( $i =0; $i < count( $mode_arr ); $i++) { var_dump(count($arr, $mode_arr[$i])); } - -echo "\n-- Testing error conditions --"; -var_dump( count() ); // No. of args = 0 -var_dump( count(array(), COUNT_NORMAL, 100) ); // No. of args > expected - -/* Testing Invalid type arguments */ -var_dump( count("string", ABCD) ); -var_dump( count(100, "string") ); -var_dump( count(array(), "") ); - echo "\nDone"; /* closing the resource handles */ @@ -230,22 +220,4 @@ For mode '1' count is => int(9) For mode '' count is => int(3) For mode '' count is => int(3) --- Testing error conditions -- -Warning: count() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: count() expects at most 2 parameters, 3 given in %s on line %d -NULL - -Warning: Use of undefined constant ABCD - assumed 'ABCD' (this will throw an Error in a future version of PHP) in %s on line %d - -Warning: count() expects parameter 2 to be int, %s given in %s on line %d -NULL - -Warning: count() expects parameter 2 to be int, %s given in %s on line %d -NULL - -Warning: count() expects parameter 2 to be int, %s given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/array/each.phpt b/ext/standard/tests/array/each.phpt Binary files differdeleted file mode 100644 index 4af2097a7d..0000000000 --- a/ext/standard/tests/array/each.phpt +++ /dev/null diff --git a/ext/standard/tests/array/each_basic.phpt b/ext/standard/tests/array/each_basic.phpt deleted file mode 100644 index cd38682dc7..0000000000 --- a/ext/standard/tests/array/each_basic.phpt +++ /dev/null @@ -1,76 +0,0 @@ ---TEST-- -Test each() function : basic functionality ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test basic functionality of each() - */ - -echo "*** Testing each() : basic functionality ***\n"; - -$arr = array ('one' => 1, 'zero', 'two' => 'deux', 20 => 'twenty'); -echo "\n-- Passed array: --\n"; -var_dump($arr); - -echo "\n-- Initial position: --\n"; -var_dump(each($arr)); - -echo "\n-- End position: --\n"; -end($arr); -var_dump(each($arr)); - -echo "\n-- Passed the end of array: --\n"; -var_dump(each($arr)); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : basic functionality *** - --- Passed array: -- -array(4) { - ["one"]=> - int(1) - [0]=> - string(4) "zero" - ["two"]=> - string(4) "deux" - [20]=> - string(6) "twenty" -} - --- Initial position: -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - int(1) - ["value"]=> - int(1) - [0]=> - string(3) "one" - ["key"]=> - string(3) "one" -} - --- End position: -- -array(4) { - [1]=> - string(6) "twenty" - ["value"]=> - string(6) "twenty" - [0]=> - int(20) - ["key"]=> - int(20) -} - --- Passed the end of array: -- -bool(false) -Done diff --git a/ext/standard/tests/array/each_error.phpt b/ext/standard/tests/array/each_error.phpt deleted file mode 100644 index e7ee4976ed..0000000000 --- a/ext/standard/tests/array/each_error.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Test each() function : error conditions - pass incorrect number of args ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass an incorrect number of arguments to each() to test behaviour - */ - -echo "*** Testing each() : error conditions ***\n"; - -// Zero arguments -echo "\n-- Testing each() function with Zero arguments --\n"; -var_dump( each() ); - -//Test each with one more than the expected number of arguments -echo "\n-- Testing each() function with more than expected no. of arguments --\n"; -$arr = array(1, 2); -$extra_arg = 10; -var_dump( each($arr, $extra_arg) ); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : error conditions *** - --- Testing each() function with Zero arguments -- - -Warning: each() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing each() function with more than expected no. of arguments -- - -Warning: each() expects exactly 1 parameter, 2 given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/each_variation1.phpt b/ext/standard/tests/array/each_variation1.phpt deleted file mode 100644 index 6b75d5e15c..0000000000 --- a/ext/standard/tests/array/each_variation1.phpt +++ /dev/null @@ -1,223 +0,0 @@ ---TEST-- -Test each() function : usage variations - Pass different data types as $arr arg ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass different data types as $arr arg to each() to test behaviour - */ - -echo "*** Testing each() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $arr argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of each() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( each($input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Iteration 1 -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 2 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 3 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 4 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 5 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 6 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 7 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 8 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 9 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 10 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 11 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 12 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 13 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 14 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 15 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 16 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 17 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 18 -- -bool(false) - --- Iteration 19 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 20 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 21 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 22 -- -bool(false) - --- Iteration 23 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 24 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - --- Iteration 25 -- - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL -Done diff --git a/ext/standard/tests/array/each_variation2.phpt b/ext/standard/tests/array/each_variation2.phpt deleted file mode 100644 index 34eeedc9a8..0000000000 --- a/ext/standard/tests/array/each_variation2.phpt +++ /dev/null @@ -1,249 +0,0 @@ ---TEST-- -Test each() function : usage variations - arrays of different data types ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass arrays of different data types as $arr argument to each() to test behaviour - */ - -echo "*** Testing each() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// arrays of different data types to be passed as $arr -$inputs = array( - - // int data -/*1*/ 'int' => array( - 0, - 1, - 12345, - -2345, - ), - - // float data -/*2*/ 'float' => array( - 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - ), - - // null data -/*3*/ 'null' => array( - NULL, - null, - ), - - // boolean data -/*4*/ 'bool' => array( - true, - false, - TRUE, - FALSE, - ), - - // empty data -/*5*/ 'empty string' => array( - "", - '', - ), - -/*6*/ 'empty array' => array( - ), - - // string data -/*7*/ 'string' => array( - "string", - 'string', - $heredoc, - ), - - // object data -/*8*/ 'object' => array( - new classA(), - ), - - // undefined data -/*9*/ 'undefined' => array( - @$undefined_var, - ), - - // unset data -/*10*/ 'unset' => array( - @$unset_var, - ), - - // resource variable -/*11*/ 'resource' => array( - $fp - ), -); - -// loop through each element of $inputs to check the behavior of each() -$iterator = 1; -foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator: $key data --\n"; - var_dump( each($input) ); - $iterator++; -}; - -fclose($fp); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Iteration 1: int data -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - int(0) - ["value"]=> - int(0) - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 2: float data -- -array(4) { - [1]=> - float(10.5) - ["value"]=> - float(10.5) - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 3: null data -- -array(4) { - [1]=> - NULL - ["value"]=> - NULL - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 4: bool data -- -array(4) { - [1]=> - bool(true) - ["value"]=> - bool(true) - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 5: empty string data -- -array(4) { - [1]=> - string(0) "" - ["value"]=> - string(0) "" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 6: empty array data -- -bool(false) - --- Iteration 7: string data -- -array(4) { - [1]=> - string(6) "string" - ["value"]=> - string(6) "string" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 8: object data -- -array(4) { - [1]=> - object(classA)#%d (0) { - } - ["value"]=> - object(classA)#%d (0) { - } - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 9: undefined data -- -array(4) { - [1]=> - NULL - ["value"]=> - NULL - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 10: unset data -- -array(4) { - [1]=> - NULL - ["value"]=> - NULL - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 11: resource data -- -array(4) { - [1]=> - resource(%d) of type (stream) - ["value"]=> - resource(%d) of type (stream) - [0]=> - int(0) - ["key"]=> - int(0) -} -Done diff --git a/ext/standard/tests/array/each_variation3.phpt b/ext/standard/tests/array/each_variation3.phpt deleted file mode 100644 index 32342d6d78..0000000000 --- a/ext/standard/tests/array/each_variation3.phpt +++ /dev/null @@ -1,254 +0,0 @@ ---TEST-- -Test each() function : usage variations - keys of different data types ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Pass each() arrays where the keys are different data types to test behaviour - */ - -echo "*** Testing each() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// unexpected values to be passed as $arr -$inputs = array( - - // int data -/*1*/ 'int' => array( - 0 => 'zero', - 1 => 'one', - 12345 => 'positive', - -2345 => 'negative', - ), - - // float data -/*2*/ 'float' => array( - 10.5 => 'positive', - -10.5 => 'negative', - .5 => 'half', - ), - -/*3*/ 'extreme floats' => array( - 12.3456789000e6 => 'large', - 12.3456789000E-10 => 'small', - ), - - // null data -/*4*/ 'null uppercase' => array( - NULL => 'null 1', - ), - -/*5*/ 'null lowercase' => array( - null => 'null 2', - ), - - // boolean data -/*6*/ 'bool lowercase' => array( - true => 'lowert', - false => 'lowerf', - ), - -/*7*/ 'bool uppercase' => array( - TRUE => 'uppert', - FALSE => 'upperf', - ), - - // empty data -/*8*/ 'empty double quotes' => array( - "" => 'emptyd', - ), - -/*9*/ 'empty single quotes' => array( - '' => 'emptys', - ), - - // string data -/*10*/ 'string' => array( - "stringd" => 'stringd', - 'strings' => 'strings', - $heredoc => 'stringh', - ), - - // undefined data -/*11*/ 'undefined' => array( - @$undefined_var => 'undefined', - ), - - // unset data -/*12*/ 'unset' => array( - @$unset_var => 'unset', - ), -); - -// loop through each element of $inputs to check the behavior of each() -$iterator = 1; -foreach($inputs as $key => $input) { - echo "\n-- Iteration $iterator: $key data --\n"; - var_dump( each($input) ); - $iterator++; -}; - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Iteration 1: int data -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- Iteration 2: float data -- -array(4) { - [1]=> - string(8) "positive" - ["value"]=> - string(8) "positive" - [0]=> - int(10) - ["key"]=> - int(10) -} - --- Iteration 3: extreme floats data -- -array(4) { - [1]=> - string(5) "large" - ["value"]=> - string(5) "large" - [0]=> - int(12345678) - ["key"]=> - int(12345678) -} - --- Iteration 4: null uppercase data -- -array(4) { - [1]=> - string(6) "null 1" - ["value"]=> - string(6) "null 1" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 5: null lowercase data -- -array(4) { - [1]=> - string(6) "null 2" - ["value"]=> - string(6) "null 2" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 6: bool lowercase data -- -array(4) { - [1]=> - string(6) "lowert" - ["value"]=> - string(6) "lowert" - [0]=> - int(1) - ["key"]=> - int(1) -} - --- Iteration 7: bool uppercase data -- -array(4) { - [1]=> - string(6) "uppert" - ["value"]=> - string(6) "uppert" - [0]=> - int(1) - ["key"]=> - int(1) -} - --- Iteration 8: empty double quotes data -- -array(4) { - [1]=> - string(6) "emptyd" - ["value"]=> - string(6) "emptyd" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 9: empty single quotes data -- -array(4) { - [1]=> - string(6) "emptys" - ["value"]=> - string(6) "emptys" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 10: string data -- -array(4) { - [1]=> - string(7) "stringd" - ["value"]=> - string(7) "stringd" - [0]=> - string(7) "stringd" - ["key"]=> - string(7) "stringd" -} - --- Iteration 11: undefined data -- -array(4) { - [1]=> - string(9) "undefined" - ["value"]=> - string(9) "undefined" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} - --- Iteration 12: unset data -- -array(4) { - [1]=> - string(5) "unset" - ["value"]=> - string(5) "unset" - [0]=> - string(0) "" - ["key"]=> - string(0) "" -} -Done diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt deleted file mode 100644 index 64fbb4a8d0..0000000000 --- a/ext/standard/tests/array/each_variation4.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -Test each() function : usage variations - Referenced variables ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test behaviour of each() when: - * 1. Passed an array made up of referenced variables - * 2. Passed an array as $arr argument by reference - */ - -echo "*** Testing each() : usage variations ***\n"; - -echo "\n-- Array made up of referenced variables: --\n"; -$val1 = 'foo'; -$val2 = 'bar'; - -$arr1 = array('one' => &$val1, &$val2); - -echo "-- Call each until at the end of the array: --\n"; -var_dump( each($arr1) ); -var_dump( each($arr1) ); -var_dump( each($arr1) ); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Array made up of referenced variables: -- --- Call each until at the end of the array: -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(3) "foo" - ["value"]=> - string(3) "foo" - [0]=> - string(3) "one" - ["key"]=> - string(3) "one" -} -array(4) { - [1]=> - string(3) "bar" - ["value"]=> - string(3) "bar" - [0]=> - int(0) - ["key"]=> - int(0) -} -bool(false) -Done diff --git a/ext/standard/tests/array/each_variation5.phpt b/ext/standard/tests/array/each_variation5.phpt deleted file mode 100644 index 441882f962..0000000000 --- a/ext/standard/tests/array/each_variation5.phpt +++ /dev/null @@ -1,97 +0,0 @@ ---TEST-- -Test each() function : usage variations - Multi-dimensional arrays ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test behaviour of each() when passed: - * 1. a two-dimensional array - * 2. a sub-array - */ - -echo "*** Testing each() : usage variations ***\n"; - -$arr = array ('zero', - array(1, 2, 3), - 'one' => 'un', - array('a', 'b', 'c') - ); - -echo "\n-- Pass each() a two-dimensional array --\n"; -for ($i = 1; $i < count($arr); $i++) { - var_dump( each($arr) ); -} - -echo "\n-- Pass each() a sub-array --\n"; -var_dump( each($arr[2])); - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Pass each() a two-dimensional array -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} -array(4) { - [1]=> - array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - } - ["value"]=> - array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - } - [0]=> - int(1) - ["key"]=> - int(1) -} -array(4) { - [1]=> - string(2) "un" - ["value"]=> - string(2) "un" - [0]=> - string(3) "one" - ["key"]=> - string(3) "one" -} - --- Pass each() a sub-array -- -array(4) { - [1]=> - string(1) "a" - ["value"]=> - string(1) "a" - [0]=> - int(0) - ["key"]=> - int(0) -} -Done diff --git a/ext/standard/tests/array/each_variation6.phpt b/ext/standard/tests/array/each_variation6.phpt deleted file mode 100644 index de52ba5965..0000000000 --- a/ext/standard/tests/array/each_variation6.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -Test each() function : usage variations - Internal array pointer ---FILE-- -<?php -/* Prototype : array each(array $arr) - * Description: Return the currently pointed key..value pair in the passed array, - * and advance the pointer to the next element - * Source code: Zend/zend_builtin_functions.c - */ - -/* - * Test the position of the internal array pointer after a call to each() - */ - -echo "*** Testing each() : usage variations ***\n"; - -$arr = array('zero', 'one', 'two', 'abc', 'xyz'); - -echo "\n-- Current position: --\n"; -echo key($arr) . " => " . current($arr) . "\n"; - -echo "\n-- Call to each(): --\n"; -var_dump( each($arr) ); - -echo "\n-- New position: --\n"; -echo key($arr) . " => " . current($arr) . "\n"; - -echo "Done"; -?> ---EXPECTF-- -*** Testing each() : usage variations *** - --- Current position: -- -0 => zero - --- Call to each(): -- - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} - --- New position: -- -1 => one -Done diff --git a/ext/standard/tests/array/end.phpt b/ext/standard/tests/array/end.phpt index dc3f2eb75e..496b6c9566 100644 --- a/ext/standard/tests/array/end.phpt +++ b/ext/standard/tests/array/end.phpt @@ -106,21 +106,6 @@ $resources = array($file_handle, $dir_handle); var_dump( end($resources) ); var_dump( current($resources) ); -echo "\n*** Testing error conditions ***\n"; -/* checking for unexpected number of arguments */ -var_dump( end() ); -var_dump( end($array[0], $array[0]) ); - -/* checking for unexpected type of arguments */ -$var=1; -$var1="string"; -var_dump( end($var) ); -var_dump( end($var1) ); - -/* checking null array */ -$null_array = array(); -var_dump( end($null_array) ); - echo "Done\n"; @@ -219,19 +204,4 @@ array(2) { *** Testing end() on resource type *** resource(%d) of type (stream) resource(%d) of type (stream) - -*** Testing error conditions *** - -Warning: end() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: end() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, string given in %s on line %d -NULL -bool(false) Done diff --git a/ext/standard/tests/array/end_64bit.phpt b/ext/standard/tests/array/end_64bit.phpt index 0af5064e82..55f0d2e53b 100644 --- a/ext/standard/tests/array/end_64bit.phpt +++ b/ext/standard/tests/array/end_64bit.phpt @@ -106,21 +106,6 @@ $resources = array($file_handle, $dir_handle); var_dump( end($resources) ); var_dump( current($resources) ); -echo "\n*** Testing error conditions ***\n"; -/* checking for unexpected number of arguments */ -var_dump( end() ); -var_dump( end($array[0], $array[0]) ); - -/* checking for unexpected type of arguments */ -$var=1; -$var1="string"; -var_dump( end($var) ); -var_dump( end($var1) ); - -/* checking null array */ -$null_array = array(); -var_dump( end($null_array) ); - echo "Done\n"; ?> @@ -218,19 +203,4 @@ array(2) { *** Testing end() on resource type *** resource(%d) of type (stream) resource(%d) of type (stream) - -*** Testing error conditions *** - -Warning: end() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: end() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: end() expects parameter 1 to be array, string given in %s on line %d -NULL -bool(false) Done diff --git a/ext/standard/tests/array/extract_error.phpt b/ext/standard/tests/array/extract_error.phpt index e8bcf8f5d8..08e1824b0f 100644 --- a/ext/standard/tests/array/extract_error.phpt +++ b/ext/standard/tests/array/extract_error.phpt @@ -6,25 +6,11 @@ Test extract() function (error conditions) /* Testing Error Conditions */ echo "*** Testing Error Conditions ***\n"; -/* Zero Arguments */ -var_dump( extract() ); - /* Invalid second argument ( only 0-6 is valid) */ $arr = array(1); var_dump( extract($arr, -1 . "wddr") ); var_dump( extract($arr, 7 , "wddr") ); -/* scalar argument */ -$val = 1; -var_dump( extract($val) ); - -/* string argument */ -$str = "test"; -var_dump( extract($str) ); - -/* More than valid number of arguments i.e. 3 args */ -var_dump( extract($arr, EXTR_SKIP, "aa", "ee") ); - /* Two Arguments, second as prefix but without prefix string as third argument */ var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) ); @@ -33,9 +19,6 @@ echo "Done\n"; --EXPECTF-- *** Testing Error Conditions *** -Warning: extract() expects at least 1 parameter, 0 given in %s on line %d -NULL - Notice: A non well formed numeric value encountered in %s on line %d Warning: extract(): Invalid extract type in %s on line %d @@ -44,15 +27,6 @@ NULL Warning: extract(): Invalid extract type in %s on line %d NULL -Warning: extract() expects parameter 1 to be array, int given in %s on line %d -NULL - -Warning: extract() expects parameter 1 to be array, string given in %s on line %d -NULL - -Warning: extract() expects at most 3 parameters, 4 given in %s on line %d -NULL - Warning: extract(): specified extract type requires the prefix parameter in %s on line %d NULL Done diff --git a/ext/standard/tests/array/in_array_variation3.phpt b/ext/standard/tests/array/in_array_variation3.phpt index f07d1dea89..0b58990041 100644 --- a/ext/standard/tests/array/in_array_variation3.phpt +++ b/ext/standard/tests/array/in_array_variation3.phpt @@ -36,9 +36,17 @@ class in_array_check { $in_array_obj = new in_array_check(); //creating new object //error: as wrong datatype for second argument -var_dump( in_array("array_var", $in_array_obj) ); +try { + var_dump( in_array("array_var", $in_array_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //error: as wrong datatype for second argument -var_dump( in_array("foo", $in_array_obj) ); +try { + var_dump( in_array("foo", $in_array_obj) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //element found as "one" exists in array $array_var var_dump( in_array("one", $in_array_obj->array_var) ); @@ -51,11 +59,7 @@ bool(true) bool(true) *** Testing objects with in_array() *** - -Warning: in_array() expects parameter 2 to be array, object given in %s on line %d -NULL - -Warning: in_array() expects parameter 2 to be array, object given in %s on line %d -NULL +in_array() expects parameter 2 to be array, object given +in_array() expects parameter 2 to be array, object given bool(true) Done diff --git a/ext/standard/tests/array/max.phpt b/ext/standard/tests/array/max.phpt index ae4f304eae..df471ef255 100644 --- a/ext/standard/tests/array/max.phpt +++ b/ext/standard/tests/array/max.phpt @@ -5,7 +5,6 @@ precision=14 --FILE-- <?php -var_dump(max()); var_dump(max(1)); var_dump(max(array())); var_dump(max(new stdclass)); @@ -20,16 +19,13 @@ var_dump(max(0, true, false, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: max() expects at least 1 parameter, 0 given in %s on line 3 +Warning: max(): When only one parameter is given, it must be an array in %s on line %d NULL -Warning: max(): When only one parameter is given, it must be an array in %s on line 4 -NULL - -Warning: max(): Array must contain at least one element in %s on line 5 +Warning: max(): Array must contain at least one element in %s on line %d bool(false) -Warning: max(): When only one parameter is given, it must be an array in %s on line 6 +Warning: max(): When only one parameter is given, it must be an array in %s on line %d NULL int(2) float(2.11) diff --git a/ext/standard/tests/array/min.phpt b/ext/standard/tests/array/min.phpt index cb8c7cfdca..031e9b2c96 100644 --- a/ext/standard/tests/array/min.phpt +++ b/ext/standard/tests/array/min.phpt @@ -5,7 +5,6 @@ precision=14 --FILE-- <?php -var_dump(min()); var_dump(min(1)); var_dump(min(array())); var_dump(min(new stdclass)); @@ -20,16 +19,13 @@ var_dump(min(0, true, false, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: min() expects at least 1 parameter, 0 given in %s on line 3 +Warning: min(): When only one parameter is given, it must be an array in %s on line %d NULL -Warning: min(): When only one parameter is given, it must be an array in %s on line 4 -NULL - -Warning: min(): Array must contain at least one element in %s on line 5 +Warning: min(): Array must contain at least one element in %s on line %d bool(false) -Warning: min(): When only one parameter is given, it must be an array in %s on line 6 +Warning: min(): When only one parameter is given, it must be an array in %s on line %d NULL int(1) float(2.09) diff --git a/ext/standard/tests/array/negative_index.phpt b/ext/standard/tests/array/negative_index.phpt new file mode 100644 index 0000000000..a9f442acbd --- /dev/null +++ b/ext/standard/tests/array/negative_index.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test arrays starting with negative indices +--FILE-- +<?php + +$a = array_fill(-2, 3, true); +$b = [-2 => true, true, true]; +$c = ["string" => true, -2 => true, true, true]; +unset($c["string"]); +$d[-2] = true; +$d[] = true; +$d[] = true; +$e = [-2 => false]; +array_pop($e); +$e[] = true; +$e[] = true; +$e[] = true; + +var_dump($a === $b && $b === $c && $c === $d && $d == $e); +var_dump($a); +?> +--EXPECT-- +bool(true) +array(3) { + [-2]=> + bool(true) + [-1]=> + bool(true) + [0]=> + bool(true) +} diff --git a/ext/standard/tests/array/range_errors.phpt b/ext/standard/tests/array/range_errors.phpt index b63e9874bf..3a3b2bdf60 100644 --- a/ext/standard/tests/array/range_errors.phpt +++ b/ext/standard/tests/array/range_errors.phpt @@ -21,10 +21,7 @@ var_dump( range(1.0, 7.0, 6.5) ); echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --"; var_dump( range(7.0, 1.0, 6.5) ); -echo "\n-- Testing Invalid number of arguments --"; -var_dump( range() ); // No.of args = 0 -var_dump( range(1) ); // No.of args < expected -var_dump( range(1,2,3,4) ); // No.of args > expected +echo "\n-- Testing other conditions --"; var_dump( range(-1, -2, 2) ); var_dump( range("a", "j", "z") ); var_dump( range(0, 1, "140962482048819216326.24") ); @@ -67,16 +64,7 @@ bool(false) Warning: range(): step exceeds the specified range in %s on line %d bool(false) --- Testing Invalid number of arguments -- -Warning: range() expects at least 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: range() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: range() expects at most 3 parameters, 4 given in %s on line %d -bool(false) - +-- Testing other conditions -- Warning: range(): step exceeds the specified range in %s on line %d bool(false) diff --git a/ext/standard/tests/array/uasort_variation8.phpt b/ext/standard/tests/array/uasort_variation8.phpt index 2bb2b46512..d27cd569c0 100644 --- a/ext/standard/tests/array/uasort_variation8.phpt +++ b/ext/standard/tests/array/uasort_variation8.phpt @@ -10,7 +10,6 @@ Test uasort() function : usage variations - built-in function as 'cmp_function' /* * Passing different built-in library functions in place of 'cmp_function' * valid comparison functions: strcmp() & strcasecmp() -* language constructs: echo & exit */ echo "*** Testing uasort() : built in function as 'cmp_function' ***\n"; @@ -28,13 +27,6 @@ echo "-- Testing uasort() with built-in 'cmp_function': strcmp() --\n"; var_dump( uasort($array_arg, 'strcmp') ); // expecting: bool(true) var_dump($array_arg); -// Testing with language construct as comparison function -echo "-- Testing uasort() with language construct as 'cmp_function' --\n"; -var_dump( uasort($languageConstruct_fun_arg, 'echo') ); // expecting: bool(false) - -echo "-- Testing uasort() with language construct as 'cmp_function' --\n"; -var_dump( uasort($languageConstruct_fun_arg, 'exit') ); // expecting: bool(false) - echo "Done" ?> --EXPECTF-- @@ -67,12 +59,4 @@ array(5) { ["o"]=> string(6) "orange" } --- Testing uasort() with language construct as 'cmp_function' -- - -Warning: uasort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL --- Testing uasort() with language construct as 'cmp_function' -- - -Warning: uasort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL Done diff --git a/ext/standard/tests/array/usort_variation8.phpt b/ext/standard/tests/array/usort_variation8.phpt index 3296c4a36a..98c303e083 100644 --- a/ext/standard/tests/array/usort_variation8.phpt +++ b/ext/standard/tests/array/usort_variation8.phpt @@ -30,14 +30,6 @@ $temp_array2 = $array_arg; var_dump( usort($temp_array2, 'strcmp') ); var_dump($temp_array2); -// Testing with language construct as comparison function -echo "\n-- Testing usort() with language construct as 'cmp_function' --\n"; -$temp_array3 = $array_arg; -var_dump( usort($temp_array3, 'echo') ); - -echo "\n-- Testing usort() with language construct as 'cmp_function' --\n"; -$temp_array4 = $array_arg; -var_dump( usort($temp_array4, 'exit') ); ?> ===DONE=== --EXPECTF-- @@ -72,14 +64,4 @@ array(5) { [4]=> string(6) "orange" } - --- Testing usort() with language construct as 'cmp_function' -- - -Warning: usort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d -NULL - --- Testing usort() with language construct as 'cmp_function' -- - -Warning: usort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/assert/assert.phpt b/ext/standard/tests/assert/assert.phpt index 08e1188d60..71b0649141 100644 --- a/ext/standard/tests/assert/assert.phpt +++ b/ext/standard/tests/assert/assert.phpt @@ -1,44 +1,41 @@ --TEST-- assert() --INI-- -error_reporting = 2039 assert.active = 0 assert.warning = 1 assert.callback = assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php -function a($file,$line,$myev) +function a($file, $line, $unused, $desc) { - echo "assertion failed $line,\"$myev\"\n"; + echo "assertion failed $line,\"$desc\"\n"; } class a { - function assert($file,$line,$myev) + static function assert($file, $line, $unused, $desc) { - echo "class assertion failed $line,\"$myev\"\n"; + echo "class assertion failed $line,\"$desc\"\n"; } } assert_options(ASSERT_ACTIVE,1); -assert_options(ASSERT_QUIET_EVAL,1); assert_options(ASSERT_WARNING,0); $a = 0; assert_options(ASSERT_CALLBACK,"a"); -assert('$a != 0'); +assert($a != 0); assert_options(ASSERT_CALLBACK,array("a","assert")); -assert('$a != 0'); +assert($a != 0); $obj = new a(); assert_options(ASSERT_CALLBACK,array(&$obj,"assert")); -assert('$a != 0'); +assert($a != 0); ?> --EXPECT-- -assertion failed 22,"$a != 0" -class assertion failed 25,"$a != 0" -class assertion failed 29,"$a != 0" +assertion failed 21,"assert($a != 0)" +class assertion failed 24,"assert($a != 0)" +class assertion failed 28,"assert($a != 0)" diff --git a/ext/standard/tests/assert/assert02.phpt b/ext/standard/tests/assert/assert02.phpt deleted file mode 100644 index 85b72369cb..0000000000 --- a/ext/standard/tests/assert/assert02.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -catch assert() errors ---INI-- -assert.active=1 -assert.warning=1 -assert.callback= -assert.bail=0 -assert.quiet_eval=0 ---FILE-- -<?php - -assert(1); -assert('1'); -assert('$a'); - -try { - assert('aa=sd+as+safsafasfasafsaf'); -} catch (Throwable $e) { - echo $e->getMessage(), "\n"; -} - -assert('0'); - -assert_options(ASSERT_BAIL, 1); - -try { - assert('aa=sd+as+safsafasfasafsaf'); -} catch (Throwable $e) { - echo $e->getMessage(), "\n"; -} - -echo "done\n"; - -?> ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Notice: Undefined variable: a in %sassert02.php(%d) : assert code on line 1 - -Warning: assert(): Assertion "$a" failed in %sassert02.php on line %d - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -Failure evaluating code: -aa=sd+as+safsafasfasafsaf - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Warning: assert(): Assertion "0" failed in %sassert02.php on line %d - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Fatal error: Uncaught ParseError: syntax error, unexpected '=', expecting ';' in %s(%d) : assert code:1 -Stack trace: -#0 %s(%d): assert('aa=sd+as+safsaf...') -#1 {main} - -Next Error: Failure evaluating code: -aa=sd+as+safsafasfasafsaf in %s:%d -Stack trace: -#0 %s(%d): assert('aa=sd+as+safsaf...') -#1 {main} - thrown in %s on line %d diff --git a/ext/standard/tests/assert/assert03.phpt b/ext/standard/tests/assert/assert03.phpt index 80c42df473..3b231405f6 100644 --- a/ext/standard/tests/assert/assert03.phpt +++ b/ext/standard/tests/assert/assert03.phpt @@ -5,38 +5,33 @@ assert.active = 1 assert.warning = 0 assert.callback = assert.bail = 0 -assert.quiet_eval = 1 --FILE-- <?php -function a($file,$line,$myev) +function a($file, $line, $unused, $desc) { - echo "assertion failed - a - $line,\"$myev\"\n"; + echo "assertion failed - a - $line,\"$desc\"\n"; } -function b($file,$line,$myev) +function b($file, $line, $unused, $desc) { - echo "assertion failed - b - $line,\"$myev\"\n"; + echo "assertion failed - b - $line,\"$desc\"\n"; } assert_options(ASSERT_ACTIVE,1); -assert_options(ASSERT_QUIET_EVAL,1); assert_options(ASSERT_WARNING,0); $a = 0; -assert_options(ASSERT_CALLBACK,"a"); -assert('$a != 0'); +assert_options(ASSERT_CALLBACK, "a"); +assert($a != 0); /* Modify call back using ini_set() */ ini_set("assert.callback", "b"); -assert('$a != 0'); +assert($a != 0); ?> ==DONE== ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -assertion failed - a - %d,"$a != 0" - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -assertion failed - b - %d,"$a != 0" +--EXPECT-- +assertion failed - a - 18,"assert($a != 0)" +assertion failed - b - 22,"assert($a != 0)" ==DONE== diff --git a/ext/standard/tests/assert/assert04.phpt b/ext/standard/tests/assert/assert04.phpt index 0100229958..35f7668ce1 100644 --- a/ext/standard/tests/assert/assert04.phpt +++ b/ext/standard/tests/assert/assert04.phpt @@ -5,24 +5,14 @@ assert.active = 1 assert.warning = 1 assert.callback = assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php /* Assert not active */ assert_options(ASSERT_ACTIVE, 0); assert(1); - /* Wrong parameter count in assert */ assert_options(ASSERT_ACTIVE, 1); -assert(2, "failure", 3); - -/* Wrong parameter count in assert_options */ -assert_options(ASSERT_ACTIVE, 0, 2); - -/* Wrong parameter name in assert_options */ -$test="ASSERT_FRED"; -assert_options($test, 1); /* Assert false */ assert(0); @@ -36,12 +26,6 @@ echo "not reached\n"; ?> --EXPECTF-- -Warning: assert() expects at most 2 parameters, 3 given in %s on line %d - -Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d - -Warning: assert_options() expects parameter 1 to be int, string given in %s on line %d - Warning: assert(): assert(0) failed in %s on line %d Warning: assert(): assert(0) failed in %s on line %d diff --git a/ext/standard/tests/assert/assert_basic.phpt b/ext/standard/tests/assert/assert_basic.phpt index 73b3e73206..ce53a17a61 100644 --- a/ext/standard/tests/assert/assert_basic.phpt +++ b/ext/standard/tests/assert/assert_basic.phpt @@ -5,29 +5,16 @@ assert.active = 1 assert.warning = 0 assert.callback = f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php function f1() { echo "f1 called\n"; } -//String assert -$sa = "0 != 0"; -var_dump($r2=assert($sa)); -$sa = "0 == 0"; -var_dump($r2=assert($sa)); -//Non string assert -var_dump($r2=assert(0)); -var_dump($r2=assert(1)); ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -f1 called -bool(false) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -bool(true) +var_dump($r2 = assert(0)); +var_dump($r2 = assert(1)); +--EXPECT-- f1 called bool(false) bool(true) diff --git a/ext/standard/tests/assert/assert_basic1.phpt b/ext/standard/tests/assert/assert_basic1.phpt index a5bcda3316..cd4a5601ab 100644 --- a/ext/standard/tests/assert/assert_basic1.phpt +++ b/ext/standard/tests/assert/assert_basic1.phpt @@ -5,7 +5,6 @@ assert.active = 0 assert.warning = 0 assert.callback = f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php function f1() @@ -13,17 +12,9 @@ function f1() echo "f1 called\n"; } -//String assert -$sa = "0 != 0"; -var_dump($r2=assert($sa)); -$sa = "0 == 0"; -var_dump($r2=assert($sa)); - -//Non string assert var_dump($r2=assert(0)); var_dump($r2=assert(1)); +?> --EXPECT-- bool(true) bool(true) -bool(true) -bool(true) diff --git a/ext/standard/tests/assert/assert_basic2.phpt b/ext/standard/tests/assert/assert_basic2.phpt index d6c150d0d0..052e7d4e89 100644 --- a/ext/standard/tests/assert/assert_basic2.phpt +++ b/ext/standard/tests/assert/assert_basic2.phpt @@ -5,7 +5,6 @@ assert.active = 1 assert.warning = 1 assert.callback=f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php function f2() diff --git a/ext/standard/tests/assert/assert_basic3.phpt b/ext/standard/tests/assert/assert_basic3.phpt index a7fd990cbe..87103cbfbb 100644 --- a/ext/standard/tests/assert/assert_basic3.phpt +++ b/ext/standard/tests/assert/assert_basic3.phpt @@ -4,7 +4,6 @@ assert() - basic - Test that bailout works assert.active = 1 assert.warning = 1 assert.callback = f1 -assert.quiet_eval = 1 assert.bail = 0 --FILE-- <?php @@ -15,13 +14,10 @@ function f1() //bail out on error var_dump($rao=assert_options(ASSERT_BAIL, 1)); -$sa = "0 != 0"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo "If this is printed BAIL hasn't worked"; --EXPECTF-- int(0) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f1 called -Warning: assert(): assert($sa): "0 != 0" failed in %s on line 10 +Warning: assert(): assert(0 != 0) failed in %s on line %d diff --git a/ext/standard/tests/assert/assert_basic4.phpt b/ext/standard/tests/assert/assert_basic4.phpt index 4e78cf9ec1..289c51860e 100644 --- a/ext/standard/tests/assert/assert_basic4.phpt +++ b/ext/standard/tests/assert/assert_basic4.phpt @@ -4,7 +4,6 @@ assert() - basic - test initial values using ini.get and assert_options assert.active = 0 assert.warning = 0 assert.bail = 0 -assert.quiet_eval = 0 assert.callback = f1 --FILE-- <?php @@ -14,23 +13,19 @@ assert.callback = f1 echo "Initial values: assert_options(ASSERT_ACTIVE) => [".assert_options(ASSERT_ACTIVE)."]\n"; echo "Initial values: assert_options(ASSERT_WARNING) => [".assert_options(ASSERT_WARNING)."]\n"; echo "Initial values: assert_options(ASSERT_BAIL) => [".assert_options(ASSERT_BAIL)."]\n"; -echo "Initial values: assert_options(ASSERT_QUIET_EVAL) => [".assert_options(ASSERT_QUIET_EVAL)."]\n"; echo "Initial values: assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; //Using ini.get; echo "Initial values: ini.get(\"assert.active\") => [".ini_get("assert.active")."]\n"; echo "Initial values: ini.get(\"assert.warning\") => [".ini_get("assert.warning")."]\n"; echo "Initial values: ini.get(\"assert.bail\") => [".ini_get("assert.bail")."]\n"; -echo "Initial values: ini.get(\"assert.quiet_eval\") => [".ini_get("assert.quiet_eval")."]\n"; echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n"; --EXPECT-- Initial values: assert_options(ASSERT_ACTIVE) => [0] Initial values: assert_options(ASSERT_WARNING) => [0] Initial values: assert_options(ASSERT_BAIL) => [0] -Initial values: assert_options(ASSERT_QUIET_EVAL) => [0] Initial values: assert_options(ASSERT_CALLBACK) => [f1] Initial values: ini.get("assert.active") => [0] Initial values: ini.get("assert.warning") => [0] Initial values: ini.get("assert.bail") => [0] -Initial values: ini.get("assert.quiet_eval") => [0] Initial values: ini.get("assert.callback") => [f1] diff --git a/ext/standard/tests/assert/assert_basic5.phpt b/ext/standard/tests/assert/assert_basic5.phpt index f4943cdf16..cf2ed6ded3 100644 --- a/ext/standard/tests/assert/assert_basic5.phpt +++ b/ext/standard/tests/assert/assert_basic5.phpt @@ -5,7 +5,6 @@ assert.active = 1 assert.warning = 0 assert.callback = f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php function f1() @@ -15,22 +14,16 @@ function f1() //switch warning on and test return value var_dump($rao=assert_options(ASSERT_WARNING, 1)); -$sa = "0 != 0"; -var_dump($r2=assert($sa)); -$sa = "0 == 0"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); +var_dump($r2=assert(0 == 0)); //switch warning on and test return value var_dump($rao=assert_options(ASSERT_WARNING, 0)); --EXPECTF-- int(0) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f1 called -Warning: assert(): assert($sa): "0 != 0" failed in %s on line 10 +Warning: assert(): assert(0 != 0) failed in %s on line %d bool(false) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d bool(true) int(1) diff --git a/ext/standard/tests/assert/assert_basic6.phpt b/ext/standard/tests/assert/assert_basic6.phpt deleted file mode 100644 index 216c85c94b..0000000000 --- a/ext/standard/tests/assert/assert_basic6.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -assert() - basic - Test that bailout works ---INI-- -assert.active = 1 -assert.warning = 1 -assert.callback = f1 -assert.quiet_eval = 1 -assert.bail = 0 ---FILE-- -<?php -function f1($message) -{ - echo "f1 called\n"; -} - -//bail out on error -var_dump($rao = assert_options(ASSERT_BAIL, 1)); -$sa = "0 != 0"; -var_dump($r2 = assert($sa, "0 is 0")); -echo "If this is printed BAIL hasn't worked"; ---EXPECTF-- -int(0) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -f1 called - -Warning: assert(): 0 is 0: "0 != 0" failed in %s on line 10 diff --git a/ext/standard/tests/assert/assert_closures.phpt b/ext/standard/tests/assert/assert_closures.phpt index 4a013283a8..13a7e5415e 100644 --- a/ext/standard/tests/assert/assert_closures.phpt +++ b/ext/standard/tests/assert/assert_closures.phpt @@ -4,7 +4,6 @@ assert() - basic - accept closures as callback. assert.active = 1 assert.warning = 1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php assert_options(ASSERT_CALLBACK, function () { echo "Hello World!\n"; }); diff --git a/ext/standard/tests/assert/assert_error.phpt b/ext/standard/tests/assert/assert_error.phpt deleted file mode 100644 index 6e04060765..0000000000 --- a/ext/standard/tests/assert/assert_error.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -assert() - error - give assert nonsense string with quiet_eval on then off ---INI-- -assert.active = 1 -assert.warning = 1 -assert.callback = f1 -assert.bail = 0 -assert.quiet_eval = 0 ---FILE-- -<?php -function f1() -{ - echo "f1 called\n"; -} - -$sa = "threemeninaboat"; - -var_dump($r2=assert($sa)); - -var_dump($ra0 = assert_options(ASSERT_QUIET_EVAL, 1)); - -var_dump($r2=assert($sa)); ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Warning: Use of undefined constant threemeninaboat - assumed 'threemeninaboat' (this will throw an Error in a future version of PHP) in %s(9) : assert code on line 1 -bool(true) -int(0) - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -bool(true) diff --git a/ext/standard/tests/assert/assert_error2.phpt b/ext/standard/tests/assert/assert_error2.phpt index d1b6f1745f..de00743b1b 100644 --- a/ext/standard/tests/assert/assert_error2.phpt +++ b/ext/standard/tests/assert/assert_error2.phpt @@ -4,7 +4,6 @@ assert() - basic - Test that bailout works assert.active = 1 assert.warning = 1 assert.callback = f1 -assert.quiet_eval = 1 assert.bail = 0 error_reporting = -1 display_errors = 1 @@ -17,18 +16,10 @@ function f1($script, $line, $message, $user_message) //bail out on error var_dump($rao = assert_options(ASSERT_BAIL, 1)); -var_dump($r2 = assert("0 != 0")); +var_dump($r2 = assert(0 != 0)); echo "If this is printed BAIL hasn't worked"; --EXPECTF-- int(0) +f1 called -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Warning: assert(): Assertion "0 != 0" failed in %s on line 9 - -Fatal error: Uncaught ArgumentCountError: Too few arguments to function f1(), 3 passed and exactly 4 expected in %sassert_error2.php:2 -Stack trace: -#0 [internal function]: f1('%s', 9, '0 != 0') -#1 %sassert_error2.php(9): assert('0 != 0') -#2 {main} - thrown in %sassert_error2.php on line 2 +Warning: assert(): assert(0 != 0) failed in %s on line %d diff --git a/ext/standard/tests/assert/assert_error3.phpt b/ext/standard/tests/assert/assert_error3.phpt deleted file mode 100644 index 24538f4b04..0000000000 --- a/ext/standard/tests/assert/assert_error3.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -assert() - basic - Test recoverable error ---INI-- -assert.active = 1 -assert.warning = 1 -assert.callback = f1 -assert.quiet_eval = 0 -assert.bail = 0 -error_reporting = -1 -display_errors = 1 ---FILE-- -<?php -var_dump($r2 = assert("0 $ 0")); ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Fatal error: Uncaught ParseError: syntax error, unexpected '$', expecting ';' in %s(%d) : assert code:1 -Stack trace: -#0 %s(%d): assert('0 $ 0') -#1 {main} - -Next Error: Failure evaluating code: -0 $ 0 in %s:%d -Stack trace: -#0 %s(%d): assert('0 $ 0') -#1 {main} - thrown in %s on line %d diff --git a/ext/standard/tests/assert/assert_error4.phpt b/ext/standard/tests/assert/assert_error4.phpt deleted file mode 100644 index 59b4df6935..0000000000 --- a/ext/standard/tests/assert/assert_error4.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -assert() - basic - Test recoverable error ---INI-- -assert.active = 1 -assert.warning = 1 -assert.callback = f1 -assert.quiet_eval = 0 -assert.bail = 0 -error_reporting = -1 -display_errors = 1 ---FILE-- -<?php -$sa = "0 $ 0"; -var_dump($r2 = assert($sa, "Describing what was asserted")); ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Fatal error: Uncaught ParseError: syntax error, unexpected '$', expecting ';' in %s(%d) : assert code:1 -Stack trace: -#0 %s(%d): assert('0 $ 0', 'Describing what...') -#1 {main} - -Next Error: Failure evaluating code: -Describing what was asserted:"0 $ 0" in %s:%d -Stack trace: -#0 %s(%d): assert('0 $ 0', 'Describing what...') -#1 {main} - thrown in %s on line %d diff --git a/ext/standard/tests/assert/assert_variation.phpt b/ext/standard/tests/assert/assert_variation.phpt index 023f6690c5..d0cb90ff66 100644 --- a/ext/standard/tests/assert/assert_variation.phpt +++ b/ext/standard/tests/assert/assert_variation.phpt @@ -5,7 +5,6 @@ assert.active = 1 assert.warning = 0 assert.callback = f1 assert.bail = 0 -assert.quiet_eval = 0 --FILE-- <?php function f1() @@ -22,29 +21,28 @@ function f3() } class c1 { - function assert($file, $line, $myev) + static function assert($file, $line, $unused, $desc) { - echo "Class assertion failed $line, \"$myev\"\n"; + echo "Class assertion failed $line, \"$desc\"\n"; } } echo "Initial values: assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -$sa = "0 != 0"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Change callback function using ini.set and test return value \n"; var_dump($rv = ini_set("assert.callback","f2")); echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Change callback function using assert_options and test return value \n"; var_dump($rv=assert_options(ASSERT_CALLBACK, "f3")); echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; @@ -52,14 +50,14 @@ echo "Reset the name of the callback routine to a class method and check that it var_dump($rc=assert_options(ASSERT_CALLBACK, "c1")); echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n"; echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Reset callback options to use a class method \n"; var_dump($rc = assert_options(ASSERT_CALLBACK,array("c1","assert"))); var_dump($rao=assert_options(ASSERT_CALLBACK)); echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; echo "Reset callback options to use an object method \n"; @@ -67,13 +65,11 @@ $o = new c1(); var_dump($rc=assert_options(ASSERT_CALLBACK,array(&$o,"assert"))); var_dump($rao=assert_options(ASSERT_CALLBACK)); echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n"; -var_dump($r2=assert($sa)); +var_dump($r2=assert(0 != 0)); echo"\n"; --EXPECTF-- Initial values: assert_options(ASSERT_CALLBACK) => [f1] Initial values: ini.get("assert.callback") => [f1] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f1 called bool(false) @@ -81,8 +77,6 @@ Change callback function using ini.set and test return value string(2) "f1" assert_options(ASSERT_CALLBACK) => [f2] ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f2 called bool(false) @@ -90,8 +84,6 @@ Change callback function using assert_options and test return value string(2) "f2" assert_options(ASSERT_CALLBACK) => [f3] ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d f3 called bool(false) @@ -99,8 +91,6 @@ Reset the name of the callback routine to a class method and check that it works string(2) "f3" assert_options(ASSERT_CALLBACK) => [c1] ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d bool(false) Reset callback options to use a class method @@ -113,11 +103,7 @@ array(2) { } ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Deprecated: Non-static method c1::assert() should not be called statically in %s on line 53 -Class assertion failed 53, "0 != 0" +Class assertion failed 52, "assert(0 != 0)" bool(false) Reset callback options to use an object method @@ -136,7 +122,5 @@ array(2) { } ini.get("assert.callback") => [f2] - -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -Class assertion failed 61, "0 != 0" +Class assertion failed 60, "assert(0 != 0)" bool(false) diff --git a/ext/standard/tests/assert/bug73303.phpt b/ext/standard/tests/assert/bug73303.phpt deleted file mode 100644 index 7264f5a322..0000000000 --- a/ext/standard/tests/assert/bug73303.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -Bug #73303: Scope not inherited by eval in assert() ---FILE-- -<?php - -class Test { - public $prop; - - public function main(){ - assert('self::checkCacheKey(get_object_vars($this))'); - echo 'Success'; - } - private static function checkCacheKey($obj_properties){ - return count($obj_properties) == 1; - } -} - -$obj = new Test(); -$obj->main(); - -?> ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -Success diff --git a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt index 16a728e088..f3ab471b1f 100644 --- a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt +++ b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt @@ -9,7 +9,7 @@ Test get_class_methods() function : usage variations - unexpected types */ -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt index 8dde525ae8..d331e9a0d1 100644 --- a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt +++ b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt index d65bfcbc26..e545616667 100644 --- a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt +++ b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt index 0a4c575258..3e5447308b 100644 --- a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt +++ b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/method_exists_variation_001.phpt b/ext/standard/tests/class_object/method_exists_variation_001.phpt index 4accebe20a..93497c34b1 100644 --- a/ext/standard/tests/class_object/method_exists_variation_001.phpt +++ b/ext/standard/tests/class_object/method_exists_variation_001.phpt @@ -12,7 +12,7 @@ spl_autoload_register(function ($className) { echo "In autoload($className)\n"; }); -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/class_object/property_exists_error.phpt b/ext/standard/tests/class_object/property_exists_error.phpt index 217a5c61f9..7a2f4712da 100644 --- a/ext/standard/tests/class_object/property_exists_error.phpt +++ b/ext/standard/tests/class_object/property_exists_error.phpt @@ -10,19 +10,8 @@ Test property_exists() function : error conditions echo "*** Testing property_exists() : error conditions ***\n"; -$object_or_class = "obj"; -$property_name = 'string_val'; -$extra_arg = 10; - - -echo "\n-- Testing property_exists() function with more than expected no. of arguments --\n"; -var_dump( property_exists($object_or_class, $property_name, $extra_arg) ); - - -echo "\n-- Testing property_exists() function with less than expected no. of arguments --\n"; -var_dump( property_exists($object_or_class) ); - echo "\n-- Testing property_exists() function with incorrect arguments --\n"; +$property_name = 'string_val'; var_dump( property_exists(10, $property_name) ); ?> @@ -30,16 +19,6 @@ var_dump( property_exists(10, $property_name) ); --EXPECTF-- *** Testing property_exists() : error conditions *** --- Testing property_exists() function with more than expected no. of arguments -- - -Warning: property_exists() expects exactly 2 parameters, 3 given in %sproperty_exists_error.php on line %d -NULL - --- Testing property_exists() function with less than expected no. of arguments -- - -Warning: property_exists() expects exactly 2 parameters, 1 given in %sproperty_exists_error.php on line %d -NULL - -- Testing property_exists() function with incorrect arguments -- Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists_error.php on line %d diff --git a/ext/standard/tests/dir/closedir_error-win32-mb.phpt b/ext/standard/tests/dir/closedir_error-win32-mb.phpt deleted file mode 100644 index e5ca80b7d2..0000000000 --- a/ext/standard/tests/dir/closedir_error-win32-mb.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -Test closedir() function : error conditions - Pass incorrect number of arguments ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die("skip Valid only on Windows"); -} -?> ---FILE-- -<?php -/* Prototype : void closedir([resource $dir_handle]) - * Description: Close directory connection identified by the dir_handle - * Source code: ext/standard/dir.c - * Alias to functions: close - */ - -/* - * Pass incorrect number of arguments to closedir() to test behaviour - */ - -echo "*** Testing closedir() : error conditions ***\n"; - - -//Test closedir with one more than the expected number of arguments -echo "\n-- Testing closedir() function with more than expected no. of arguments --\n"; - -$dir_path = dirname(__FILE__) . '\私はガラスを食べられますclosedir_error'; -mkdir($dir_path); -$dir_handle = opendir($dir_path); - -$extra_arg = 10; -var_dump( closedir($dir_handle, $extra_arg) ); - -//successfully close the directory handle so can delete in CLEAN section -closedir($dir_handle); -?> -===DONE=== ---CLEAN-- -<?php -$base_dir = dirname(__FILE__); -$dir_path = $base_dir . '\私はガラスを食べられますclosedir_error'; -rmdir($dir_path); -?> ---EXPECTF-- -*** Testing closedir() : error conditions *** - --- Testing closedir() function with more than expected no. of arguments -- - -Warning: closedir() expects at most 1 parameter, 2 given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt deleted file mode 100644 index ffb0284d95..0000000000 --- a/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt +++ /dev/null @@ -1,244 +0,0 @@ ---TEST-- -Test scandir() function : usage variations - diff data types as $context arg ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die("skip Valid only on Windows"); -} -?> ---FILE-- -<?php -/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]]) - * Description: List files & directories inside the specified path - * Source code: ext/standard/dir.c - */ - -/* - * Pass different data types as $context argument to test how scandir() behaves - */ - -echo "*** Testing scandir() : usage variations ***\n"; - -// Initialise function arguments not being substituted -$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation3'; -mkdir($dir); -$sorting_order = SCANDIR_SORT_ASCENDING; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// get a class -class classA -{ - public function __toString() { - return "Class A object"; - } -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -// unexpected values to be passed to $context argument -$inputs = array( - - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "string", - 'string', - $heredoc, - - // object data -/*22*/ new classA(), - - // undefined data -/*23*/ @$undefined_var, - - // unset data -/*24*/ @$unset_var, - - // resource variable -/*25*/ $fp -); - -// loop through each element of $inputs to check the behavior of scandir() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump( scandir($dir, $sorting_order, $input) ); - $iterator++; -}; - -fclose($fp); -?> -===DONE=== ---CLEAN-- -<?php -$dir = dirname(__FILE__) . '/私はガラスを食べられますscandir_variation3'; -rmdir($dir); -?> ---EXPECTF-- -*** Testing scandir() : usage variations *** - --- Iteration 1 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 2 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 3 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 4 -- - -Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d -NULL - --- Iteration 5 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 6 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 7 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 8 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 9 -- - -Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d -NULL - --- Iteration 10 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 11 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 12 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 13 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 14 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 15 -- - -Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d -NULL - --- Iteration 16 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 17 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 18 -- - -Warning: scandir() expects parameter 3 to be resource, array given in %s on line %d -NULL - --- Iteration 19 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 20 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 21 -- - -Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d -NULL - --- Iteration 22 -- - -Warning: scandir() expects parameter 3 to be resource, object given in %s on line %d -NULL - --- Iteration 23 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 24 -- - -Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d -NULL - --- Iteration 25 -- - -Warning: scandir(): supplied resource is not a valid Stream-Context resource in %s on line %d -array(2) { - [0]=> - string(1) "." - [1]=> - string(2) ".." -} -===DONE=== diff --git a/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt index cba61d3fbf..ed68c2a7d7 100644 --- a/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt +++ b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt @@ -21,12 +21,6 @@ var_dump($d->read()); var_dump($d->rewind()); var_dump($d->close()); -echo "\n--> Try all methods with wrong number of args:\n"; -$d = new Directory($d); -var_dump($d->read(1,2)); -var_dump($d->rewind(1,2)); -var_dump($d->close(1,2)); - ?> --CLEAN-- <?php @@ -56,14 +50,3 @@ bool(false) Warning: Directory::close(): Unable to find my handle property in %s on line %d bool(false) - ---> Try all methods with wrong number of args: - -Warning: Directory::read() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::rewind() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::close() expects at most 1 parameter, 2 given in %s on line %d -NULL diff --git a/ext/standard/tests/directory/DirectoryClass_error_001.phpt b/ext/standard/tests/directory/DirectoryClass_error_001.phpt index 5b2771eef6..0a693dd9b7 100644 --- a/ext/standard/tests/directory/DirectoryClass_error_001.phpt +++ b/ext/standard/tests/directory/DirectoryClass_error_001.phpt @@ -17,12 +17,6 @@ var_dump($d->read()); var_dump($d->rewind()); var_dump($d->close()); -echo "\n--> Try all methods with wrong number of args:\n"; -$d = new Directory(getcwd()); -var_dump($d->read(1,2)); -var_dump($d->rewind(1,2)); -var_dump($d->close(1,2)); - ?> --EXPECTF-- --> Try all methods with bad handle: @@ -46,14 +40,3 @@ bool(false) Warning: Directory::close(): Unable to find my handle property in %s on line %d bool(false) - ---> Try all methods with wrong number of args: - -Warning: Directory::read() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::rewind() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: Directory::close() expects at most 1 parameter, 2 given in %s on line %d -NULL diff --git a/ext/standard/tests/file/005_error.phpt b/ext/standard/tests/file/005_error.phpt index e3ce551b3d..bc2bf3f978 100644 --- a/ext/standard/tests/file/005_error.phpt +++ b/ext/standard/tests/file/005_error.phpt @@ -29,31 +29,6 @@ var_dump( filemtime("/no/such/file/or/dir") ); var_dump( filectime("/no/such/file/or/dir") ); var_dump( touch("/no/such/file/or/dir", 10) ); -/* Only one invalid argument */ -var_dump( fileatime(__FILE__, "string") ); -var_dump( filemtime(__FILE__, 100) ); -var_dump( filectime(__FILE__, TRUE) ); -var_dump( touch(__FILE__, 10, 100, 123) ); - -echo "\n-- Testing No.of arguments less than expected --"; -var_dump( fileatime() ); -var_dump( filemtime() ); -var_dump( filectime() ); -var_dump( touch() ); - -echo "\n-- Testing No.of arguments greater than expected --"; -/* Both invalid arguments */ -var_dump( fileatime("/no/such/file/or/dir", "string") ); -var_dump( filemtime("/no/such/file/or/dir", 100) ); -var_dump( filectime("/no/such/file/or/dir", TRUE) ); -var_dump( touch("/no/such/file/or/dir", 10, 100, 123) ); - -/* Only one invalid argument */ -var_dump( fileatime(__FILE__, "string") ); -var_dump( filemtime(__FILE__, 100) ); -var_dump( filectime(__FILE__, TRUE) ); -var_dump( touch(__FILE__, 10, 100, 123) ); - echo "\nDone"; ?> --EXPECTF-- @@ -72,54 +47,4 @@ bool(false) Warning: touch(): Unable to create file /no/such/file/or/dir because No such file or directory in %s on line %d bool(false) -Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - --- Testing No.of arguments less than expected -- -Warning: fileatime() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: touch() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing No.of arguments greater than expected -- -Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - -Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/file/006_error.phpt b/ext/standard/tests/file/006_error.phpt index c35eba2128..e3bdda1b52 100644 --- a/ext/standard/tests/file/006_error.phpt +++ b/ext/standard/tests/file/006_error.phpt @@ -46,19 +46,6 @@ var_dump( chmod("/no/such/file/dir", 0777) ); var_dump( fileperms("/no/such/file/dir") ); echo "\n"; -/* With args less than expected */ -$fp = fopen(dirname(__FILE__)."/006_error.tmp", "w"); -fclose($fp); -var_dump( chmod(dirname(__FILE__)."/006_error.tmp") ); -var_dump( chmod("nofile") ); -var_dump( chmod() ); -var_dump( fileperms() ); - -/* With args greater than expected */ -var_dump( chmod(dirname(__FILE__)."/006_error.tmp", 0755, TRUE) ); -var_dump( fileperms(dirname(__FILE__)."/006_error.tmp", 0777) ); -var_dump( fileperms("nofile", 0777) ); - echo "\n*** Done ***\n"; ?> --CLEAN-- @@ -83,25 +70,4 @@ Warning: fileperms(): stat failed for /no/such/file/dir in %s on line %d bool(false) -Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: chmod() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: fileperms() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/006_variation2.phpt b/ext/standard/tests/file/006_variation2.phpt index 19bbf60fe9..cf81a83ea0 100644 --- a/ext/standard/tests/file/006_variation2.phpt +++ b/ext/standard/tests/file/006_variation2.phpt @@ -68,15 +68,23 @@ $perms_array = array( $count = 1; foreach($perms_array as $permission) { echo "-- Iteration $count --\n"; - var_dump( chmod($file_name, $permission) ); - printf("%o", fileperms($file_name) ); - echo "\n"; - clearstatcache(); - - var_dump( chmod($dir_name, $permission) ); - printf("%o", fileperms($dir_name) ); - echo "\n"; - clearstatcache(); + try { + var_dump( chmod($file_name, $permission) ); + printf("%o", fileperms($file_name) ); + echo "\n"; + clearstatcache(); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + + try { + var_dump( chmod($dir_name, $permission) ); + printf("%o", fileperms($dir_name) ); + echo "\n"; + clearstatcache(); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } echo "*** Done ***\n"; @@ -148,39 +156,15 @@ bool(true) bool(true) 43567 -- Iteration 12 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given -- Iteration 13 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given -- Iteration 14 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given -- Iteration 15 -- - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -103567 - -Warning: chmod() expects parameter 2 to be int, string given in %s on line %d -NULL -43567 +chmod() expects parameter 2 to be int, string given +chmod() expects parameter 2 to be int, string given *** Done *** diff --git a/ext/standard/tests/file/007_error.phpt b/ext/standard/tests/file/007_error.phpt deleted file mode 100644 index 93a6a23e5f..0000000000 --- a/ext/standard/tests/file/007_error.phpt +++ /dev/null @@ -1,185 +0,0 @@ ---TEST-- -Test fopen, fclose() & feof() functions: error conditions ---CREDITS-- -Dave Kelsey <d_kelsey@uk.ibm.com> ---FILE-- -<?php -/* - Prototype: resource fopen(string $filename, string $mode - [, bool $use_include_path [, resource $context]] ); - Description: Opens file or URL. - - Prototype: bool fclose ( resource $handle ); - Description: Closes an open file pointer - - Prototype: bool feof ( resource $handle ) - Description: Returns TRUE if the file pointer is at EOF or an error occurs - (including socket timeout); otherwise returns FALSE. -*/ - -echo "*** Testing error conditions for fopen(), fclsoe() & feof() ***\n"; -/* Arguments less than minimum no.of args */ - -// fopen () -var_dump(fopen(__FILE__)); // one valid argument -var_dump(fopen()); // zero argument - -// fclose() -$fp = fopen(__FILE__, "r"); -fclose($fp); -var_dump( fclose($fp) ); // closed handle -var_dump( fclose(__FILE__) ); // invalid handle -var_dump( fclose() ); // zero argument - -//feof() -var_dump( feof($fp) ); // closed handle -var_dump( feof(__FILE__) ); // invalid handle -var_dump( feof() ); //zero argument - -/* Arguments greater than maximum no.of ags */ -var_dump(fopen(__FILE__, "r", TRUE, "www.example.com", 100)); - -$fp = fopen(__FILE__, "r"); -var_dump( fclose($fp, "handle") ); - -var_dump( feof($fp, "handle")); -fclose($fp); - -/* test invalid arguments : non-resources */ -echo "-- Testing fopen(), fclose() & feof() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, - NULL, - "" -); - -/* loop to test fclose with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fopen($invalid_args[$loop_counter - 1], "r") ); - var_dump( fclose($invalid_args[$loop_counter - 1]) ); - var_dump( feof($invalid_args[$loop_counter - 1]) ); -} - -?> ---EXPECTF-- -*** Testing error conditions for fopen(), fclsoe() & feof() *** - -Warning: fopen() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: fopen() expects at least 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: fclose(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: fclose() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: feof() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: fopen() expects at most 4 parameters, 5 given in %s on line %d -bool(false) - -Warning: fclose() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: feof() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) --- Testing fopen(), fclose() & feof() with invalid arguments -- --- Iteration 1 -- - -Warning: fopen(string): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fopen(10): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, int given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fopen(10.5): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, float given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fopen(1): failed to open stream: No such file or directory in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fopen() expects parameter 1 to be a valid path, array given in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fopen() expects parameter 1 to be a valid path, object given in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, object given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: fopen(): Filename cannot be empty in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, null given in %s on line %d -bool(false) --- Iteration 8 -- - -Warning: fopen(): Filename cannot be empty in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -Warning: feof() expects parameter 1 to be resource, string given in %s on line %d -bool(false) diff --git a/ext/standard/tests/file/basename-win32.phpt b/ext/standard/tests/file/basename-win32.phpt index 996b060cea..703861dec7 100644 --- a/ext/standard/tests/file/basename-win32.phpt +++ b/ext/standard/tests/file/basename-win32.phpt @@ -115,23 +115,6 @@ check_basename( $file_paths ); echo "\n*** Testing possible variations in path and suffix ***\n"; check_basename( $file_path_variations ); -echo "\n*** Testing error conditions ***\n"; -// zero arguments -var_dump( basename() ); - -// more than expected no. of arguments -var_dump( basename("\\blah\\tmp\\bar.zip", ".zip", ".zip") ); - -// passing invalid type arguments -$object = new stdclass; -var_dump( basename( array("string\\bar") ) ); -var_dump( basename( array("string\\bar"), "bar" ) ); -var_dump( basename( "bar", array("string\\bar") ) ); -var_dump( basename( $object, "bar" ) ); -var_dump( basename( $object ) ); -var_dump( basename( $object, $object ) ); -var_dump( basename( "bar", $object ) ); - echo "Done\n"; ?> --EXPECTF-- @@ -309,33 +292,4 @@ string(0) "" --Iteration 32-- string(0) "" - -*** Testing error conditions *** - -Warning: basename() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: basename() expects at most 2 parameters, 3 given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: basename() expects parameter 2 to be string, array given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: basename() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: basename() expects parameter 2 to be string, object given in %s on line %d -NULL Done diff --git a/ext/standard/tests/file/basename.phpt b/ext/standard/tests/file/basename.phpt Binary files differindex a9b4389b5a..8352f4da4b 100644 --- a/ext/standard/tests/file/basename.phpt +++ b/ext/standard/tests/file/basename.phpt diff --git a/ext/standard/tests/file/bug39863.phpt b/ext/standard/tests/file/bug39863.phpt index 5460203e05..174e349b15 100644 --- a/ext/standard/tests/file/bug39863.phpt +++ b/ext/standard/tests/file/bug39863.phpt @@ -7,16 +7,11 @@ Andrew van der Stock, vanderaj @ owasp.org $filename = __FILE__ . chr(0). ".ridiculous"; -if (file_exists($filename)) { - echo "FAIL\n"; -} -else { - echo "PASS\n"; +try { + var_dump(file_exists($filename)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; } ?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -Warning: file_exists() expects parameter 1 to be a valid path, string given in %s on line %d -PASS -===DONE=== +--EXPECT-- +file_exists() expects parameter 1 to be a valid path, string given diff --git a/ext/standard/tests/file/bug72035.phpt b/ext/standard/tests/file/bug72035.phpt index feb4eb9acd..eb784f737d 100644 --- a/ext/standard/tests/file/bug72035.phpt +++ b/ext/standard/tests/file/bug72035.phpt @@ -3,7 +3,6 @@ Bug #72035 php-cgi.exe fails to run scripts relative to drive root --SKIPIF-- <?php if(substr(PHP_OS, 0, 3) != 'WIN' ) die('skip windows only test'); -if(php_sapi_name() != "cli") die('skip CLI only test'); $cgi = realpath(dirname(PHP_BINARY)) . DIRECTORY_SEPARATOR . "php-cgi.exe"; if (!file_exists($cgi)) die('skip CGI binary not found'); diff --git a/ext/standard/tests/file/chmod_error.phpt b/ext/standard/tests/file/chmod_error.phpt index 3b234c741f..b7999aa03d 100644 --- a/ext/standard/tests/file/chmod_error.phpt +++ b/ext/standard/tests/file/chmod_error.phpt @@ -10,19 +10,6 @@ Test chmod() function : error conditions echo "*** Testing chmod() : error conditions ***\n"; - -//Test chmod with one more than the expected number of arguments -echo "\n-- Testing chmod() function with more than expected no. of arguments --\n"; -$filename = 'string_val'; -$mode = 10; -$extra_arg = 10; -var_dump( chmod($filename, $mode, $extra_arg) ); - -// Testing chmod with one less than the expected number of arguments -echo "\n-- Testing chmod() function with less than expected no. of arguments --\n"; -$filename = 'string_val'; -var_dump( chmod($filename) ); - // testing chmod with a non-existing file $filename = "___nonExisitingFile___"; var_dump(chmod($filename, 0777)); @@ -32,16 +19,6 @@ var_dump(chmod($filename, 0777)); --EXPECTF-- *** Testing chmod() : error conditions *** --- Testing chmod() function with more than expected no. of arguments -- - -Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d -NULL - --- Testing chmod() function with less than expected no. of arguments -- - -Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Warning: chmod(): No such file or directory in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/file/copy_error.phpt b/ext/standard/tests/file/copy_error.phpt index 2d6395167b..36eb58fc2a 100644 --- a/ext/standard/tests/file/copy_error.phpt +++ b/ext/standard/tests/file/copy_error.phpt @@ -11,13 +11,6 @@ echo "*** Testing copy() function: error conditions --\n"; /* Invalid args */ var_dump( copy("/no/file", "file") ); -/* No.of args less than expected */ -var_dump( copy() ); -var_dump( copy(__FILE__) ); - -/* No.of args less than expected */ -var_dump( copy(__FILE__, "file1", "file1") ); - echo "*** Done ***\n"; ?> --EXPECTF-- @@ -25,13 +18,4 @@ echo "*** Done ***\n"; Warning: copy(/no/file): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: copy() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: copy() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: copy() expects parameter 3 to be resource, string given in %s on line %d -NULL *** Done *** diff --git a/ext/standard/tests/file/copy_variation4.phpt b/ext/standard/tests/file/copy_variation4.phpt Binary files differindex 3c3abea05a..8a2f8972fc 100644 --- a/ext/standard/tests/file/copy_variation4.phpt +++ b/ext/standard/tests/file/copy_variation4.phpt diff --git a/ext/standard/tests/file/disk.phpt b/ext/standard/tests/file/disk.phpt index a048af6ccb..fe415535ba 100644 --- a/ext/standard/tests/file/disk.phpt +++ b/ext/standard/tests/file/disk.phpt @@ -11,9 +11,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { --FILE-- <?php -var_dump(disk_free_space()); -var_dump(disk_total_space()); - var_dump(disk_free_space(-1)); var_dump(disk_total_space(-1)); @@ -26,12 +23,6 @@ var_dump(disk_total_space("/some/path/here")); echo "Done\n"; ?> --EXPECTF-- -Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - Warning: disk_free_space(): No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_free_space_error-win32.phpt b/ext/standard/tests/file/disk_free_space_error-win32.phpt index acb0fdd717..35140d23fb 100644 --- a/ext/standard/tests/file/disk_free_space_error-win32.phpt +++ b/ext/standard/tests/file/disk_free_space_error-win32.phpt @@ -16,12 +16,6 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) echo "*** Testing error conditions ***\n"; $file_path = dirname(__FILE__); -var_dump( disk_free_space() ); // Zero Arguments -var_dump( diskfreespace() ); - -var_dump( disk_free_space( $file_path, "extra argument") ); // More than valid number of arguments -var_dump( diskfreespace( $file_path, "extra argument") ); - var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory var_dump( diskfreespace( $file_path."/dir1" )); @@ -43,18 +37,6 @@ unlink($file_path."/disk_free_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_free_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_free_space(): The system cannot find the path specified. in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_free_space_error.phpt b/ext/standard/tests/file/disk_free_space_error.phpt index 6433cde702..00ec271f8d 100644 --- a/ext/standard/tests/file/disk_free_space_error.phpt +++ b/ext/standard/tests/file/disk_free_space_error.phpt @@ -16,12 +16,6 @@ if(substr(PHP_OS, 0, 3) == 'WIN') echo "*** Testing error conditions ***\n"; $file_path = dirname(__FILE__); -var_dump( disk_free_space() ); // Zero Arguments -var_dump( diskfreespace() ); - -var_dump( disk_free_space( $file_path, "extra argument") ); // More than valid number of arguments -var_dump( diskfreespace( $file_path, "extra argument") ); - var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory var_dump( diskfreespace( $file_path."/dir1" )); @@ -43,18 +37,6 @@ unlink($file_path."/disk_free_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_free_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_free_space(): No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_free_space_variation.phpt b/ext/standard/tests/file/disk_free_space_variation.phpt index 6c6575d896..912648f100 100644 --- a/ext/standard/tests/file/disk_free_space_variation.phpt +++ b/ext/standard/tests/file/disk_free_space_variation.phpt @@ -48,8 +48,16 @@ $count = 1; /* loop through to test each element the above array */ foreach($dirs_arr as $dir1) { echo "\n-- Iteration $count --\n"; - var_dump( disk_free_space( $dir1 ) ); - var_dump( diskfreespace( $dir1 ) ); + try { + var_dump( disk_free_space( $dir1 ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( diskfreespace( $dir1 ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } @@ -102,35 +110,19 @@ float(%d) float(%d) -- Iteration 9 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given -- Iteration 10 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given -- Iteration 11 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given -- Iteration 12 -- - -Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_free_space() expects parameter 1 to be a valid path, string given +diskfreespace() expects parameter 1 to be a valid path, string given --- Done --- diff --git a/ext/standard/tests/file/disk_total_space_error-win32.phpt b/ext/standard/tests/file/disk_total_space_error-win32.phpt index 0d511b37a7..29462bb31c 100644 --- a/ext/standard/tests/file/disk_total_space_error-win32.phpt +++ b/ext/standard/tests/file/disk_total_space_error-win32.phpt @@ -16,10 +16,6 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) echo "*** Testing error conditions ***\n"; $file_path = dirname(__FILE__); -var_dump( disk_total_space() ); // Zero Arguments - -var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments - var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory @@ -38,12 +34,6 @@ unlink($file_path."/disk_total_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_total_space(): The system cannot find the path specified. in %s on line %d bool(false) diff --git a/ext/standard/tests/file/disk_total_space_error.phpt b/ext/standard/tests/file/disk_total_space_error.phpt index 2c8a940117..b504727089 100644 --- a/ext/standard/tests/file/disk_total_space_error.phpt +++ b/ext/standard/tests/file/disk_total_space_error.phpt @@ -16,10 +16,6 @@ if(substr(PHP_OS, 0, 3) == 'WIN') echo "*** Testing error conditions ***\n"; $file_path = dirname(__FILE__); -var_dump( disk_total_space() ); // Zero Arguments - -var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments - var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory @@ -38,12 +34,6 @@ unlink($file_path."/disk_total_space.tmp"); --EXPECTF-- *** Testing error conditions *** -Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: disk_total_space(): No such file or directory in %s on line %d bool(false) float(%d) diff --git a/ext/standard/tests/file/disk_total_space_variation.phpt b/ext/standard/tests/file/disk_total_space_variation.phpt index 071fa60749..89c47dcaba 100644 --- a/ext/standard/tests/file/disk_total_space_variation.phpt +++ b/ext/standard/tests/file/disk_total_space_variation.phpt @@ -49,7 +49,11 @@ $count = 1; /* loop through to test each element the above array */ foreach($dirs_arr as $dir1) { echo "\n-- Iteration $count --\n"; - var_dump( disk_total_space( $dir1 ) ); + try { + var_dump( disk_total_space( $dir1 ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } @@ -96,25 +100,17 @@ float(%d) float(%d) -- Iteration 9 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given -- Iteration 10 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given -- Iteration 11 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given -- Iteration 12 -- - -Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +disk_total_space() expects parameter 1 to be a valid path, string given *** Testing with Binary Input *** -float(%d) +float(%s) --- Done --- diff --git a/ext/standard/tests/file/fgetc_variation2.phpt b/ext/standard/tests/file/fgetc_variation2.phpt index d444209af4..dd0dbb2096 100644 --- a/ext/standard/tests/file/fgetc_variation2.phpt +++ b/ext/standard/tests/file/fgetc_variation2.phpt @@ -26,15 +26,6 @@ fclose($file_handle); // read from closed file var_dump( fgetc($file_handle) ); -echo "-- Testing fgetc() with unset handle --\n"; -// open the file for reading -$file_handle = fopen(__FILE__, "r"); -// unset the file handle -unset($file_handle); - -//fgetc using unset handle -var_dump( fgetc($file_handle) ); - echo "Done"; ?> --EXPECTF-- @@ -43,10 +34,4 @@ echo "Done"; Warning: fgetc(): supplied resource is not a valid stream resource in %s on line %d bool(false) --- Testing fgetc() with unset handle -- - -Notice: Undefined variable: file_handle in %s on line %d - -Warning: fgetc() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fgets_error.phpt b/ext/standard/tests/file/fgets_error.phpt index 919343aa87..eed35b3001 100644 --- a/ext/standard/tests/file/fgets_error.phpt +++ b/ext/standard/tests/file/fgets_error.phpt @@ -8,14 +8,8 @@ Test fgets() function : error conditions */ echo "*** Testing error conditions ***\n"; -// zero argument -echo "-- Testing fgets() with zero argument --\n"; -var_dump( fgets() ); -// more than expected no. of args -echo "-- Testing fgets() with more than expected number of arguments --\n"; $fp = fopen(__FILE__, "r"); -var_dump( fgets($fp, 10, $fp) ); // invalid length argument echo "-- Testing fgets() with invalid length arguments --\n"; @@ -26,45 +20,10 @@ var_dump( fgets($fp, $len) ); $len = 1; var_dump( fgets($fp, $len) ); // return length - 1 always, expect false - -// test invalid arguments : non-resources -echo "-- Testing fgets() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fgets() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fgets($invalid_args[$loop_counter - 1], 10) ); -} - -// fgets() on a file handle which is already closed -echo "-- Testing fgets() with closed/unset file handle --"; -fclose($fp); -var_dump(fgets($fp,10)); - -// fgets() on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( fgets(@$file_handle,10)); - echo "Done\n"; ?> --EXPECTF-- *** Testing error conditions *** --- Testing fgets() with zero argument -- - -Warning: fgets() expects at least 1 parameter, 0 given in %s on line %d -bool(false) --- Testing fgets() with more than expected number of arguments -- - -Warning: fgets() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -- Testing fgets() with invalid length arguments -- Warning: fgets(): Length parameter must be greater than 0 in %s on line %d @@ -73,35 +32,4 @@ bool(false) Warning: fgets(): Length parameter must be greater than 0 in %s on line %d bool(false) bool(false) --- Testing fgets() with invalid arguments -- --- Iteration 1 -- - -Warning: fgets() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fgets() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fgets() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fgets() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fgets() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fgets() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Testing fgets() with closed/unset file handle -- -Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fgets_variation2.phpt b/ext/standard/tests/file/fgets_variation2.phpt index 0bbcf22039..aa8beb2d4d 100644 --- a/ext/standard/tests/file/fgets_variation2.phpt +++ b/ext/standard/tests/file/fgets_variation2.phpt @@ -27,16 +27,6 @@ fclose($file_handle); var_dump( fgets($file_handle) ); // default length var_dump( fgets($file_handle, 10) ); // with specific length -echo "-- Testing fgets() with unset handle --\n"; -// open the file for reading -$file_handle = fopen(__FILE__, "r"); -// unset the file handle -unset($file_handle); - -//fgets using unset handle -var_dump( fgets($file_handle) ); // default length -var_dump( fgets($file_handle, 10) ); // with specific length - echo "Done"; ?> --EXPECTF-- @@ -48,15 +38,4 @@ bool(false) Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d bool(false) --- Testing fgets() with unset handle -- - -Notice: Undefined variable: file_handle in %s on line %d - -Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Notice: Undefined variable: file_handle in %s on line %d - -Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fgetss.phpt b/ext/standard/tests/file/fgetss.phpt deleted file mode 100644 index 41ac46dc92..0000000000 --- a/ext/standard/tests/file/fgetss.phpt +++ /dev/null @@ -1,144 +0,0 @@ ---TEST-- -fgetss() tests ---FILE-- -<?php - -$filename = dirname(__FILE__)."/fgetss.html"; - -$array = array( - "askasdfasdf<b>aaaaaa\n</b>dddddd", - "asdqw<i onClick=\"hello();\">\naaaa<>qqqq", - "aaa<script>function foo() {}</script>qqq", - "asdasd<a\n asdjeje", - "", - "some text \n<b>blah</i>", - "some another text <> hoho </>" - ); - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp)); - var_dump(fgetss($fp)); -} - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp, 10)); - var_dump(fgetss($fp, 10)); -} - -var_dump(fgetss($fp, -10)); -var_dump(fgetss($fp, 0)); -fclose($fp); -var_dump(fgetss($fp, 0)); - -@unlink($filename); - -echo "Done\n"; -?> ---EXPECTF-- -Deprecated: Function fgetss() is deprecated in %s on line %d -string(18) "askasdfasdfaaaaaa -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "dddddd" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "asdqw -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(8) "aaaaqqqq" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(23) "aaafunction foo() {}qqq" - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "asdasd" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(0) "" - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(11) "some text -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(4) "blah" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(24) "some another text hoho " - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "askasdfas" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "dfaaaa" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(5) "asdqw" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(0) "" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(3) "aaa" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(7) "functio" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(6) "asdasd" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(0) "" - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "some text" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(2) " -" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "some anot" - -Deprecated: Function fgetss() is deprecated in %s on line %d -string(9) "her text " - -Deprecated: Function fgetss() is deprecated in %s on line %d - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) - -Deprecated: Function fgetss() is deprecated in %s on line %d - -Warning: fgetss(): supplied resource is not a valid stream resource in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss1.phpt b/ext/standard/tests/file/fgetss1.phpt deleted file mode 100644 index 0266371865..0000000000 --- a/ext/standard/tests/file/fgetss1.phpt +++ /dev/null @@ -1,73 +0,0 @@ ---TEST-- -more fgetss() tests ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -$filename = dirname(__FILE__)."/fgetss1.html"; - -$array = array( - "askasdfasdf<b>aaaaaa\n</b>dddddd", - "asdqw<i onClick=\"hello();\">\naaaa<>qqqq", - "aaa<script>function foo() {}</script>qqq", - "asdasd<a\n asdjeje", - "", - "some text \n<b>blah</i>", - "some another text <> hoho </>" - ); - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp, 1000, "<i>,<b>,<a>")); - var_dump(fgetss($fp)); -} - -foreach ($array as $str) { - file_put_contents($filename, $str); - $fp = fopen($filename, "r"); - var_dump(fgetss($fp, 10)); - var_dump(fgetss($fp, 10, "<script>,<a>")); -} - -echo "Done\n"; -?> ---CLEAN-- -<?php -$filename = dirname(__FILE__)."/fgetss1.html"; -unlink($filename); -?> ---EXPECT-- -string(21) "askasdfasdf<b>aaaaaa -" -string(6) "dddddd" -string(28) "asdqw<i onClick="hello();"> -" -string(8) "aaaaqqqq" -string(23) "aaafunction foo() {}qqq" -bool(false) -string(6) "asdasd" -string(0) "" -bool(false) -bool(false) -string(11) "some text -" -string(4) "blah" -string(24) "some another text hoho " -bool(false) -string(9) "askasdfas" -string(6) "dfaaaa" -string(5) "asdqw" -string(0) "" -string(3) "aaa" -string(9) "t>functio" -string(6) "asdasd" -string(0) "" -bool(false) -bool(false) -string(9) "some text" -string(2) " -" -string(9) "some anot" -string(9) "her text " -Done diff --git a/ext/standard/tests/file/fgetss_basic1.phpt b/ext/standard/tests/file/fgetss_basic1.phpt deleted file mode 100644 index b1e4a89c64..0000000000 --- a/ext/standard/tests/file/fgetss_basic1.phpt +++ /dev/null @@ -1,137 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read modes only ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* test fgetss with all read modes */ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : Basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; - -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} -/* try reading the file opened in different modes of reading */ -$file_modes = array("r","rb", "rt","r+", "r+b", "r+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $filename = dirname(__FILE__)."/fgetss_basic1.tmp"; - create_file ($filename); //create an empty file - file_put_contents($filename, $string_with_tags); - $file_handle = fopen($filename, $file_modes[$mode_counter]); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - rewind($file_handle); - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : Basic operations *** - --- Testing fgetss() with file opened using r mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using rb mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using rt mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using r+ mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using r+b mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using r+t mode -- --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt b/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt deleted file mode 100644 index 41ebf8e1da..0000000000 --- a/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt +++ /dev/null @@ -1,218 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only on Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} -$filename = dirname(__FILE__)."/fgetss_basic2私はガラスを食べられます.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : basic operations *** - --- Testing fgetss() with file opened using w+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_basic2-win32.phpt b/ext/standard/tests/file/fgetss_basic2-win32.phpt deleted file mode 100644 index ea76bb8a8b..0000000000 --- a/ext/standard/tests/file/fgetss_basic2-win32.phpt +++ /dev/null @@ -1,218 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only on Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} -$filename = dirname(__FILE__)."/fgetss_basic2.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : basic operations *** - --- Testing fgetss() with file opened using w+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+t mode -- -int(195) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_basic2.phpt b/ext/standard/tests/file/fgetss_basic2.phpt deleted file mode 100644 index d77689d980..0000000000 --- a/ext/standard/tests/file/fgetss_basic2.phpt +++ /dev/null @@ -1,216 +0,0 @@ ---TEST-- -Test fgetss() function : Basic functionality - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : basic operations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -EOT; - -$filename = dirname(__FILE__)."/fgetss_basic2.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 --\n"; - var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - rewind($file_handle); - /* read entire file and strip tags tags */ - echo "-- fgets() with length = 30, file pointer at 0 --\n"; - var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file - var_dump( ftell($file_handle) ); // checking file pointer position initially - var_dump( feof($file_handle) ); // confirm file pointer is not at eof - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : basic operations *** - --- Testing fgetss() with file opened using w+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using w+t mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using a+t mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+ mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+b mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) - --- Testing fgetss() with file opened using x+t mode -- -int(192) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 -- -string(27) "Testing fgetss() functions -" -int(40) -bool(false) --- fgets() with length = 30, file pointer at 0 -- -string(23) "Testing fgetss() functi" -int(29) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_error.phpt b/ext/standard/tests/file/fgetss_error.phpt deleted file mode 100644 index 13a5399406..0000000000 --- a/ext/standard/tests/file/fgetss_error.phpt +++ /dev/null @@ -1,108 +0,0 @@ ---TEST-- -Test fgetss() function : error conditions ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -echo "*** Testing error conditions ***\n"; -// zero argument -echo "-- Testing fgetss() with zero argument --\n"; -var_dump( fgetss() ); - -// more than expected no. of args -echo "-- Testing fgetss() with more than expected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( fgetss($fp, 100, '<p><a>', $fp) ); - -// invalid length argument -echo "-- Testing fgetss() with invalid length arguments --\n"; -$len = 0; -$allowable_tags = '<p><a>'; -var_dump( fgetss($fp, $len, $allowable_tags) ); -$len = -10; -var_dump( fgetss($fp, $len, $allowable_tags) ); -$len = 1; -var_dump( fgetss($fp, $len, $allowable_tags) ); // return length - 1 always, expect false - -// test invalid arguments : non-resources -echo "-- Testing fgetss() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fgetss() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fgetss($invalid_args[$loop_counter - 1], 10, $allowable_tags) ); -} -// fgetss() on a file handle which is already closed -echo "-- Testing fgetss() with closed/unset file handle --"; -fclose($fp); -var_dump(fgetss($fp,10,$allowable_tags)); - -// fgetss() on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( fgetss(@$file_handle,10)); - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing error conditions *** --- Testing fgetss() with zero argument -- - -Warning: fgetss() expects at least 1 parameter, 0 given in %s on line %d -bool(false) --- Testing fgetss() with more than expected number of arguments -- - -Warning: fgetss() expects at most 3 parameters, 4 given in %s on line %d -bool(false) --- Testing fgetss() with invalid length arguments -- - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) - -Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d -bool(false) -bool(false) --- Testing fgetss() with invalid arguments -- --- Iteration 1 -- - -Warning: fgetss() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fgetss() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fgetss() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fgetss() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fgetss() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fgetss() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Testing fgetss() with closed/unset file handle -- -Warning: fgetss(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fgetss() expects parameter 1 to be resource, null given in %s on line %d -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_variation1-win32.phpt b/ext/standard/tests/file/fgetss_variation1-win32.phpt deleted file mode 100644 index b8ad242d9e..0000000000 --- a/ext/standard/tests/file/fgetss_variation1-win32.phpt +++ /dev/null @@ -1,174 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - write only modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only on Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgets on files which are opened in non readable modes - w, wb, wt, - a, ab, at, - x, xb, xt -*/ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} - -$filename = dirname(__FILE__)."/fgetss_variation1.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w","wb", "wt","a", "ab", "at","x","xb","xt"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 , expected : no character should be read --\n"; - var_dump( fgetss($file_handle) ); // expected : no character should be read - var_dump( ftell($file_handle) ); //ensure that file pointer position is not changed - var_dump( feof($file_handle) ); // check if end of file pointer is set - - // close the file - fclose($file_handle); - - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wt mode -- -int(453) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using a mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using ab mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using at mode -- -int(453) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using x mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xt mode -- -int(453) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_variation1.phpt b/ext/standard/tests/file/fgetss_variation1.phpt deleted file mode 100644 index 6166f8468c..0000000000 --- a/ext/standard/tests/file/fgetss_variation1.phpt +++ /dev/null @@ -1,170 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - write only modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgets on files which are opened in non readable modes - w, wb, wt, - a, ab, at, - x, xb, xt -*/ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = dirname(__FILE__)."/fgetss_variation1.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w","wb", "wt","a", "ab", "at","x","xb","xt"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* read entire file and strip tags */ - echo "-- fgetss() with default length, file pointer at 0 , expected : no character should be read --\n"; - var_dump( fgetss($file_handle) ); // expected : no character should be read - var_dump( ftell($file_handle) ); //ensure that file pointer position is not changed - var_dump( feof($file_handle) ); // check if end of file pointer is set - - // close the file - fclose($file_handle); - - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using wt mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using a mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using ab mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using at mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using x mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xb mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) - --- Testing fgetss() with file opened using xt mode -- -int(445) -bool(true) -int(0) -bool(false) --- fgetss() with default length, file pointer at 0 , expected : no character should be read -- -bool(false) -int(0) -bool(false) -Done diff --git a/ext/standard/tests/file/fgetss_variation2.phpt b/ext/standard/tests/file/fgetss_variation2.phpt deleted file mode 100644 index 228d476079..0000000000 --- a/ext/standard/tests/file/fgetss_variation2.phpt +++ /dev/null @@ -1,436 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read modes ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -// include the common file related test functions -include ("file.inc"); - -/*Test fgetss() with all read modes , reading line by line with allowable tags: <test>, <html>, <?> */ - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this is the text containing \r character -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = dirname(__FILE__)."/fgetss_variation2.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("r","rb", "rt","r+", "r+b", "r+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - create_file ($filename); //create an empty file - file_put_contents($filename, $string_with_tags); - $file_handle = fopen($filename, $file_modes[$mode_counter]); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - /* rewind the file and read the file line by line with allowable tags */ - echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n"; - rewind($file_handle); - $line = 1; - while( !feof($file_handle) ) { - echo "-- Line $line --\n"; $line++; - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // check the file pointer position - var_dump( feof($file_handle) ); // check if eof reached - } - - // close the file - fclose($file_handle); - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using r mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using rb mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using rt mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using r+ mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using r+b mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) - --- Testing fgetss() with file opened using r+t mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(41) "this is the text containing
character -" -int(383) -bool(false) --- Line 9 -- -string(46) "this text contains some html tags body br -" -int(451) -bool(false) --- Line 10 -- -string(23) "this is the line with -" -int(474) -bool(false) --- Line 11 -- -string(12) " character. " -int(486) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation3-win32.phpt b/ext/standard/tests/file/fgetss_variation3-win32.phpt deleted file mode 100644 index c1777fc495..0000000000 --- a/ext/standard/tests/file/fgetss_variation3-win32.phpt +++ /dev/null @@ -1,573 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t - reading line by line with allowable tags: <test>, <html>, <?> -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} - -$filename = dirname(__FILE__)."/fgetss_variation3.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - rewind($file_handle); - var_dump( ftell($file_handle) ); - var_dump( filesize($filename) ); - var_dump( feof($file_handle) ); - - /* rewind the file and read the file line by line with allowable tags */ - echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n"; - $line = 1; - while( !feof($file_handle) ) { - echo "-- Line $line --\n"; $line++; - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // check the file pointer position - var_dump( feof($file_handle) ); // check if eof reached - } - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(0) -int(453) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(0) -int(453) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(0) -int(453) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation3.phpt b/ext/standard/tests/file/fgetss_variation3.phpt deleted file mode 100644 index 53a2ac879c..0000000000 --- a/ext/standard/tests/file/fgetss_variation3.phpt +++ /dev/null @@ -1,569 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t - reading line by line with allowable tags: <test>, <html>, <?> -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = dirname(__FILE__)."/fgetss_variation3.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - rewind($file_handle); - var_dump( ftell($file_handle) ); - var_dump( filesize($filename) ); - var_dump( feof($file_handle) ); - - /* rewind the file and read the file line by line with allowable tags */ - echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n"; - $line = 1; - while( !feof($file_handle) ) { - echo "-- Line $line --\n"; $line++; - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // check the file pointer position - var_dump( feof($file_handle) ); // check if eof reached - } - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(0) -int(445) -bool(false) --- Reading line by line with allowable tags: <test>, <html>, <?> -- --- Line 1 -- -string(40) "<test>Testing fgetss() functions</test> -" -int(40) -bool(false) --- Line 2 -- -string(10) " {;} this -" -int(99) -bool(false) --- Line 3 -- -string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%& -" -int(152) -bool(false) --- Line 4 -- -string(21) "<html> html </html> -" -int(193) -bool(false) --- Line 5 -- -string(43) "this line is without any html and php tags -" -int(236) -bool(false) --- Line 6 -- -string(79) "this is a line with more than eighty character,want to check line splitting cor" -int(315) -bool(false) --- Line 7 -- -string(27) "rectly after 80 characters -" -int(342) -bool(false) --- Line 8 -- -string(46) "this text contains some html tags body br -" -int(410) -bool(false) --- Line 9 -- -string(23) "this is the line with -" -int(433) -bool(false) --- Line 10 -- -string(12) " character. " -int(445) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation4.phpt b/ext/standard/tests/file/fgetss_variation4.phpt deleted file mode 100644 index 91470e1d44..0000000000 --- a/ext/standard/tests/file/fgetss_variation4.phpt +++ /dev/null @@ -1,170 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read modes, file pointer at EOF ---SKIPIF-- -<?php -if(substr(PHP_OS, 0, 3) == "WIN") - die("skip not for Windows"); -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -// include the common file related test functions -include ("file.inc"); - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this is the text containing \r character -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = dirname(__FILE__)."/fgetss_variation4.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("r","rb", "rt","r+", "r+b", "r+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - create_file ($filename); //create an empty file - file_put_contents($filename, $string_with_tags); - $file_handle = fopen($filename, $file_modes[$mode_counter]); - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - echo "-- Reading when file pointer points to EOF --\n"; - var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end - var_dump( ftell($file_handle) ); //ensure file pointer at end - var_dump( fgetss($file_handle) ); // try to read - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // now file is at the end try reading with length and allowable tags,expecting false - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // close the file - fclose($file_handle); - // delete the file - delete_file($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using r mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using rb mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using rt mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using r+ mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using r+b mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) - --- Testing fgetss() with file opened using r+t mode -- -int(486) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(486) -bool(false) -int(486) -bool(true) -bool(false) -int(486) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation5-win32.phpt b/ext/standard/tests/file/fgetss_variation5-win32.phpt deleted file mode 100644 index 57f1fd9059..0000000000 --- a/ext/standard/tests/file/fgetss_variation5-win32.phpt +++ /dev/null @@ -1,222 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes, file pointer at EOF ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip.. only valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; -if(substr(PHP_OS, 0, 3) == "WIN") { - $string_with_tags = str_replace("\r",'', $string_with_tags); -} - -$filename = dirname(__FILE__)."/fgetss_variation5.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - echo "-- Reading when file pointer points to EOF --\n"; - var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end - var_dump( ftell($file_handle) ); //ensure file pointer at end - var_dump( fgetss($file_handle) ); // try to read - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // now file is at the end try reading with length and allowable tags,expecting false - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(453) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(453) -bool(false) -int(453) -bool(true) -bool(false) -int(453) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(453) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(453) -bool(false) -int(453) -bool(true) -bool(false) -int(453) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(453) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(453) -bool(false) -int(453) -bool(true) -bool(false) -int(453) -bool(true) -Done diff --git a/ext/standard/tests/file/fgetss_variation5.phpt b/ext/standard/tests/file/fgetss_variation5.phpt deleted file mode 100644 index e6fc15a98c..0000000000 --- a/ext/standard/tests/file/fgetss_variation5.phpt +++ /dev/null @@ -1,219 +0,0 @@ ---TEST-- -Test fgetss() function : usage variations - read/write modes, file pointer at EOF ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip.. Not valid for Windows'); -} -?> ---FILE-- -<?php -error_reporting(E_ALL & ~E_DEPRECATED); - -/* - Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] ); - Description: Gets line from file pointer and strip HTML tags -*/ - -/* try fgetss on files which are opened in read/write modes - w+, w+b, w+t, - a+, a+b, a+t, - x+, x+b, x+t -*/ - - -echo "*** Testing fgetss() : usage variations ***\n"; - -/* string with html and php tags */ -$string_with_tags = <<<EOT -<test>Testing fgetss() functions</test> -<?php echo "this string is within php tag"; ?> {;}<{> this -is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg> -<html> html </html> <?php echo "php"; ?> -this line is without any html and php tags -this is a line with more than eighty character,want to check line splitting correctly after 80 characters -this text contains some html tags <body> body </body> <br> br </br> -this is the line with \n character. -EOT; - -$filename = dirname(__FILE__)."/fgetss_variation5.tmp"; - -/* try reading the file opened in different modes of reading */ -$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t"); - -for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) { - echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n"; - - /* create an empty file and write the strings with tags */ - $file_handle = fopen($filename, $file_modes[$mode_counter]); - fwrite($file_handle,$string_with_tags); //writing data to the file - if(!$file_handle) { - echo "Error: failed to open file $filename!\n"; - exit(); - } - // rewind the file pointer to beginning of the file - var_dump( filesize($filename) ); - var_dump( rewind($file_handle) ); - var_dump( ftell($file_handle) ); - var_dump( feof($file_handle) ); - - echo "-- Reading when file pointer points to EOF --\n"; - var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end - var_dump( ftell($file_handle) ); //ensure file pointer at end - var_dump( fgetss($file_handle) ); // try to read - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - // now file is at the end try reading with length and allowable tags,expecting false - var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") ); - var_dump( ftell($file_handle) ); // find out file position - var_dump( feof($file_handle) ); // ensure that file pointer is at eof - - - // close the file - fclose($file_handle); - - // delete the file - unlink($filename); -} // end of for - mode_counter - -echo "Done\n"; -?> ---EXPECT-- -*** Testing fgetss() : usage variations *** - --- Testing fgetss() with file opened using w+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using w+t mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using a+t mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+ mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+b mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) - --- Testing fgetss() with file opened using x+t mode -- -int(445) -bool(true) -int(0) -bool(false) --- Reading when file pointer points to EOF -- -int(0) -int(445) -bool(false) -int(445) -bool(true) -bool(false) -int(445) -bool(true) -Done diff --git a/ext/standard/tests/file/file_error.phpt b/ext/standard/tests/file/file_error.phpt index 12148189e8..2efacd1b31 100644 --- a/ext/standard/tests/file/file_error.phpt +++ b/ext/standard/tests/file/file_error.phpt @@ -8,14 +8,10 @@ Test file() function : error conditions Returns the file in an array */ $file_path = dirname(__FILE__); -echo "\n*** Testing error conditions ***"; +echo "\n*** Testing error conditions ***\n"; $file_handle = fopen($file_path."/file.tmp", "w"); -var_dump( file() ); // Zero No. of args $filename = $file_path."/file.tmp"; -var_dump( file($filename, $filename, $filename, $filename) ); // more than expected number of arguments - -var_dump( file($filename, "INCORRECT_FLAG", NULL) ); // Incorrect flag var_dump( file($filename, 10, NULL) ); // Incorrect flag var_dump( file("temp.tmp") ); // non existing filename @@ -30,14 +26,6 @@ unlink($file_path."/file.tmp"); ?> --EXPECTF-- *** Testing error conditions *** -Warning: file() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: file() expects at most 3 parameters, 4 given in %s on line %d -NULL - -Warning: file() expects parameter 2 to be int, string given in %s on line %d -NULL array(0) { } diff --git a/ext/standard/tests/file/file_get_contents_error.phpt b/ext/standard/tests/file/file_get_contents_error.phpt index f06628f516..6677d78866 100644 --- a/ext/standard/tests/file/file_get_contents_error.phpt +++ b/ext/standard/tests/file/file_get_contents_error.phpt @@ -17,14 +17,8 @@ include($file_path."/file.inc"); echo "\n-- Testing with Non-existing file --\n"; print( file_get_contents("/no/such/file/or/dir") ); -echo "\n-- Testing No.of arguments less than expected --\n"; -print( file_get_contents() ); - -echo "\n-- Testing No.of arguments greater than expected --\n"; - create_files($file_path, 1, "text", 0755, 100, "w", "file", 1, "byte"); $file_handle = fopen($file_path."/file_put_contents_error.tmp", "w"); -print( file_get_contents($file_path."/file1.tmp", false, $file_handle, 1, 2, "extra_argument") ); echo "\n-- Testing for invalid negative maxlen values --"; var_dump( file_get_contents($file_path."/file1.tmp", FALSE, $file_handle, 0, -5) ); @@ -52,14 +46,6 @@ if(file_exists($file_path."/file_put_contents1.tmp")) { Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d --- Testing No.of arguments less than expected -- - -Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d - --- Testing No.of arguments greater than expected -- - -Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d - -- Testing for invalid negative maxlen values -- Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d bool(false) diff --git a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt index b2a09798e3..23c33b60d3 100644 --- a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt +++ b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt @@ -18,15 +18,7 @@ $file_path = dirname(__FILE__); echo "\n-- Testing with Non-existing file --\n"; print( file_get_contents("/no/such/file/or/dir") ); -echo "\n-- Testing No.of arguments less than expected --\n"; -print( file_get_contents() ); -print( file_put_contents() ); -print( file_put_contents($file_path."/".__FILE__) ); - $file_handle = fopen($file_path."/file_put_contents.tmp", "w"); -echo "\n-- Testing No.of arguments greater than expected --\n"; -print( file_put_contents("abc.tmp", 12345, 1, $file_handle, "extra_argument") ); -print( file_get_contents("abc.tmp", false, $file_handle, 1, 2, "extra_argument") ); echo "\n-- Testing for invalid negative maxlen values --"; file_put_contents($file_path."/file_put_contents1.tmp", "Garbage data in the file"); @@ -50,20 +42,6 @@ unlink($file_path."/file_put_contents1.tmp"); Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d --- Testing No.of arguments less than expected -- - -Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d - -Warning: file_put_contents() expects at least 2 parameters, 0 given in %s on line %d - -Warning: file_put_contents() expects at least 2 parameters, 1 given in %s on line %d - --- Testing No.of arguments greater than expected -- - -Warning: file_put_contents() expects at most 4 parameters, 5 given in %s on line %d - -Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d - -- Testing for invalid negative maxlen values -- Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d bool(false) diff --git a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt index 4928404098..25060ea0cf 100644 --- a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt @@ -38,7 +38,11 @@ $names_arr = array( foreach($names_arr as $key =>$value) { echo "\n-- Filename: $key --\n"; - var_dump(file_get_contents($value)); + try { + var_dump(file_get_contents($value)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } ?> @@ -77,14 +81,10 @@ Warning: file_get_contents( ): failed to open stream: Permission denied in %s on bool(false) -- Filename: \0 -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, string given -- Filename: array() -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/file_get_contents_variation8.phpt b/ext/standard/tests/file/file_get_contents_variation8.phpt index 97a3495d54..f826ad60c2 100644 --- a/ext/standard/tests/file/file_get_contents_variation8.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8.phpt @@ -37,7 +37,11 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - var_dump(file_get_contents($names_arr[$i])); + try { + var_dump(file_get_contents($names_arr[$i])); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } echo "\n*** Done ***\n"; @@ -69,13 +73,9 @@ bool(false) Warning: file_get_contents( ): failed to open stream: No such file or directory in %s on line %d bool(false) -- Iteration 6 -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %s on line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, array given -- Iteration 8 -- Warning: file_get_contents(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/file_put_contents_variation2.phpt b/ext/standard/tests/file/file_put_contents_variation2.phpt index ae56486d5f..5e18ce1948 100644 --- a/ext/standard/tests/file/file_put_contents_variation2.phpt +++ b/ext/standard/tests/file/file_put_contents_variation2.phpt @@ -13,8 +13,8 @@ Dave Kelsey <d_kelsey@uk.ibm.com> echo "*** Testing file_put_contents() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt index 095980b536..4c03581c48 100644 --- a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt @@ -35,14 +35,18 @@ $names_arr = array( ); foreach($names_arr as $key =>$value) { - echo "\n-- Filename: $key --\n"; - $res = file_put_contents($value, "Some data"); - if ($res !== false && $res != null) { - echo "$res bytes written to: $value\n"; - unlink($value); - } else { - echo "Failed to write data to: $key\n"; - } + echo "\n-- Filename: $key --\n"; + try { + $res = file_put_contents($value, "Some data"); + if ($res !== false && $res != null) { + echo "$res bytes written to: $value\n"; + unlink($value); + } else { + echo "Failed to write data to: $key\n"; + } + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> @@ -77,14 +81,10 @@ Warning: file_put_contents( ): failed to open stream: Permission denied in %s on Failed to write data to: " " -- Filename: \0 -- - -Warning: file_put_contents() expects parameter 1 to be a valid path, string given in %s on line %d -Failed to write data to: \0 +file_put_contents() expects parameter 1 to be a valid path, string given -- Filename: array() -- - -Warning: file_put_contents() expects parameter 1 to be a valid path, array given in %s on line %d -Failed to write data to: array() +file_put_contents() expects parameter 1 to be a valid path, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/file_put_contents_variation8.phpt b/ext/standard/tests/file/file_put_contents_variation8.phpt Binary files differindex 4aef0644f9..76b7b6f5c6 100644 --- a/ext/standard/tests/file/file_put_contents_variation8.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8.phpt diff --git a/ext/standard/tests/file/filegroup_error.phpt b/ext/standard/tests/file/filegroup_error.phpt index e32711cd5b..e602f3441f 100644 --- a/ext/standard/tests/file/filegroup_error.phpt +++ b/ext/standard/tests/file/filegroup_error.phpt @@ -15,10 +15,6 @@ var_dump( filegroup("/no/such/file/dir") ); var_dump( filegroup("string") ); var_dump( filegroup(100) ); -/* Invalid no.of arguments */ -var_dump( filegroup() ); // args < expected -var_dump( filegroup("/no/such/file", "root") ); // args > expected - echo "\n*** Done ***\n"; ?> --EXPECTF-- @@ -33,10 +29,4 @@ bool(false) Warning: filegroup(): stat failed for 100 in %s on line %d bool(false) -Warning: filegroup() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filegroup() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/filegroup_variation2.phpt b/ext/standard/tests/file/filegroup_variation2.phpt index 809d61ba73..46a3dc9f35 100644 --- a/ext/standard/tests/file/filegroup_variation2.phpt +++ b/ext/standard/tests/file/filegroup_variation2.phpt @@ -11,7 +11,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com> /* Testing filegroup() with invalid arguments -int, float, bool, NULL, resource */ $file_path = dirname(__FILE__); -$file_handle = fopen($file_path."/filegroup_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -22,7 +21,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -34,7 +32,6 @@ foreach( $filenames as $filename ) { var_dump( filegroup($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -58,9 +55,6 @@ bool(false) bool(false) bool(false) -Warning: filegroup() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: filegroup(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/filegroup_variation3.phpt b/ext/standard/tests/file/filegroup_variation3.phpt index ebefeb7e3f..a0d4b2fdee 100644 --- a/ext/standard/tests/file/filegroup_variation3.phpt +++ b/ext/standard/tests/file/filegroup_variation3.phpt @@ -39,7 +39,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( filegroup( $file_path."/".$file ) ); + try { + var_dump( filegroup( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -74,12 +78,8 @@ bool(false) Warning: filegroup(): stat failed for %s/filegroup_variation3/filegroup*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +filegroup() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +filegroup() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/fileinode_error.phpt b/ext/standard/tests/file/fileinode_error.phpt index 462ab62367..d080467f04 100644 --- a/ext/standard/tests/file/fileinode_error.phpt +++ b/ext/standard/tests/file/fileinode_error.phpt @@ -16,12 +16,6 @@ var_dump( fileinode("/no/such/file/dir") ); var_dump( fileinode("string") ); var_dump( fileinode(100) ); -/* No.of arguments less than expected */ -var_dump( fileinode() ); - -/* No.of arguments greater than expected */ -var_dump( fileinode(__FILE__, "string") ); - echo "\n*** Done ***"; --EXPECTF-- *** Testing error conditions of fileinode() *** @@ -34,10 +28,4 @@ bool(false) Warning: fileinode(): stat failed for 100 in %s on line 14 bool(false) -Warning: fileinode() expects exactly 1 parameter, 0 given in %s on line 17 -NULL - -Warning: fileinode() expects exactly 1 parameter, 2 given in %s on line 20 -NULL - *** Done *** diff --git a/ext/standard/tests/file/fileinode_variation2.phpt b/ext/standard/tests/file/fileinode_variation2.phpt index 90c7eb19e3..d6397d33b8 100644 --- a/ext/standard/tests/file/fileinode_variation2.phpt +++ b/ext/standard/tests/file/fileinode_variation2.phpt @@ -12,7 +12,6 @@ Description: Returns the inode number of the file, or FALSE in case of an error. /* Testing fileinode() with invalid arguments -int, float, bool, NULL, resource */ $file_path = dirname(__FILE__); -$file_handle = fopen($file_path."/fileinode_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -23,7 +22,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -35,7 +33,6 @@ foreach( $filenames as $filename ) { var_dump( fileinode($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -59,9 +56,6 @@ bool(false) bool(false) bool(false) -Warning: fileinode() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: fileinode(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/fileinode_variation3.phpt b/ext/standard/tests/file/fileinode_variation3.phpt index 2f51e8f595..e50fcfb767 100644 --- a/ext/standard/tests/file/fileinode_variation3.phpt +++ b/ext/standard/tests/file/fileinode_variation3.phpt @@ -40,7 +40,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( fileinode( $file_path."/".$file ) ); + try { + var_dump( fileinode( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -75,12 +79,8 @@ bool(false) Warning: fileinode(): stat failed for %s/fileinode_variation3/fileinode*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileinode() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileinode() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/fileowner_error.phpt b/ext/standard/tests/file/fileowner_error.phpt index 967a541cc0..807c09f0f0 100644 --- a/ext/standard/tests/file/fileowner_error.phpt +++ b/ext/standard/tests/file/fileowner_error.phpt @@ -15,10 +15,6 @@ var_dump( fileowner("/no/such/file/dir") ); var_dump( fileowner("string") ); var_dump( fileowner(100) ); -/* Invalid no.of arguments */ -var_dump( fileowner() ); // args < expected -var_dump( fileowner("/no/such/file", "root") ); // args > expected - echo "\n*** Done ***\n"; ?> --EXPECTF-- @@ -33,10 +29,4 @@ bool(false) Warning: fileowner(): stat failed for 100 in %s on line %d bool(false) -Warning: fileowner() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: fileowner() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/fileowner_variation2.phpt b/ext/standard/tests/file/fileowner_variation2.phpt index 131d43bfaa..f6741cb9ca 100644 --- a/ext/standard/tests/file/fileowner_variation2.phpt +++ b/ext/standard/tests/file/fileowner_variation2.phpt @@ -12,7 +12,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com> /* Testing fileowner() with invalid arguments -int, float, bool, NULL, resource */ $file_path = dirname(__FILE__); -$file_handle = fopen($file_path."/fileowner_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -23,7 +22,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -35,7 +33,6 @@ foreach( $filenames as $filename ) { var_dump( fileowner($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -59,9 +56,6 @@ bool(false) bool(false) bool(false) -Warning: fileowner() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: fileowner(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/fileowner_variation3.phpt b/ext/standard/tests/file/fileowner_variation3.phpt index 5768f528f1..6a2953aa6c 100644 --- a/ext/standard/tests/file/fileowner_variation3.phpt +++ b/ext/standard/tests/file/fileowner_variation3.phpt @@ -40,7 +40,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( fileowner( $file_path."/".$file ) ); + try { + var_dump( fileowner( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -75,12 +79,8 @@ bool(false) Warning: fileowner(): stat failed for %s/fileowner_variation3/fileowner*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: fileowner() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileowner() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: fileowner() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileowner() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/fileperms_variation2.phpt b/ext/standard/tests/file/fileperms_variation2.phpt index 6b1778e74e..b2b8a19859 100644 --- a/ext/standard/tests/file/fileperms_variation2.phpt +++ b/ext/standard/tests/file/fileperms_variation2.phpt @@ -11,7 +11,6 @@ Dave Kelsey <d_kelsey@uk.ibm.com> /* Testing fileperms() with invalid arguments -int, float, bool, NULL, resource */ $file_path = dirname(__FILE__); -$file_handle = fopen($file_path."/fileperms_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -22,7 +21,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -34,7 +32,6 @@ foreach( $filenames as $filename ) { var_dump( fileperms($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -58,9 +55,6 @@ bool(false) bool(false) bool(false) -Warning: fileperms() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: fileperms(): stat failed for 1234 in %s on line %d bool(false) diff --git a/ext/standard/tests/file/fileperms_variation3.phpt b/ext/standard/tests/file/fileperms_variation3.phpt index 6ae97d1601..5b1160019a 100644 --- a/ext/standard/tests/file/fileperms_variation3.phpt +++ b/ext/standard/tests/file/fileperms_variation3.phpt @@ -39,7 +39,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( fileperms( $file_path."/".$file ) ); + try { + var_dump( fileperms( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -74,12 +78,8 @@ bool(false) Warning: fileperms(): stat failed for %s/fileperms_variation3/fileperms*.tmp in %s on line %d bool(false) - Iteration 7 - - -Warning: fileperms() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileperms() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: fileperms() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fileperms() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/filesize_error.phpt b/ext/standard/tests/file/filesize_error.phpt index 9f721ff921..5ad8ee99ca 100644 --- a/ext/standard/tests/file/filesize_error.phpt +++ b/ext/standard/tests/file/filesize_error.phpt @@ -14,13 +14,6 @@ echo "*** Testing filesize(): error conditions ***"; var_dump( filesize("/no/such/file") ); var_dump( filesize("/no/such/dir") ); -/* No.of arguments less than expected */ -var_dump( filesize() ); - -/* No.of arguments greater than expected */ -var_dump( filesize(__FILE__, 2000) ); -echo "\n"; - echo "*** Done ***\n"; ?> --EXPECTF-- @@ -30,11 +23,4 @@ bool(false) Warning: filesize(): stat failed for /no/such/dir in %s on line %d bool(false) - -Warning: filesize() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: filesize() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/filetype_error.phpt b/ext/standard/tests/file/filetype_error.phpt index b49a5286c6..a34671d9b0 100644 --- a/ext/standard/tests/file/filetype_error.phpt +++ b/ext/standard/tests/file/filetype_error.phpt @@ -16,12 +16,6 @@ print( filetype("/no/such/file/dir") ); print( filetype("string") ); print( filetype(100) ); -/* No.of args less than expected */ -print( filetype() ); - -/* No.of args greater than expected */ -print( filetype("file", "file") ); - echo "\n*** Done ***\n"; ?> --EXPECTF-- @@ -32,8 +26,4 @@ Warning: filetype(): Lstat failed for string in %s on line %d Warning: filetype(): Lstat failed for 100 in %s on line %d -Warning: filetype() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: filetype() expects exactly 1 parameter, 2 given in %s on line %d - *** Done *** diff --git a/ext/standard/tests/file/flock.phpt b/ext/standard/tests/file/flock.phpt index 2330270113..4c3cb45c06 100644 --- a/ext/standard/tests/file/flock.phpt +++ b/ext/standard/tests/file/flock.phpt @@ -5,9 +5,6 @@ flock() tests $file = dirname(__FILE__)."/flock.dat"; -var_dump(flock()); -var_dump(flock("", "", $var)); - $fp = fopen($file, "w"); fclose($fp); @@ -41,12 +38,6 @@ $file = dirname(__FILE__)."/flock.dat"; unlink($file); ?> --EXPECTF-- -Warning: flock() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: flock() expects parameter 1 to be resource, string given in %s on line %d -NULL - Warning: flock(): supplied resource is not a valid stream resource in %s on line %d bool(false) bool(true) diff --git a/ext/standard/tests/file/flock_error.phpt b/ext/standard/tests/file/flock_error.phpt index ccb6274756..0e3f1d949c 100644 --- a/ext/standard/tests/file/flock_error.phpt +++ b/ext/standard/tests/file/flock_error.phpt @@ -29,7 +29,11 @@ $operations = array( $i = 0; foreach($operations as $operation) { echo "\n--- Iteration $i ---"; - var_dump(flock($fp, $operation)); + try { + var_dump(flock($fp, $operation)); + } catch (TypeError $e) { + echo "\n", $e->getMessage(), "\n"; + } $i++; } @@ -39,15 +43,6 @@ $fp = fopen($file, "w"); fclose($fp); var_dump(flock($fp, LOCK_SH|LOCK_NB)); -var_dump(flock("", "", $var)); - -/* No.of args leass than expected */ -var_dump(flock()); -var_dump(flock($fp)); - -/* No.of args greater than expected */ -var_dump(flock($fp, "", $var, "")); - echo "\n*** Done ***\n"; ?> --CLEAN-- @@ -75,38 +70,21 @@ Warning: flock(): Illegal operation argument in %s on line %d bool(false) --- Iteration 4 --- -Warning: flock() expects parameter 2 to be int, array given in %s on line %d -NULL +flock() expects parameter 2 to be int, array given --- Iteration 5 --- -Warning: flock() expects parameter 2 to be int, array given in %s on line %d -NULL +flock() expects parameter 2 to be int, array given --- Iteration 6 --- -Warning: flock() expects parameter 2 to be int, string given in %s on line %d -NULL +flock() expects parameter 2 to be int, string given --- Iteration 7 --- -Warning: flock() expects parameter 2 to be int, string given in %s on line %d -NULL +flock() expects parameter 2 to be int, string given --- Iteration 8 --- -Warning: flock() expects parameter 2 to be int, string given in %s on line %d -NULL +flock() expects parameter 2 to be int, string given Warning: flock(): supplied resource is not a valid stream resource in %s on line %d bool(false) -Warning: flock() expects parameter 1 to be resource, string given in %s on line %d -NULL - -Warning: flock() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: flock() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: flock() expects at most 3 parameters, 4 given in %s on line %d -NULL - *** Done *** diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt index b3607be58b..048eb1475c 100644 --- a/ext/standard/tests/file/fnmatch_variation.phpt +++ b/ext/standard/tests/file/fnmatch_variation.phpt @@ -66,7 +66,11 @@ $pattern_arr = array( for( $i = 0; $i<count($pattern_arr); $i++ ) { echo "-- Iteration $i --\n"; - var_dump( fnmatch($pattern_arr[$i], $file_name) ); + try { + var_dump( fnmatch($pattern_arr[$i], $file_name) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } unlink($file_name); @@ -78,7 +82,11 @@ function match( $pattern, $string ) { for( $i = 0; $i<count($pattern); $i++ ) { echo "-- Iteration $i --\n"; for( $j = 0; $j<count($string); $j++ ) { - var_dump( fnmatch($pattern[$i], $string[$j]) ); + try { + var_dump( fnmatch($pattern[$i], $string[$j]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } } } @@ -134,7 +142,7 @@ match($null_arr, $null_arr); echo "\n*** Done ***\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing fnmatch() with file and various patterns *** -- Iteration 0 -- bool(true) @@ -183,13 +191,9 @@ bool(false) -- Iteration 22 -- bool(false) -- Iteration 23 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 24 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 25 -- bool(false) -- Iteration 26 -- @@ -263,84 +267,44 @@ bool(true) --- With Strings --- -- Iteration 0 -- bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) -- Iteration 1 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 2 -- bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) -- Iteration 3 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 4 -- bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) bool(false) -- Iteration 5 -- bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) @@ -441,64 +405,42 @@ bool(true) bool(true) bool(true) bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(false) -- Iteration 1 -- bool(true) bool(true) bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(false) -- Iteration 2 -- bool(true) bool(true) bool(true) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(false) -- Iteration 3 -- - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given +fnmatch() expects parameter 1 to be a valid path, string given -- Iteration 4 -- bool(false) bool(false) bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(true) bool(false) -- Iteration 5 -- bool(false) bool(false) bool(false) - -Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d -NULL +fnmatch() expects parameter 2 to be a valid path, string given bool(false) bool(true) diff --git a/ext/standard/tests/file/fread_error.phpt b/ext/standard/tests/file/fread_error.phpt index 1c4068cd97..f51f24c754 100644 --- a/ext/standard/tests/file/fread_error.phpt +++ b/ext/standard/tests/file/fread_error.phpt @@ -14,14 +14,6 @@ echo "*** Testing error conditions ***\n"; $filename = __FILE__; $file_handle = fopen($filename, "r"); -// zero argument -echo "-- Testing fread() with zero argument --\n"; -var_dump( fread() ); - -// more than expected no. of args -echo "-- Testing fread() with more than expected number of arguments --\n"; -var_dump( fread($file_handle, 10, $file_handle) ); - // invalid length argument echo "-- Testing fread() with invalid length arguments --\n"; $len = 0; @@ -29,44 +21,9 @@ var_dump( fread($file_handle, $len) ); $len = -10; var_dump( fread($file_handle, $len) ); -// test invalid arguments : non-resources -echo "-- Testing fread() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fread() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fread($invalid_args[$loop_counter - 1], 10) ); -} - -// fwrite() on a file handle which is already closed -echo "-- Testing fwrite() with closed/unset file handle --\n"; -fclose($file_handle); -var_dump( fread($file_handle,$file_content_type) ); - -// fwrite on a file handle which is unset -$fp = fopen($filename, "r"); -unset($fp); //unset file handle -var_dump( fread(@$fp,10) ); -var_dump( fclose(@$fp) ); - echo "Done\n"; --EXPECTF-- *** Testing error conditions *** --- Testing fread() with zero argument -- - -Warning: fread() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) --- Testing fread() with more than expected number of arguments -- - -Warning: fread() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) -- Testing fread() with invalid length arguments -- Warning: fread(): Length parameter must be greater than 0 in %s on line %d @@ -74,41 +31,4 @@ bool(false) Warning: fread(): Length parameter must be greater than 0 in %s on line %d bool(false) --- Testing fread() with invalid arguments -- --- Iteration 1 -- - -Warning: fread() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fread() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fread() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fread() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fread() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fread() expects parameter 1 to be resource, object given in %s on line %d -bool(false) --- Testing fwrite() with closed/unset file handle -- - -Notice: Undefined variable: file_content_type in %s on line %d - -Warning: fread(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fread() expects parameter 1 to be resource, null given in %s on line %d -bool(false) - -Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fscanf.phpt b/ext/standard/tests/file/fscanf.phpt index 6d3d0a5b96..7e40d20b48 100644 --- a/ext/standard/tests/file/fscanf.phpt +++ b/ext/standard/tests/file/fscanf.phpt @@ -5,10 +5,6 @@ fscanf() tests $filename = dirname(__FILE__)."/fscanf.dat"; -var_dump(fscanf()); -var_dump(fscanf(array())); -var_dump(fscanf(array(), array())); - file_put_contents($filename, "data"); $fp = fopen($filename, "rt"); @@ -64,14 +60,6 @@ $filename = dirname(__FILE__)."/fscanf.dat"; unlink($filename); ?> --EXPECTF-- -Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: fscanf() expects parameter 1 to be resource, array given in %s on line %d -NULL int(0) NULL int(1) diff --git a/ext/standard/tests/file/fscanf_error.phpt b/ext/standard/tests/file/fscanf_error.phpt index db2a881d6c..d5b2ba73aa 100644 --- a/ext/standard/tests/file/fscanf_error.phpt +++ b/ext/standard/tests/file/fscanf_error.phpt @@ -17,16 +17,6 @@ if ($file_handle == false) fwrite($file_handle, "hello world"); fclose($file_handle); -// zero argument -var_dump( fscanf() ); - -// single argument -$file_handle = fopen($filename, 'r'); -if ($file_handle == false) - exit("Error:failed to open file $filename"); -var_dump( fscanf($file_handle) ); -fclose($file_handle); - // invalid file handle var_dump( fscanf($file_handle, "%s") ); @@ -38,7 +28,7 @@ var_dump( fscanf($file_handle, "%d%s%f", $int_var, $string_var) ); fclose($file_handle); // different invalid format strings -$invalid_formats = array( $undefined_var, undefined_constant, +$invalid_formats = array( $undefined_var, "%", "%h", "%.", "%d%m" ); @@ -63,12 +53,6 @@ unlink($filename); --EXPECTF-- *** Testing fscanf() for error conditions *** -Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d -NULL - Warning: fscanf(): supplied resource is not a valid File-Handle resource in %s on line %d bool(false) @@ -76,10 +60,6 @@ Warning: fscanf(): Different numbers of variable names and field specifiers in % int(-1) Notice: Undefined variable: undefined_var in %s on line %d - -Warning: Use of undefined constant undefined_constant - assumed 'undefined_constant' (this will throw an Error in a future version of PHP) in %s on line %d -array(0) { -} array(0) { } diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt index 9c1b3a822d..c39b3bcbe5 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt @@ -14,86 +14,18 @@ Test fseek(), ftell() & rewind() functions : error conditions - fseek() */ echo "*** Testing fseek() : error conditions ***\n"; -// zero argument -echo "-- Testing fseek() with zero argument --\n"; -var_dump( fseek() ); - -// unexpected no. of args -echo "-- Testing fseek() with unexpected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( fseek($fp) ); -var_dump( fseek($fp, 10, $fp,10) ); - -// test invalid arguments : non-resources -echo "-- Testing fseek() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass -); -/* loop to test fseek() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fseek($invalid_args[$loop_counter - 1], 10) ); -} // fseek() on a file handle which is already closed echo "-- Testing fseek() with closed/unset file handle --"; +$fp = fopen(__FILE__, "r"); fclose($fp); var_dump(fseek($fp,10)); -// fseek() on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( fseek(@$file_handle,10)); - echo "Done\n"; ?> --EXPECTF-- *** Testing fseek() : error conditions *** --- Testing fseek() with zero argument -- - -Warning: fseek() expects at least 2 parameters, 0 given in %s on line %d -bool(false) --- Testing fseek() with unexpected number of arguments -- - -Warning: fseek() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: fseek() expects at most 3 parameters, 4 given in %s on line %d -bool(false) --- Testing fseek() with invalid arguments -- --- Iteration 1 -- - -Warning: fseek() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fseek() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fseek() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fseek() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fseek() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fseek() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing fseek() with closed/unset file handle -- Warning: fseek(): supplied resource is not a valid stream resource in %s on line %d bool(false) - -Warning: fseek() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt index 8835046f6c..87f70b8717 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt @@ -14,82 +14,18 @@ Test fseek(), ftell() & rewind() functions : error conditions - ftell() */ echo "*** Testing ftell() : error conditions ***\n"; -// zero argument -echo "-- Testing ftell() with zero argument --\n"; -var_dump( ftell() ); - -// more than expected no. of args -echo "-- Testing ftell() with more than expected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( ftell($fp, 10) ); - -// test invalid arguments : non-resources -echo "-- Testing ftell() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test ftell with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( ftell($invalid_args[$loop_counter - 1]) ); -} // ftell on a file handle which is already closed echo "-- Testing ftell with closed/unset file handle --"; +$fp = fopen(__FILE__, "r"); fclose($fp); var_dump(ftell($fp)); -// ftell on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( ftell(@$file_handle) ); - echo "Done\n"; ?> --EXPECTF-- *** Testing ftell() : error conditions *** --- Testing ftell() with zero argument -- - -Warning: ftell() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) --- Testing ftell() with more than expected number of arguments -- - -Warning: ftell() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) --- Testing ftell() with invalid arguments -- --- Iteration 1 -- - -Warning: ftell() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: ftell() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: ftell() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: ftell() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: ftell() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: ftell() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing ftell with closed/unset file handle -- Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d bool(false) - -Warning: ftell() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt index 0b94bcffc7..edbb9e22f2 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt @@ -14,82 +14,18 @@ Test fseek(), ftell() & rewind() functions : error conditions - rewind() */ echo "*** Testing rewind() : error conditions ***\n"; -// zero argument -echo "-- Testing rewind() with zero argument --\n"; -var_dump( rewind() ); - -// more than expected no. of args -echo "-- Testing rewind() with more than expected number of arguments --\n"; -$fp = fopen(__FILE__, "r"); -var_dump( rewind($fp, 10) ); - -// test invalid arguments : non-resources -echo "-- Testing rewind() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test rewind with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( rewind($invalid_args[$loop_counter - 1]) ); -} // rewind on a file handle which is already closed echo "-- Testing rewind() with closed/unset file handle --"; +$fp = fopen(__FILE__, "r"); fclose($fp); var_dump(rewind($fp)); -// rewind on a file handle which is unset -$file_handle = fopen(__FILE__, "r"); -unset($file_handle); //unset file handle -var_dump( rewind(@$file_handle) ); - echo "Done\n"; ?> --EXPECTF-- *** Testing rewind() : error conditions *** --- Testing rewind() with zero argument -- - -Warning: rewind() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) --- Testing rewind() with more than expected number of arguments -- - -Warning: rewind() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) --- Testing rewind() with invalid arguments -- --- Iteration 1 -- - -Warning: rewind() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: rewind() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: rewind() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: rewind() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: rewind() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: rewind() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing rewind() with closed/unset file handle -- Warning: rewind(): supplied resource is not a valid stream resource in %s on line %d bool(false) - -Warning: rewind() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/ftruncate_error.phpt b/ext/standard/tests/file/ftruncate_error.phpt index 3cb6db27f8..ecbdeddf06 100644 --- a/ext/standard/tests/file/ftruncate_error.phpt +++ b/ext/standard/tests/file/ftruncate_error.phpt @@ -15,38 +15,6 @@ fwrite($file_handle, "Testing ftruncate error conditions \n"); fflush($file_handle); echo "\n Initial file size = ".filesize($filename)."\n"; -echo "-- Testing ftruncate() with less than expected number of arguments --\n"; - -// zero arguments -var_dump( ftruncate() ); - -// arguments less than expected numbers -var_dump( ftruncate( $file_handle ) ); -// check the first size -var_dump( filesize($filename) ); - -echo "-- Testing ftruncate() with more than expected number of arguments --\n"; -// more than expected number of arguments -var_dump( ftruncate($file_handle, 10, 20) ); -// check the first size -var_dump( filesize($filename) ); - -// test invalid arguments : non-resources -echo "-- Testing ftruncate() with invalid file pointer --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test ftruncate() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( ftruncate($invalid_args[$loop_counter - 1], 10) ); -} - // ftruncate() on a file handle which is already closed/unset echo "-- Testing ftruncate() with closed/unset file handle --\n"; @@ -56,13 +24,6 @@ var_dump( ftruncate($file_handle,10) ); // check the first size var_dump( filesize($filename) ); -// ftruncate on a file handle which is unset -$fp = fopen($filename, "w"); -unset($fp); //unset file handle -var_dump( ftruncate(@$fp,10)); -// check the first size -var_dump( filesize($filename) ); - echo "Done\n"; ?> --CLEAN-- @@ -74,51 +35,9 @@ unlink( $filename ); *** Testing ftruncate() : error conditions *** Initial file size = 36 --- Testing ftruncate() with less than expected number of arguments -- - -Warning: ftruncate() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: ftruncate() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) -int(36) --- Testing ftruncate() with more than expected number of arguments -- - -Warning: ftruncate() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) -int(36) --- Testing ftruncate() with invalid file pointer -- --- Iteration 1 -- - -Warning: ftruncate() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: ftruncate() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: ftruncate() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: ftruncate() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: ftruncate() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: ftruncate() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing ftruncate() with closed/unset file handle -- Warning: ftruncate(): supplied resource is not a valid stream resource in %s on line %d bool(false) int(36) - -Warning: ftruncate() expects parameter 1 to be resource, null given in %s on line %d -bool(false) -int(36) Done diff --git a/ext/standard/tests/file/fwrite.phpt b/ext/standard/tests/file/fwrite.phpt index 443710b99d..195d3afe77 100644 --- a/ext/standard/tests/file/fwrite.phpt +++ b/ext/standard/tests/file/fwrite.phpt @@ -6,8 +6,7 @@ fwrite() tests $filename = dirname(__FILE__)."/fwrite.dat"; $fp = fopen($filename, "w"); -var_dump(fwrite($fp)); -var_dump(fwrite($fp, array())); +var_dump(fwrite($fp, "")); fclose($fp); $fp = fopen($filename, "r"); @@ -20,33 +19,16 @@ fclose($fp); var_dump(fwrite($fp, "data", -1)); -var_dump(fwrite(array(), "data", -1)); -var_dump(fwrite(array(), "data")); -var_dump(fwrite(array())); - var_dump(file_get_contents($filename)); @unlink($filename); echo "Done\n"; ?> --EXPECTF-- -Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: fwrite() expects parameter 2 to be string, array given in %s on line %d -bool(false) +int(0) int(0) int(0) int(4) int(0) - -Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d -bool(false) - -Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d -bool(false) string(4) "data" Done diff --git a/ext/standard/tests/file/fwrite_error.phpt b/ext/standard/tests/file/fwrite_error.phpt index f4f691be35..a52d2dd003 100644 --- a/ext/standard/tests/file/fwrite_error.phpt +++ b/ext/standard/tests/file/fwrite_error.phpt @@ -16,18 +16,8 @@ include ("file.inc"); echo "*** Testing fwrite() : error conditions ***\n"; $filename = dirname(__FILE__)."/fwrite_error.tmp"; - -echo "-- Testing fwrite() with less than expected number of arguments --\n"; -// zero argument -var_dump( fwrite() ); -// less than expected, 1 arg $file_handle = fopen ( $filename, "w"); -var_dump( fwrite($file_handle) ); - -// more than expected no. of args -echo "-- Testing fwrite() with more than expected number of arguments --\n"; $data = "data"; -var_dump( fwrite($file_handle, $data, strlen($data), 10) ); // invalid length argument echo "-- Testing fwrite() with invalid length arguments --\n"; @@ -36,32 +26,11 @@ var_dump( fwrite($file_handle, $data, $len) ); $len = -10; var_dump( fwrite($file_handle, $data, $len) ); -// test invalid arguments : non-resources -echo "-- Testing fwrite() with invalid arguments --\n"; -$invalid_args = array ( - "string", - 10, - 10.5, - true, - array(1,2,3), - new stdclass, -); -/* loop to test fwrite() with different invalid type of args */ -for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) { - echo "-- Iteration $loop_counter --\n"; - var_dump( fwrite($invalid_args[$loop_counter - 1], 10) ); -} - // fwrite() on a file handle which is already closed echo "-- Testing fwrite() with closed/unset file handle --\n"; fclose($file_handle); var_dump(fwrite($file_handle,"data")); -// fwrite on a file handle which is unset -$fp = fopen($filename, "w"); -unset($fp); //unset file handle -var_dump( fwrite(@$fp,"data")); - echo "Done\n"; ?> --CLEAN-- @@ -71,50 +40,11 @@ unlink( $filename ); ?> --EXPECTF-- *** Testing fwrite() : error conditions *** --- Testing fwrite() with less than expected number of arguments -- - -Warning: fwrite() expects at least 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d -bool(false) --- Testing fwrite() with more than expected number of arguments -- - -Warning: fwrite() expects at most 3 parameters, 4 given in %s on line %d -bool(false) -- Testing fwrite() with invalid length arguments -- int(0) int(0) --- Testing fwrite() with invalid arguments -- --- Iteration 1 -- - -Warning: fwrite() expects parameter 1 to be resource, string given in %s on line %d -bool(false) --- Iteration 2 -- - -Warning: fwrite() expects parameter 1 to be resource, int given in %s on line %d -bool(false) --- Iteration 3 -- - -Warning: fwrite() expects parameter 1 to be resource, float given in %s on line %d -bool(false) --- Iteration 4 -- - -Warning: fwrite() expects parameter 1 to be resource, bool given in %s on line %d -bool(false) --- Iteration 5 -- - -Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d -bool(false) --- Iteration 6 -- - -Warning: fwrite() expects parameter 1 to be resource, object given in %s on line %d -bool(false) -- Testing fwrite() with closed/unset file handle -- Warning: fwrite(): supplied resource is not a valid stream resource in %s on line %d bool(false) - -Warning: fwrite() expects parameter 1 to be resource, null given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/file/get_current_user.phpt b/ext/standard/tests/file/get_current_user.phpt index f23d2fabef..04938e3d6b 100644 --- a/ext/standard/tests/file/get_current_user.phpt +++ b/ext/standard/tests/file/get_current_user.phpt @@ -3,13 +3,10 @@ get_current_user() tests --FILE-- <?php -var_dump(get_current_user("blah")); var_dump(get_current_user()); echo "Done\n"; ?> --EXPECTF-- -Warning: get_current_user() expects exactly 0 parameters, 1 given in %s on line %d -NULL string(%d) %s Done diff --git a/ext/standard/tests/file/glob_variation-win32-mb.phpt b/ext/standard/tests/file/glob_variation-win32-mb.phpt index cba2e2b343..8d1ae00c34 100644 --- a/ext/standard/tests/file/glob_variation-win32-mb.phpt +++ b/ext/standard/tests/file/glob_variation-win32-mb.phpt @@ -46,12 +46,16 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "\n-- Iteration $counter --\n"; - var_dump( glob($pattern) ); // default arguments - var_dump( glob($pattern, GLOB_MARK) ); - var_dump( glob($pattern, GLOB_NOSORT) ); - var_dump( glob($pattern, GLOB_NOCHECK) ); - var_dump( glob($pattern, GLOB_NOESCAPE) ); - var_dump( glob($pattern, GLOB_ERR) ); + try { + var_dump( glob($pattern) ); // default arguments + var_dump( glob($pattern, GLOB_MARK) ); + var_dump( glob($pattern, GLOB_NOSORT) ); + var_dump( glob($pattern, GLOB_NOCHECK) ); + var_dump( glob($pattern, GLOB_NOESCAPE) ); + var_dump( glob($pattern, GLOB_ERR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -73,7 +77,11 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; - var_dump( glob($pattern, GLOB_ONLYDIR) ); + try { + var_dump( glob($pattern, GLOB_ONLYDIR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -326,24 +334,7 @@ array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { @@ -446,9 +437,7 @@ array(1) { array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %sglob_variation-win32-mb.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/glob_variation-win32.phpt b/ext/standard/tests/file/glob_variation-win32.phpt index 5027ac03e6..2706377d8c 100644 --- a/ext/standard/tests/file/glob_variation-win32.phpt +++ b/ext/standard/tests/file/glob_variation-win32.phpt @@ -45,12 +45,16 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "\n-- Iteration $counter --\n"; - var_dump( glob($pattern) ); // default arguments - var_dump( glob($pattern, GLOB_MARK) ); - var_dump( glob($pattern, GLOB_NOSORT) ); - var_dump( glob($pattern, GLOB_NOCHECK) ); - var_dump( glob($pattern, GLOB_NOESCAPE) ); - var_dump( glob($pattern, GLOB_ERR) ); + try { + var_dump( glob($pattern) ); // default arguments + var_dump( glob($pattern, GLOB_MARK) ); + var_dump( glob($pattern, GLOB_NOSORT) ); + var_dump( glob($pattern, GLOB_NOCHECK) ); + var_dump( glob($pattern, GLOB_NOESCAPE) ); + var_dump( glob($pattern, GLOB_ERR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -72,7 +76,11 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; - var_dump( glob($pattern, GLOB_ONLYDIR) ); + try { + var_dump( glob($pattern, GLOB_ONLYDIR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -325,24 +333,7 @@ array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { @@ -445,9 +436,7 @@ array(1) { array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %sglob_variation-win32.php on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/glob_variation.phpt b/ext/standard/tests/file/glob_variation.phpt index 9d3b879379..3c20a49b31 100644 --- a/ext/standard/tests/file/glob_variation.phpt +++ b/ext/standard/tests/file/glob_variation.phpt @@ -48,12 +48,16 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "\n-- Iteration $counter --\n"; - var_dump( glob($pattern) ); // default arguments - var_dump( glob($pattern, GLOB_MARK) ); - var_dump( glob($pattern, GLOB_NOSORT) ); - var_dump( glob($pattern, GLOB_NOCHECK) ); - var_dump( glob($pattern, GLOB_NOESCAPE) ); - var_dump( glob($pattern, GLOB_ERR) ); + try { + var_dump( glob($pattern) ); // default arguments + var_dump( glob($pattern, GLOB_MARK) ); + var_dump( glob($pattern, GLOB_NOSORT) ); + var_dump( glob($pattern, GLOB_NOCHECK) ); + var_dump( glob($pattern, GLOB_NOESCAPE) ); + var_dump( glob($pattern, GLOB_ERR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -75,7 +79,11 @@ $counter = 1; using glob() */ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; - var_dump( glob($pattern, GLOB_ONLYDIR) ); + try { + var_dump( glob($pattern, GLOB_ONLYDIR) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; } @@ -328,24 +336,7 @@ array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { @@ -448,9 +439,7 @@ array(1) { array(0) { } -- Iteration 8 -- - -Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +glob() expects parameter 1 to be a valid path, string given -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/is_dir_variation3.phpt b/ext/standard/tests/file/is_dir_variation3.phpt index c1664165eb..060739ff3d 100644 --- a/ext/standard/tests/file/is_dir_variation3.phpt +++ b/ext/standard/tests/file/is_dir_variation3.phpt @@ -9,8 +9,6 @@ Test is_dir() function: usage variations - invalid arguments /* Passing invalid arguments to is_dir() */ -$dir_handle = opendir( dirname(__FILE__) ); - echo "*** Testing is_dir() with Invalid arguments: expected bool(false) ***\n"; $dirnames = array( /* Invalid dirnames */ @@ -19,7 +17,6 @@ $dirnames = array( FALSE, NULL, " ", - $dir_handle, /* scalars */ 0, @@ -30,7 +27,6 @@ $dirnames = array( foreach($dirnames as $dirname) { var_dump( is_dir($dirname) ); } -closedir($dir_handle); echo "\n*** Done ***"; ?> @@ -41,9 +37,6 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_dir() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL bool(false) bool(false) diff --git a/ext/standard/tests/file/is_dir_variation4.phpt b/ext/standard/tests/file/is_dir_variation4.phpt index 5c0be485c5..3c3d0852ef 100644 --- a/ext/standard/tests/file/is_dir_variation4.phpt +++ b/ext/standard/tests/file/is_dir_variation4.phpt @@ -38,7 +38,11 @@ $count = 1; /* loop through to test each element the above array */ foreach($dirs_arr as $dir) { echo "\n-- Iteration $count --\n"; - var_dump( is_dir($file_path."/".$dir ) ); + try { + var_dump( is_dir($file_path."/".$dir ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count++; } @@ -77,13 +81,9 @@ bool(true) bool(false) -- Iteration 9 -- - -Warning: is_dir() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_dir() expects parameter 1 to be a valid path, string given -- Iteration 10 -- - -Warning: is_dir() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_dir() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/is_executable_error.phpt b/ext/standard/tests/file/is_executable_error.phpt index 4fb3dbaf5f..e4b43095e3 100644 --- a/ext/standard/tests/file/is_executable_error.phpt +++ b/ext/standard/tests/file/is_executable_error.phpt @@ -6,24 +6,11 @@ Test is_executable() function: error conditions Description: Tells whether the filename is executable */ -echo "*** Testing is_executable(): error conditions ***\n"; -var_dump( is_executable() ); // args < expected no of arguments - -var_dump( is_executable(1, 2) ); // args > expected no. of arguments - echo "\n*** Testing is_exceutable() on non-existent directory ***\n"; var_dump( is_executable(dirname(__FILE__)."/is_executable") ); echo "Done\n"; --EXPECTF-- -*** Testing is_executable(): error conditions *** - -Warning: is_executable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_executable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing is_exceutable() on non-existent directory *** bool(false) Done diff --git a/ext/standard/tests/file/is_executable_variation1.phpt b/ext/standard/tests/file/is_executable_variation1.phpt index 1cd0a8d209..784685705b 100644 --- a/ext/standard/tests/file/is_executable_variation1.phpt +++ b/ext/standard/tests/file/is_executable_variation1.phpt @@ -51,7 +51,11 @@ $counter = 1; is an executable file */ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; - var_dump( is_executable($file) ); + try { + var_dump( is_executable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; clearstatcache(); } @@ -76,13 +80,9 @@ bool(false) -- Iteration 5 -- bool(false) -- Iteration 6 -- - -Warning: is_executable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_executable() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: is_executable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_executable() expects parameter 1 to be a valid path, string given -- Iteration 8 -- bool(false) -- Iteration 9 -- diff --git a/ext/standard/tests/file/is_executable_variation3.phpt b/ext/standard/tests/file/is_executable_variation3.phpt index a804f66eb2..637bbacd67 100644 --- a/ext/standard/tests/file/is_executable_variation3.phpt +++ b/ext/standard/tests/file/is_executable_variation3.phpt @@ -38,7 +38,6 @@ $invalid_files = array( FALSE, NULL, " ", - @array(), @$file_handle ); /* loop through to test each element in the above array @@ -61,8 +60,5 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_executable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL bool(false) Done diff --git a/ext/standard/tests/file/is_file_variation3.phpt b/ext/standard/tests/file/is_file_variation3.phpt index ec70371417..1b94594faa 100644 --- a/ext/standard/tests/file/is_file_variation3.phpt +++ b/ext/standard/tests/file/is_file_variation3.phpt @@ -21,7 +21,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -50,9 +49,6 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_file() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL bool(false) bool(false) diff --git a/ext/standard/tests/file/is_file_variation4.phpt b/ext/standard/tests/file/is_file_variation4.phpt index 505331d2c9..689ae1098f 100644 --- a/ext/standard/tests/file/is_file_variation4.phpt +++ b/ext/standard/tests/file/is_file_variation4.phpt @@ -38,7 +38,11 @@ $count = 1; /* loop through to test each element in the above array */ foreach($files_arr as $file) { echo "- Iteration $count -\n"; - var_dump( is_file( $file_path."/".$file ) ); + try { + var_dump( is_file( $file_path."/".$file ) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } clearstatcache(); $count++; } @@ -67,12 +71,8 @@ bool(false) - Iteration 6 - bool(false) - Iteration 7 - - -Warning: is_file() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_file() expects parameter 1 to be a valid path, string given - Iteration 8 - - -Warning: is_file() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_file() expects parameter 1 to be a valid path, string given *** Done *** diff --git a/ext/standard/tests/file/is_readable_error.phpt b/ext/standard/tests/file/is_readable_error.phpt index 9a734cd14d..8a4b507b6f 100644 --- a/ext/standard/tests/file/is_readable_error.phpt +++ b/ext/standard/tests/file/is_readable_error.phpt @@ -6,24 +6,12 @@ Test is_readable() function: error conditions Description: Tells whether the filename is readable */ -echo "*** Testing is_readable(): error conditions ***\n"; -var_dump( is_readable() ); // args < expected -var_dump( is_readable(1, 2) ); // args > expected - echo "\n*** Testing is_readable() on non-existent file ***\n"; var_dump( is_readable(dirname(__FILE__)."/is_readable.tmp") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing is_readable(): error conditions *** - -Warning: is_readable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_readable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing is_readable() on non-existent file *** bool(false) Done diff --git a/ext/standard/tests/file/is_readable_variation1.phpt b/ext/standard/tests/file/is_readable_variation1.phpt index 0ba2324f9a..b6570fb911 100644 --- a/ext/standard/tests/file/is_readable_variation1.phpt +++ b/ext/standard/tests/file/is_readable_variation1.phpt @@ -60,7 +60,11 @@ $counter = 1; is a writable file */ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; - var_dump( is_readable($file) ); + try { + var_dump( is_readable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; clearstatcache(); } @@ -87,17 +91,11 @@ bool(false) -- Iteration 6 -- bool(false) -- Iteration 7 -- - -Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_readable() expects parameter 1 to be a valid path, string given -- Iteration 8 -- - -Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_readable() expects parameter 1 to be a valid path, string given -- Iteration 9 -- - -Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_readable() expects parameter 1 to be a valid path, string given -- Iteration 10 -- bool(true) -- Iteration 11 -- diff --git a/ext/standard/tests/file/is_readable_variation3.phpt b/ext/standard/tests/file/is_readable_variation3.phpt index 74fc7af574..48b4e30386 100644 --- a/ext/standard/tests/file/is_readable_variation3.phpt +++ b/ext/standard/tests/file/is_readable_variation3.phpt @@ -37,7 +37,6 @@ $misc_files = array( FALSE, NULL, " ", - @array(), @$file_handle ); /* loop through to test each element in the above array @@ -60,8 +59,5 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_readable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL bool(false) Done diff --git a/ext/standard/tests/file/is_uploaded_file_basic.phpt b/ext/standard/tests/file/is_uploaded_file_basic.phpt index 1721935549..d053244a79 100644 --- a/ext/standard/tests/file/is_uploaded_file_basic.phpt +++ b/ext/standard/tests/file/is_uploaded_file_basic.phpt @@ -29,19 +29,9 @@ var_dump(is_uploaded_file('random_filename.txt')); // not an uploaded file var_dump(is_uploaded_file('__FILE__')); -// Error cases -var_dump(is_uploaded_file()); -var_dump(is_uploaded_file('a', 'b')); - ?> --EXPECTF-- bool(true) bool(false) bool(false) bool(false) - -Warning: is_uploaded_file() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_uploaded_file() expects exactly 1 parameter, 2 given in %s on line %d -NULL diff --git a/ext/standard/tests/file/is_writable_error.phpt b/ext/standard/tests/file/is_writable_error.phpt index e3755bc748..e1641e0e9f 100644 --- a/ext/standard/tests/file/is_writable_error.phpt +++ b/ext/standard/tests/file/is_writable_error.phpt @@ -8,14 +8,6 @@ Test is_writable() and its alias is_writeable() function: error conditions is_writeable() is an alias of is_writable() */ -echo "*** Testing is_writable(): error conditions ***\n"; -var_dump( is_writable() ); // args < expected -var_dump( is_writeable() ); - -echo "\n*** Testing is_writeable(): error conditions ***\n"; -var_dump( is_writable(1, 2) ); // args > expected -var_dump( is_writeable(1, 2) ); - echo "\n*** Testing is_writable() on non-existent file ***\n"; var_dump( is_writable(dirname(__FILE__)."/is_writable") ); var_dump( is_writeable(dirname(__FILE__)."/is_writable") ); @@ -23,22 +15,6 @@ var_dump( is_writeable(dirname(__FILE__)."/is_writable") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing is_writable(): error conditions *** - -Warning: is_writable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_writeable() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -*** Testing is_writeable(): error conditions *** - -Warning: is_writable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: is_writeable() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing is_writable() on non-existent file *** bool(false) bool(false) diff --git a/ext/standard/tests/file/is_writable_variation1.phpt b/ext/standard/tests/file/is_writable_variation1.phpt index f5cdf6a8a0..ec9756fbf1 100644 --- a/ext/standard/tests/file/is_writable_variation1.phpt +++ b/ext/standard/tests/file/is_writable_variation1.phpt @@ -62,8 +62,16 @@ $counter = 1; is a writable file */ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; - var_dump( is_writable($file) ); - var_dump( is_writeable($file) ); + try { + var_dump( is_writable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( is_writeable($file) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter++; clearstatcache(); } @@ -96,26 +104,14 @@ bool(false) bool(false) bool(false) -- Iteration 7 -- - -Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_writable() expects parameter 1 to be a valid path, string given +is_writeable() expects parameter 1 to be a valid path, string given -- Iteration 8 -- - -Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_writable() expects parameter 1 to be a valid path, string given +is_writeable() expects parameter 1 to be a valid path, string given -- Iteration 9 -- - -Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d -NULL +is_writable() expects parameter 1 to be a valid path, string given +is_writeable() expects parameter 1 to be a valid path, string given -- Iteration 10 -- bool(true) bool(true) diff --git a/ext/standard/tests/file/is_writable_variation3.phpt b/ext/standard/tests/file/is_writable_variation3.phpt index 3cc7a4da9d..d533a2745d 100644 --- a/ext/standard/tests/file/is_writable_variation3.phpt +++ b/ext/standard/tests/file/is_writable_variation3.phpt @@ -35,7 +35,6 @@ $misc_files = array( FALSE, NULL, " ", - @array(), @$file_handle ); /* loop through to test each element in the above array @@ -66,12 +65,6 @@ bool(false) bool(false) bool(false) bool(false) - -Warning: is_writable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL - -Warning: is_writeable() expects parameter 1 to be a valid path, array given in %s on line %d -NULL bool(false) bool(false) Done diff --git a/ext/standard/tests/file/lchown_error.phpt b/ext/standard/tests/file/lchown_error.phpt index f4b4f5089e..18e0407fdc 100644 --- a/ext/standard/tests/file/lchown_error.phpt +++ b/ext/standard/tests/file/lchown_error.phpt @@ -29,20 +29,9 @@ $filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lchown.txt'; touch( $filename ); $uid = posix_getuid(); - -// Less than expected arguments -var_dump( lchown( $filename ) ); - -// More than expected arguments -var_dump( lchown( $filename, $uid, 'foobar' ) ); - // Non-existent filename var_dump( lchown( 'foobar_lchown.txt', $uid ) ); -// Wrong argument types -var_dump( lchown( new StdClass(), $uid ) ); -var_dump( lchown( array(), $uid ) ); - // Bad user var_dump( lchown( $filename, -5 ) ); @@ -58,21 +47,9 @@ unlink($filename); --EXPECTF-- *** Testing lchown() : error functionality *** -Warning: lchown() expects exactly 2 parameters, 1 given in %s on line %d -bool(true) - -Warning: lchown() expects exactly 2 parameters, 3 given in %s on line %d -bool(true) - Warning: lchown(): No such file or directory in %s on line %d bool(false) -Warning: lchown() expects parameter 1 to be a valid path, object given in %s on line %d -bool(true) - -Warning: lchown() expects parameter 1 to be a valid path, array given in %s on line %d -bool(true) - Warning: lchown(): %r(Operation not permitted|Invalid argument)%r in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/file/lstat_stat_error.phpt b/ext/standard/tests/file/lstat_stat_error.phpt index 8f290a32e3..e6fccd5acc 100644 --- a/ext/standard/tests/file/lstat_stat_error.phpt +++ b/ext/standard/tests/file/lstat_stat_error.phpt @@ -17,54 +17,28 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { echo "*** Testing lstat() for error conditions ***\n"; $file_path = dirname(__FILE__); -var_dump( lstat() ); // args < expected -var_dump( lstat(__FILE__, 2) ); // args > expected var_dump( lstat("$file_path/temp.tmp") ); // non existing file var_dump( lstat(22) ); // scalar argument -$arr = array(__FILE__); -var_dump( lstat($arr) ); // array argument echo "\n*** Testing stat() for error conditions ***\n"; -var_dump( stat() ); // args < expected -var_dump( stat(__FILE__, 2) ); // file, args > expected -var_dump( stat(dirname(__FILE__), 2) ); //dir, args > expected var_dump( stat("$file_path/temp.tmp") ); // non existing file var_dump( stat("$file_path/temp/") ); // non existing dir var_dump( stat(22) ); // scalar argument -var_dump( stat($arr) ); // array argument echo "Done\n"; ?> --EXPECTF-- *** Testing lstat() for error conditions *** -Warning: lstat() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: lstat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: lstat(): Lstat failed for %s in %s on line %d bool(false) Warning: lstat(): Lstat failed for 22 in %s on line %d bool(false) -Warning: lstat() expects parameter 1 to be a valid path, array given in %s on line %d -NULL - *** Testing stat() for error conditions *** -Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: stat(): stat failed for %s in %s on line %d bool(false) @@ -73,7 +47,4 @@ bool(false) Warning: stat(): stat failed for 22 in %s on line %d bool(false) - -Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d -NULL Done diff --git a/ext/standard/tests/file/mkdir_rmdir_error.phpt b/ext/standard/tests/file/mkdir_rmdir_error.phpt index 17f908c3f6..be0b434c2c 100644 --- a/ext/standard/tests/file/mkdir_rmdir_error.phpt +++ b/ext/standard/tests/file/mkdir_rmdir_error.phpt @@ -9,48 +9,12 @@ Test mkdir() and rmdir() functions : error conditions Description: Removes directory */ -echo "*** Testing mkdir(): error conditions ***\n"; -var_dump( mkdir() ); // args < expected -var_dump( mkdir(1, 2, 3, 4, 5) ); // args > expected -var_dump( mkdir("testdir", 0777, false, $context, "test") ); // args > expected - -echo "\n*** Testing rmdir(): error conditions ***\n"; -var_dump( rmdir() ); // args < expected -var_dump( rmdir(1, 2, 3) ); // args > expected -var_dump( rmdir("testdir", $context, "test") ); // args > expected - echo "\n*** Testing rmdir() on non-existent directory ***\n"; var_dump( rmdir("temp") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing mkdir(): error conditions *** - -Warning: mkdir() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d -bool(false) - -Notice: Undefined variable: context in %s on line %d - -Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d -bool(false) - -*** Testing rmdir(): error conditions *** - -Warning: rmdir() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - -Notice: Undefined variable: context in %s on line %d - -Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - *** Testing rmdir() on non-existent directory *** Warning: rmdir(temp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt index 24dfc96ac9..0af1055178 100644 --- a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt +++ b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt @@ -35,8 +35,16 @@ var_dump( mkdir("$file_path/mkdir_variation2/test/", 0777, true) ); var_dump( rmdir("$file_path/mkdir_variation2/") ); echo "\n*** Testing mkdir() and rmdir() for binary safe functionality ***\n"; -var_dump( mkdir("$file_path/temp".chr(0)."/") ); -var_dump( rmdir("$file_path/temp".chr(0)."/") ); +try { + var_dump( mkdir("$file_path/temp".chr(0)."/") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( rmdir("$file_path/temp".chr(0)."/") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n*** Testing mkdir() with miscelleneous input ***\n"; /* changing mode of mkdir to prevent creating sub-directory under it */ @@ -64,12 +72,8 @@ Warning: rmdir(%s/mkdir_variation2/): %s on line %d bool(false) *** Testing mkdir() and rmdir() for binary safe functionality *** - -Warning: mkdir() expects parameter 1 to be a valid path, string given in %s on line %d -bool(false) - -Warning: rmdir() expects parameter 1 to be a valid path, string given in %s on line %d -bool(false) +mkdir() expects parameter 1 to be a valid path, string given +rmdir() expects parameter 1 to be a valid path, string given *** Testing mkdir() with miscelleneous input *** bool(true) diff --git a/ext/standard/tests/file/move_uploaded_file_basic.phpt b/ext/standard/tests/file/move_uploaded_file_basic.phpt index c6cfdd3203..7af8748fe2 100644 --- a/ext/standard/tests/file/move_uploaded_file_basic.phpt +++ b/ext/standard/tests/file/move_uploaded_file_basic.phpt @@ -49,11 +49,6 @@ fclose($fd); var_dump(move_uploaded_file($_FILES['file2']['tmp_name'], $destination4)); unlink($destination4); -echo "Wrong parameters\n"; -var_dump(move_uploaded_file()); -var_dump(move_uploaded_file(1, 2, 3)); - - ?> --EXPECTF-- Valid move @@ -66,10 +61,3 @@ Non-uploaded source file bool(false) Valid move to existing file bool(true) -Wrong parameters - -Warning: move_uploaded_file() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: move_uploaded_file() expects exactly 2 parameters, 3 given in %s on line %d -NULL diff --git a/ext/standard/tests/file/parse_ini_file_error.phpt b/ext/standard/tests/file/parse_ini_file_error.phpt index 29e022fb13..5c812d7b9a 100644 --- a/ext/standard/tests/file/parse_ini_file_error.phpt +++ b/ext/standard/tests/file/parse_ini_file_error.phpt @@ -10,10 +10,6 @@ Test parse_ini_file() function : error conditions echo "*** Testing parse_ini_file() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing parse_ini_file() function with Zero arguments --\n"; -var_dump( parse_ini_file() ); - //Test parse_ini_file with one more than the expected number of arguments echo "\n-- Testing parse_ini_file() function with more than expected no. of arguments --\n"; $filename = 'string_val'; @@ -30,11 +26,6 @@ echo "Done"; --EXPECTF-- *** Testing parse_ini_file() : error conditions *** --- Testing parse_ini_file() function with Zero arguments -- - -Warning: parse_ini_file() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -- Testing parse_ini_file() function with more than expected no. of arguments -- Warning: parse_ini_file(%s): failed to open stream: No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/parse_ini_file_variation3.phpt b/ext/standard/tests/file/parse_ini_file_variation3.phpt index 96d44433f7..acdb4d83eb 100644 --- a/ext/standard/tests/file/parse_ini_file_variation3.phpt +++ b/ext/standard/tests/file/parse_ini_file_variation3.phpt @@ -43,7 +43,6 @@ log_errors_max_len = 1024 ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On -track_errors = Off docref_root = "/phpmanual/" docref_ext = .html @@ -77,7 +76,7 @@ foreach($newdirs as $newdir) { --EXPECTF-- *** Testing parse_ini_file() : variation *** New include path is : %sparse_ini_file_variation3.dir1%sparse_ini_file_variation3.dir2%sparse_ini_file_variation3.dir3%S -array(11) { +array(10) { ["error_reporting"]=> string(5) "32767" ["display_errors"]=> @@ -94,8 +93,6 @@ array(11) { string(0) "" ["report_memleaks"]=> string(1) "1" - ["track_errors"]=> - string(0) "" ["docref_root"]=> string(11) "/phpmanual/" ["docref_ext"]=> diff --git a/ext/standard/tests/file/pathinfo_variaton.phpt b/ext/standard/tests/file/pathinfo_variaton.phpt index 421f378e01..6f4492e375 100644 --- a/ext/standard/tests/file/pathinfo_variaton.phpt +++ b/ext/standard/tests/file/pathinfo_variaton.phpt @@ -43,9 +43,6 @@ $paths = array ( "./array(1, 2)", "array( array(), null)", - /* pathname as object */ - $obj, - /* pathname as spaces */ " ", ' ', @@ -199,22 +196,6 @@ string(21) "array( array(), null)" string(0) "" string(21) "array( array(), null)" -- Iteration 9 -- - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d -NULL --- Iteration 10 -- array(3) { ["dirname"]=> string(1) "." @@ -227,7 +208,7 @@ string(1) "." string(1) " " string(0) "" string(1) " " --- Iteration 11 -- +-- Iteration 10 -- array(3) { ["dirname"]=> string(1) "." @@ -240,7 +221,7 @@ string(1) "." string(1) " " string(0) "" string(1) " " --- Iteration 12 -- +-- Iteration 11 -- array(2) { ["basename"]=> string(0) "" @@ -251,7 +232,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 13 -- +-- Iteration 12 -- array(2) { ["basename"]=> string(0) "" @@ -262,7 +243,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 14 -- +-- Iteration 13 -- array(2) { ["basename"]=> string(0) "" @@ -273,7 +254,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 15 -- +-- Iteration 14 -- array(2) { ["basename"]=> string(0) "" @@ -284,7 +265,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 16 -- +-- Iteration 15 -- array(2) { ["basename"]=> string(0) "" @@ -295,7 +276,7 @@ string(0) "" string(0) "" string(0) "" string(0) "" --- Iteration 17 -- +-- Iteration 16 -- array(4) { ["dirname"]=> string(1) "." @@ -310,7 +291,7 @@ string(1) "." string(11) "www.foo.com" string(3) "com" string(7) "www.foo" --- Iteration 18 -- +-- Iteration 17 -- array(4) { ["dirname"]=> string(17) "/var/html/testdir" @@ -325,7 +306,7 @@ string(17) "/var/html/testdir" string(12) "example.html" string(4) "html" string(7) "example" --- Iteration 19 -- +-- Iteration 18 -- array(3) { ["dirname"]=> string(12) "/testdir/foo" @@ -338,7 +319,7 @@ string(12) "/testdir/foo" string(4) "test" string(0) "" string(4) "test" --- Iteration 20 -- +-- Iteration 19 -- array(4) { ["dirname"]=> string(4) "/foo" @@ -353,7 +334,7 @@ string(4) "/foo" string(12) "symlink.link" string(4) "link" string(7) "symlink" --- Iteration 21 -- +-- Iteration 20 -- array(3) { ["dirname"]=> string(1) "." @@ -366,7 +347,7 @@ string(1) "." string(5) "12345" string(0) "" string(5) "12345" --- Iteration 22 -- +-- Iteration 21 -- array(4) { ["dirname"]=> string(1) "." @@ -381,7 +362,7 @@ string(1) "." string(15) "www.example.com" string(3) "com" string(11) "www.example" --- Iteration 23 -- +-- Iteration 22 -- array(3) { ["dirname"]=> string(12) "/testdir/foo" @@ -394,7 +375,7 @@ string(12) "/testdir/foo" string(4) "test" string(0) "" string(4) "test" --- Iteration 24 -- +-- Iteration 23 -- array(4) { ["dirname"]=> string(6) "../foo" @@ -409,7 +390,7 @@ string(6) "../foo" string(9) "test.link" string(4) "link" string(4) "test" --- Iteration 25 -- +-- Iteration 24 -- array(4) { ["dirname"]=> string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/test5/test6" @@ -424,7 +405,7 @@ string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/tes string(8) "test.tmp" string(3) "tmp" string(4) "test" --- Iteration 26 -- +-- Iteration 25 -- array(4) { ["dirname"]=> string(1) "." diff --git a/ext/standard/tests/file/popen_pclose_error.phpt b/ext/standard/tests/file/popen_pclose_error.phpt index 93ed5d946e..22fe309741 100644 --- a/ext/standard/tests/file/popen_pclose_error.phpt +++ b/ext/standard/tests/file/popen_pclose_error.phpt @@ -16,14 +16,9 @@ if (strtoupper( substr(PHP_OS, 0, 3) ) == 'SUN') */ $file_path = dirname(__FILE__); echo "*** Testing for error conditions ***\n"; -var_dump( popen() ); // Zero Arguments -var_dump( popen("abc.txt") ); // Single Argument var_dump( popen("abc.txt", "rw") ); // Invalid mode Argument -var_dump( pclose() ); $file_handle = fopen($file_path."/popen.tmp", "w"); -var_dump( pclose($file_handle, $file_handle) ); fclose($file_handle); -var_dump( pclose(1) ); echo "\n--- Done ---"; ?> --CLEAN-- @@ -34,22 +29,7 @@ unlink($file_path."/popen.tmp"); --EXPECTF-- *** Testing for error conditions *** -Warning: popen() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d -NULL - Warning: popen(abc.txt,rw): %s on line %d bool(false) -Warning: pclose() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: pclose() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: pclose() expects parameter 1 to be resource, int given in %s on line %d -bool(false) - --- Done --- diff --git a/ext/standard/tests/file/readfile_error.phpt b/ext/standard/tests/file/readfile_error.phpt index fcaa7f3946..c74b63d0d6 100644 --- a/ext/standard/tests/file/readfile_error.phpt +++ b/ext/standard/tests/file/readfile_error.phpt @@ -9,17 +9,12 @@ Test readfile() function: error conditions $context = stream_context_create(); echo "*** Test readfile(): error conditions ***\n"; -echo "-- Testing readfile() with unexpected no. of arguments --\n"; -var_dump( readfile() ); // args < expected -var_dump( readfile(__FILE__, true, $context, 4) ); // args > expected echo "\n-- Testing readfile() with invalid arguments --\n"; // invalid arguments var_dump( readfile(NULL) ); // NULL as $filename var_dump( readfile('') ); // empty string as $filename var_dump( readfile(false) ); // boolean false as $filename -var_dump( readfile(__FILE__, false, '') ); // empty string as $context -var_dump( readfile(__FILE__, true, false) ); // boolean false as $context echo "\n-- Testing readfile() with non-existent file --\n"; $non_existent_file = dirname(__FILE__)."/non_existent_file.tmp"; @@ -29,13 +24,6 @@ echo "Done\n"; ?> --EXPECTF-- *** Test readfile(): error conditions *** --- Testing readfile() with unexpected no. of arguments -- - -Warning: readfile() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: readfile() expects at most 3 parameters, 4 given in %s on line %d -bool(false) -- Testing readfile() with invalid arguments -- @@ -48,12 +36,6 @@ bool(false) Warning: readfile(): Filename cannot be empty in %s on line %d bool(false) -Warning: readfile() expects parameter 3 to be resource, string given in %s on line %d -bool(false) - -Warning: readfile() expects parameter 3 to be resource, bool given in %s on line %d -bool(false) - -- Testing readfile() with non-existent file -- Warning: readfile(%s/non_existent_file.tmp): failed to open stream: %s in %s on line %d diff --git a/ext/standard/tests/file/readfile_variation10-win32.phpt b/ext/standard/tests/file/readfile_variation10-win32.phpt index a240a826b9..04fdafca79 100644 --- a/ext/standard/tests/file/readfile_variation10-win32.phpt +++ b/ext/standard/tests/file/readfile_variation10-win32.phpt @@ -36,8 +36,12 @@ $names_arr = array( ); foreach($names_arr as $key => $value) { - echo "\n-- Filename: $key --\n"; - readfile($value); + echo "\n-- Filename: $key --\n"; + try { + readfile($value); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } }; ?> @@ -70,12 +74,10 @@ Warning: readfile(): Filename cannot be empty in %s on line %d Warning: readfile( ): failed to open stream: Permission denied in %s on line %d -- Filename: \0 -- - -Warning: readfile() expects parameter 1 to be a valid path, string given in %s on line %d +readfile() expects parameter 1 to be a valid path, string given -- Filename: array() -- - -Warning: readfile() expects parameter 1 to be a valid path, array given in %s on line %d +readfile() expects parameter 1 to be a valid path, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/readfile_variation10.phpt b/ext/standard/tests/file/readfile_variation10.phpt Binary files differindex 59b92ad365..5a0070c04f 100644 --- a/ext/standard/tests/file/readfile_variation10.phpt +++ b/ext/standard/tests/file/readfile_variation10.phpt diff --git a/ext/standard/tests/file/readlink_realpath_error.phpt b/ext/standard/tests/file/readlink_realpath_error.phpt index dc042bfff5..f7fd340aab 100644 --- a/ext/standard/tests/file/readlink_realpath_error.phpt +++ b/ext/standard/tests/file/readlink_realpath_error.phpt @@ -15,10 +15,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { Description: Returns canonicalized absolute pathname */ -echo "*** Testing readlink(): error conditions ***\n"; -var_dump( readlink() ); // args < expected -var_dump( readlink(__FILE__, 2) ); // args > expected - echo "\n*** Testing readlink() on a non-existent link ***\n"; var_dump( readlink(dirname(__FILE__)."/readlink_error.tmp") ); @@ -28,24 +24,12 @@ var_dump( readlink(__FILE__) ); echo "\n*** Testing readlink() on existing directory ***\n"; var_dump( readlink(dirname(__FILE__)) ); -echo "*** Testing realpath(): error conditions ***\n"; -var_dump( realpath() ); // args < expected -var_dump( realpath(1, 2) ); // args > expected - echo "\n*** Testing realpath() on a non-existent file ***\n"; var_dump( realpath(dirname(__FILE__)."/realpath_error.tmp") ); echo "Done\n"; ?> --EXPECTF-- -*** Testing readlink(): error conditions *** - -Warning: readlink() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: readlink() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing readlink() on a non-existent link *** Warning: readlink(): No such file or directory in %s on line %d @@ -60,13 +44,6 @@ bool(false) Warning: readlink(): Invalid argument in %s on line %d bool(false) -*** Testing realpath(): error conditions *** - -Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d -NULL *** Testing realpath() on a non-existent file *** %s diff --git a/ext/standard/tests/file/readlink_variation1.phpt b/ext/standard/tests/file/readlink_variation1.phpt index c350a94c77..eef16630d2 100644 --- a/ext/standard/tests/file/readlink_variation1.phpt +++ b/ext/standard/tests/file/readlink_variation1.phpt @@ -16,7 +16,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { /* Testing readlink() with invalid arguments -int, float, bool, NULL, resource */ $file_path = dirname(__FILE__); -$file_handle = fopen($file_path."/readlink_variation2.tmp", "w"); echo "*** Testing Invalid file types ***\n"; $filenames = array( @@ -26,7 +25,6 @@ $filenames = array( TRUE, FALSE, NULL, - $file_handle, /* scalars */ 1234, @@ -38,7 +36,6 @@ foreach( $filenames as $filename ) { var_dump( readlink($filename) ); clearstatcache(); } -fclose($file_handle); echo "\n*** Done ***"; ?> @@ -65,9 +62,6 @@ bool(false) Warning: readlink(): %s in %s on line %d bool(false) -Warning: readlink() expects parameter 1 to be a valid path, resource given in %s on line %d -NULL - Warning: readlink(): %s in %s on line %d bool(false) diff --git a/ext/standard/tests/file/realpath_error-win32.phpt b/ext/standard/tests/file/realpath_error-win32.phpt deleted file mode 100644 index 2fd221e45a..0000000000 --- a/ext/standard/tests/file/realpath_error-win32.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Test realpath() function: error conditions ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip only on Windows'); -} -?> ---FILE-- -<?php -/* Prototype: string realpath ( string $path ); - Description: Returns canonicalized absolute pathname -*/ - -echo "*** Testing realpath() for error conditions ***\n"; -var_dump( realpath() ); // args < expected -var_dump( realpath(1, 2) ); // args > expected - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing realpath() for error conditions *** - -Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d -NULL -Done diff --git a/ext/standard/tests/file/rename_variation13-win32.phpt b/ext/standard/tests/file/rename_variation13-win32.phpt Binary files differindex 6319d4ad61..977746a21d 100644 --- a/ext/standard/tests/file/rename_variation13-win32.phpt +++ b/ext/standard/tests/file/rename_variation13-win32.phpt diff --git a/ext/standard/tests/file/rename_variation13.phpt b/ext/standard/tests/file/rename_variation13.phpt index 2686150f23..07ee8aa9d8 100644 --- a/ext/standard/tests/file/rename_variation13.phpt +++ b/ext/standard/tests/file/rename_variation13.phpt @@ -30,8 +30,6 @@ $names_arr = array( NULL, "", " ", - "\0", - array(), /* prefix with path separator of a non existing directory*/ "/no/such/file/dir", @@ -97,24 +95,6 @@ bool(true) Warning: rename( ,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d bool(false) --- testing '%s' -- - -Warning: rename() %s in %s on line %d -bool(false) - -Warning: file_exists() expects parameter 1 to be a valid path, string given in %s on line %d - -Warning: rename() expects parameter 1 to be a valid path, string given in %s on line %d -bool(false) --- testing 'Array' -- - -Warning: rename() expects parameter 2 to be a valid path, array given in %s on line %d -bool(false) - -Warning: file_exists() expects parameter 1 to be a valid path, array given in %s on line %d - -Warning: rename() expects parameter 1 to be a valid path, array given in %s on line %d -bool(false) -- testing '/no/such/file/dir' -- Warning: rename(%s/renameVar13/afile.tmp,/no/such/file/dir): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/stat_error-win32.phpt b/ext/standard/tests/file/stat_error-win32.phpt index 20bffc79df..59c4fd6dee 100644 --- a/ext/standard/tests/file/stat_error-win32.phpt +++ b/ext/standard/tests/file/stat_error-win32.phpt @@ -17,29 +17,16 @@ $file_path = dirname(__FILE__); $arr = array(__FILE__); echo "\n*** Testing stat() for error conditions ***\n"; -var_dump( stat() ); // args < expected -var_dump( stat(__FILE__, 2) ); // file, args > expected -var_dump( stat(dirname(__FILE__), 2) ); //dir, args > expected var_dump( stat("$file_path/temp.tmp") ); // non existing file var_dump( stat("$file_path/temp/") ); // non existing dir var_dump( stat(22) ); // scalar argument -var_dump( stat($arr) ); // array argument echo "Done\n"; ?> --EXPECTF-- *** Testing stat() for error conditions *** -Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: stat(): stat failed for %s in %s on line %d bool(false) @@ -48,7 +35,4 @@ bool(false) Warning: stat(): stat failed for 22 in %s on line %d bool(false) - -Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d -NULL Done diff --git a/ext/standard/tests/file/stream_002.phpt b/ext/standard/tests/file/stream_002.phpt index b18dd85b31..84f3b78f06 100644 --- a/ext/standard/tests/file/stream_002.phpt +++ b/ext/standard/tests/file/stream_002.phpt @@ -15,8 +15,6 @@ var_dump(stream_socket_client(".", $a, $b)); var_dump($a, $b); var_dump(stream_socket_client(1, $a, $b)); var_dump($a, $b); -var_dump(stream_socket_client(array(), $a, $b)); -var_dump($a, $b); echo "Done\n"; ?> @@ -45,9 +43,4 @@ Warning: stream_socket_client(): unable to connect to 1 (Failed to parse address bool(false) int(0) string(27) "Failed to parse address "1"" - -Warning: stream_socket_client() expects parameter 1 to be string, array given in %s on line %d -bool(false) -int(0) -string(27) "Failed to parse address "1"" Done diff --git a/ext/standard/tests/file/stream_rfc2397_002.phpt b/ext/standard/tests/file/stream_rfc2397_002.phpt index 1dce5adf6c..6c58d0d7ad 100644 --- a/ext/standard/tests/file/stream_rfc2397_002.phpt +++ b/ext/standard/tests/file/stream_rfc2397_002.phpt @@ -24,9 +24,11 @@ $streams = array( foreach($streams as $stream) { $stream = fopen($stream, 'r'); - $meta = @stream_get_meta_data($stream); - var_dump($meta); - var_dump(isset($meta['foo']) ? $meta['foo'] : null); + if ($stream) { + $meta = stream_get_meta_data($stream); + var_dump($meta); + var_dump(isset($meta['foo']) ? $meta['foo'] : null); + } } ?> @@ -52,8 +54,6 @@ array(7) { NULL Warning: fopen(data://): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d -NULL -NULL array(7) { ["base64"]=> bool(true) @@ -73,16 +73,10 @@ array(7) { NULL Warning: fopen(data://;base64): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d -NULL -NULL Warning: fopen(data://foo,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d -NULL -NULL Warning: fopen(data://foo=bar,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d -NULL -NULL array(8) { ["mediatype"]=> string(10) "text/plain" @@ -104,8 +98,6 @@ array(8) { NULL Warning: fopen(data://text/plain;foo,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d -NULL -NULL array(9) { ["mediatype"]=> string(10) "text/plain" @@ -129,8 +121,6 @@ array(9) { string(3) "bar" Warning: fopen(data://text/plain;foo=bar;bla,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d -NULL -NULL array(9) { ["mediatype"]=> string(10) "text/plain" @@ -154,8 +144,6 @@ array(9) { string(3) "bar" Warning: fopen(data://text/plain;foo=bar;bar=baz): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d -NULL -NULL array(10) { ["mediatype"]=> string(10) "text/plain" diff --git a/ext/standard/tests/file/stream_rfc2397_006.phpt b/ext/standard/tests/file/stream_rfc2397_006.phpt index f6616a0c88..18d1c1b280 100644 --- a/ext/standard/tests/file/stream_rfc2397_006.phpt +++ b/ext/standard/tests/file/stream_rfc2397_006.phpt @@ -14,18 +14,19 @@ $streams = array( foreach($streams as $stream) { - var_dump(file_get_contents($stream)); + try { + var_dump(file_get_contents($stream)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } ?> ===DONE=== <?php exit(0); ?> --EXPECTF-- -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d -NULL - -Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d -NULL +file_get_contents() expects parameter 1 to be a valid path, string given +file_get_contents() expects parameter 1 to be a valid path, string given Warning: file_get_contents(data:;base64,#Zm9vYmFyIGZvb2Jhcg==): failed to open stream: rfc2397: unable to decode in %sstream_rfc2397_006.php on line %d bool(false) diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt index 7e8b5b24cf..6a1d026a79 100644 --- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt +++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt @@ -33,11 +33,6 @@ fclose($fp); $linkname = dirname(__FILE__)."/symlink_link_linkinfo_is_link_link_error1.tmp"; echo "*** Testing symlink() for error conditions ***\n"; -//zero arguments -var_dump( symlink() ); - -//more than expected -var_dump( symlink($filename, $linkname, true) ); //invalid arguments var_dump( symlink(NULL, $linkname) ); // NULL as filename @@ -48,11 +43,6 @@ var_dump( symlink($filename, '') ); // '' as linkname var_dump( symlink($filename, false) ); // false as linkname echo "\n*** Testing linkinfo() for error conditions ***\n"; -//zero arguments -var_dump( linkinfo() ); - -//more than expected -var_dump( linkinfo($linkname, true) ); //invalid arguments var_dump( linkinfo(NULL) ); // NULL as linkname @@ -69,12 +59,6 @@ unlink(dirname(__FILE__)."/symlink_link_linkinfo_is_link_error1.tmp"); --EXPECTF-- *** Testing symlink() for error conditions *** -Warning: symlink() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: symlink() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: symlink(): %s in %s on line %d bool(false) @@ -95,12 +79,6 @@ bool(false) *** Testing linkinfo() for error conditions *** -Warning: linkinfo() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: linkinfo() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: linkinfo(): %s in %s on line %d int(-1) diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt index fc891fde7b..00047cde5e 100644 --- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt +++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt @@ -30,11 +30,6 @@ fclose($fp); $linkname = dirname(__FILE__)."/symlink_link_linkinfo_is_link_link_error2.tmp"; echo "*** Testing link() for error conditions ***\n"; -//zero arguments -var_dump( link() ); - -//more than expected -var_dump( link($filename, $linkname, false) ); //invalid arguments var_dump( link(NULL, $linkname) ); // NULL as filename @@ -46,11 +41,6 @@ var_dump( link($filename, '') ); // '' as linkname var_dump( link($filename, false) ); // false as linkname echo "\n*** Testing is_link() for error conditions ***\n"; -//zero arguments -var_dump( is_link() ); - -//more than expected -var_dump( is_link($linkname, "/") ); //invalid arguments var_dump( is_link(NULL) ); // NULL as linkname @@ -68,12 +58,6 @@ unlink(dirname(__FILE__)."/symlink_link_linkinfo_is_link_error2.tmp"); --EXPECTF-- *** Testing link() for error conditions *** -Warning: link() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: link() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: link(): No such file or directory in %s on line %d bool(false) @@ -96,12 +80,6 @@ Warning: link(): No such file or directory in %s on line %d bool(false) *** Testing is_link() for error conditions *** - -Warning: is_link() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_link() expects exactly 1 parameter, 2 given in %s on line %d -NULL bool(false) bool(false) bool(false) diff --git a/ext/standard/tests/file/tempnam_variation3-win32.phpt b/ext/standard/tests/file/tempnam_variation3-win32.phpt index 6d5071b5e5..d7602326d9 100644 --- a/ext/standard/tests/file/tempnam_variation3-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt @@ -59,7 +59,12 @@ $res_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam($file_path, $names_arr[$i]); + try { + $file_name = tempnam($file_path, $names_arr[$i]); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } /* creating the files in existing dir */ if (file_exists($file_name) && !$res_arr[$i]) { @@ -104,14 +109,9 @@ Notice: tempnam(): file created in the system's temporary directory in %stempnam Failed, not created in the correct directory %s vs %s 0 -- Iteration 6 -- - -Warning: tempnam() expects parameter 2 to be a valid path, string given in %stempnam_variation3-win32.php on line 54 -Failed, not created in the correct directory %s vs %sext\standard\tests\file\tempnamVar3 -0 +tempnam() expects parameter 2 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 2 to be a valid path, array given in %s\ext\standard\tests\file\tempnam_variation3-win32.php on line %d -OK +tempnam() expects parameter 2 to be a valid path, array given -- Iteration 8 -- OK -- Iteration 9 -- diff --git a/ext/standard/tests/file/tempnam_variation3.phpt b/ext/standard/tests/file/tempnam_variation3.phpt index 2d95cb0a43..ccbd35084f 100644 --- a/ext/standard/tests/file/tempnam_variation3.phpt +++ b/ext/standard/tests/file/tempnam_variation3.phpt @@ -37,7 +37,12 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam("$file_path", $names_arr[$i]); + try { + $file_name = tempnam("$file_path", $names_arr[$i]); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } /* creating the files in existing dir */ if( file_exists($file_name) ) { @@ -100,17 +105,9 @@ File name is => %s/%s File permissions are => 100600 File created in => directory specified -- Iteration 6 -- - -Warning: tempnam() expects parameter 2 to be a valid path, string given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 2 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 2 to be a valid path, array given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 2 to be a valid path, array given -- Iteration 8 -- File name is => %s/dir%s File permissions are => 100600 diff --git a/ext/standard/tests/file/tempnam_variation7-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt index 5bacb5e876..f4b3cf016c 100644 --- a/ext/standard/tests/file/tempnam_variation7-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt @@ -34,7 +34,12 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + try { + $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } if( file_exists($file_name) ){ @@ -95,17 +100,9 @@ File name is => %s%et%s File permissions are => 100666 File created in => temp dir -- Iteration 6 -- - -Warning: tempnam() expects parameter 1 to be a valid path, string given in %stempnam_variation7-win32.php on line %d --- File is not created -- - -Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d +tempnam() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d --- File is not created -- - -Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d +tempnam() expects parameter 1 to be a valid path, array given -- Iteration 8 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt index 9ed84f974a..680e207718 100644 --- a/ext/standard/tests/file/tempnam_variation7.phpt +++ b/ext/standard/tests/file/tempnam_variation7.phpt @@ -35,7 +35,12 @@ $names_arr = array( for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; - $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + try { + $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + continue; + } if( file_exists($file_name) ){ @@ -100,17 +105,9 @@ File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir -- Iteration 6 -- - -Warning: tempnam() expects parameter 1 to be a valid path, string given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 1 to be a valid path, string given -- Iteration 7 -- - -Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d --- File is not created -- - -Warning: unlink(): %s in %s on line %d +tempnam() expects parameter 1 to be a valid path, array given -- Iteration 8 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d diff --git a/ext/standard/tests/file/touch.phpt b/ext/standard/tests/file/touch.phpt index 42d1fad1e5..119ffd3204 100644 --- a/ext/standard/tests/file/touch.phpt +++ b/ext/standard/tests/file/touch.phpt @@ -13,7 +13,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { // output to linux. This could be a php.net bug on windows or a windows querk. $filename = dirname(__FILE__)."/touch.dat"; -var_dump(touch()); var_dump(touch($filename)); var_dump(filemtime($filename)); @unlink($filename); @@ -39,8 +38,6 @@ var_dump(touch("/no/such/file/or/directory")); echo "Done\n"; ?> --EXPECTF-- -Warning: touch() expects at least 1 parameter, 0 given in %s on line %d -NULL bool(true) int(%d) bool(true) diff --git a/ext/standard/tests/file/touch_error.phpt b/ext/standard/tests/file/touch_error.phpt index 0520055a90..9a4bd01e13 100644 --- a/ext/standard/tests/file/touch_error.phpt +++ b/ext/standard/tests/file/touch_error.phpt @@ -5,17 +5,9 @@ Dave Kelsey <d_kelsey@uk.ibm.com> --FILE-- <?php -var_dump(touch()); -var_dump(touch(1, 2, 3, 4)); var_dump(touch("/no/such/file/or/directory")); ?> --EXPECTF-- -Warning: touch() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: touch() expects at most 3 parameters, 4 given in %s on line %d -NULL - Warning: touch(): Unable to create file /no/such/file/or/directory because No such file or directory in %s on line %d bool(false) diff --git a/ext/standard/tests/file/unlink_error-win32-mb.phpt b/ext/standard/tests/file/unlink_error-win32-mb.phpt index efd6ee8323..2c81e33b72 100644 --- a/ext/standard/tests/file/unlink_error-win32-mb.phpt +++ b/ext/standard/tests/file/unlink_error-win32-mb.phpt @@ -25,13 +25,6 @@ $context = stream_context_create(); echo "*** Testing unlink() : error conditions ***\n"; -echo "-- Testing unlink() on unexpected no. of arguments --\n"; -// arg < expected -var_dump( unlink() ); -// args > expected -var_dump( unlink($filename, $context, true) ); -var_dump( file_exists($filename) ); // expected: true - echo "\n-- Testing unlink() on invalid arguments --\n"; // invalid arguments var_dump( unlink('') ); // $filename as empty string @@ -43,9 +36,6 @@ var_dump( file_exists(NULL) ); // confirm file doesnt exist var_dump( unlink(false) ); // $filename as boolean false var_dump( file_exists(false) ); // confirm file doesnt exist -var_dump( unlink($filename, '') ); // $context as empty string -var_dump( unlink($filename, false) ); // $context as boolean false - echo "\n-- Testing unlink() on non-existent file --\n"; var_dump( unlink(dirname(__FILE__)."/non_existent_file.tmp") ); @@ -68,14 +58,6 @@ rmdir(dirname(__FILE__)."/私はガラスを食べられます"); ?> --EXPECTF-- *** Testing unlink() : error conditions *** --- Testing unlink() on unexpected no. of arguments -- - -Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -bool(true) -- Testing unlink() on invalid arguments -- @@ -91,12 +73,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d -bool(false) - -Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d -bool(false) - -- Testing unlink() on non-existent file -- Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/unlink_error-win32.phpt b/ext/standard/tests/file/unlink_error-win32.phpt index 8dde64cff0..fe165ec8c6 100644 --- a/ext/standard/tests/file/unlink_error-win32.phpt +++ b/ext/standard/tests/file/unlink_error-win32.phpt @@ -23,13 +23,6 @@ $context = stream_context_create(); echo "*** Testing unlink() : error conditions ***\n"; -echo "-- Testing unlink() on unexpected no. of arguments --\n"; -// arg < expected -var_dump( unlink() ); -// args > expected -var_dump( unlink($filename, $context, true) ); -var_dump( file_exists($filename) ); // expected: true - echo "\n-- Testing unlink() on invalid arguments --\n"; // invalid arguments var_dump( unlink('') ); // $filename as empty string @@ -41,9 +34,6 @@ var_dump( file_exists(NULL) ); // confirm file doesnt exist var_dump( unlink(false) ); // $filename as boolean false var_dump( file_exists(false) ); // confirm file doesnt exist -var_dump( unlink($filename, '') ); // $context as empty string -var_dump( unlink($filename, false) ); // $context as boolean false - echo "\n-- Testing unlink() on non-existent file --\n"; var_dump( unlink(dirname(__FILE__)."/non_existent_file.tmp") ); @@ -65,14 +55,6 @@ rmdir(dirname(__FILE__)."/unlink_error"); ?> --EXPECTF-- *** Testing unlink() : error conditions *** --- Testing unlink() on unexpected no. of arguments -- - -Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -bool(true) -- Testing unlink() on invalid arguments -- @@ -88,12 +70,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d -bool(false) - -Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d -bool(false) - -- Testing unlink() on non-existent file -- Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/unlink_error.phpt b/ext/standard/tests/file/unlink_error.phpt index f7f8f00847..87b189f3cf 100644 --- a/ext/standard/tests/file/unlink_error.phpt +++ b/ext/standard/tests/file/unlink_error.phpt @@ -23,13 +23,6 @@ $context = stream_context_create(); echo "*** Testing unlink() : error conditions ***\n"; -echo "-- Testing unlink() on unexpected no. of arguments --\n"; -// arg < expected -var_dump( unlink() ); -// args > expected -var_dump( unlink($filename, $context, true) ); -var_dump( file_exists($filename) ); // expected true - echo "\n-- Testing unlink() on invalid arguments --\n"; // invalid arguments var_dump( unlink('') ); // $filename as empty string @@ -41,10 +34,6 @@ var_dump( file_exists(NULL) ); // confirm file doesnt exist var_dump( unlink(false) ); // $filename as boolean false var_dump( file_exists(false) ); // confirm file doesnt exist -var_dump( unlink($filename, '') ); // $context as empty string -var_dump( unlink($filename, false) ); // $context as boolean false - - echo "\n-- Testing unlink() on non-existent file --\n"; var_dump( unlink(dirname(__FILE__)."/non_existent_file.tmp") ); @@ -65,14 +54,6 @@ rmdir(dirname(__FILE__)."/unlink_error"); ?> --EXPECTF-- *** Testing unlink() : error conditions *** --- Testing unlink() on unexpected no. of arguments -- - -Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -bool(true) -- Testing unlink() on invalid arguments -- @@ -88,12 +69,6 @@ Warning: unlink(): %s in %s on line %d bool(false) bool(false) -Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d -bool(false) - -Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d -bool(false) - -- Testing unlink() on non-existent file -- Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d diff --git a/ext/standard/tests/filters/001.phpt b/ext/standard/tests/filters/001.phpt index fbfdda2385..53d9fc2b50 100644 --- a/ext/standard/tests/filters/001.phpt +++ b/ext/standard/tests/filters/001.phpt @@ -7,8 +7,6 @@ var_dump(stream_filter_register("", "")); var_dump(stream_filter_register("test", "")); var_dump(stream_filter_register("", "test")); var_dump(stream_filter_register("------", "nonexistentclass")); -var_dump(stream_filter_register(array(), "aa")); -var_dump(stream_filter_register("", array())); echo "Done\n"; ?> @@ -22,10 +20,4 @@ bool(false) Warning: stream_filter_register(): Filter name cannot be empty in %s on line %d bool(false) bool(true) - -Warning: stream_filter_register() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: stream_filter_register() expects parameter 2 to be string, array given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/filters/stream_filter_remove_error.phpt b/ext/standard/tests/filters/stream_filter_remove_error.phpt index 37820a99c4..e389b20fd8 100644 --- a/ext/standard/tests/filters/stream_filter_remove_error.phpt +++ b/ext/standard/tests/filters/stream_filter_remove_error.phpt @@ -20,16 +20,6 @@ $filter = stream_filter_append( $fp, "string.rot13", STREAM_FILTER_WRITE ); echo "*** Testing stream_filter_remove() : error conditions ***\n"; -echo "\n-- Testing stream_filter_remove() function with Zero arguments --\n"; -var_dump( stream_filter_remove() ); - -echo "\n-- Testing stream_filter_remove() function with more than expected no. of arguments --\n"; -$arg = 'bogus arg'; -var_dump( stream_filter_remove( $filter, $arg ) ); - -echo "\n-- Testing stream_filter_remove() function with unexisting stream filter --\n"; -var_dump( stream_filter_remove( "fakefilter" ) ); - echo "\n-- Testing stream_filter_remove() function with bad resource --\n"; var_dump( stream_filter_remove( $fp ) ); @@ -52,21 +42,6 @@ unlink( $file ); --EXPECTF-- *** Testing stream_filter_remove() : error conditions *** --- Testing stream_filter_remove() function with Zero arguments -- - -Warning: stream_filter_remove() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing stream_filter_remove() function with more than expected no. of arguments -- - -Warning: stream_filter_remove() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - --- Testing stream_filter_remove() function with unexisting stream filter -- - -Warning: stream_filter_remove() expects parameter 1 to be resource, string given in %s on line %d -bool(false) - -- Testing stream_filter_remove() function with bad resource -- Warning: stream_filter_remove(): Invalid resource given, not a stream filter in %s on line %d diff --git a/ext/standard/tests/filters/strip_tags_filter.phpt b/ext/standard/tests/filters/strip_tags_filter.phpt deleted file mode 100644 index f353e79a9a..0000000000 --- a/ext/standard/tests/filters/strip_tags_filter.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -string.strip_tags filter ---FILE-- -<?php -$fp = fopen('php://output', 'w'); -stream_filter_append($fp, 'string.strip_tags'); -fwrite($fp, "test <b>bold</b> <i>italic</i> test\n"); -fclose($fp); - -$fp = fopen('php://output', 'w'); -stream_filter_append($fp, 'string.strip_tags', STREAM_FILTER_WRITE, "<b>"); -fwrite($fp, "test <b>bold</b> <i>italic</i> test\n"); -fclose($fp); - -$fp = fopen('php://output', 'w'); -stream_filter_append($fp, 'string.strip_tags', STREAM_FILTER_WRITE, ["b"]); -fwrite($fp, "test <b>bold</b> <i>italic</i> test\n"); -fclose($fp); - -?> ---EXPECTF-- -Deprecated: stream_filter_append(): The string.strip_tags filter is deprecated in %s on line %d -test bold italic test - -Deprecated: stream_filter_append(): The string.strip_tags filter is deprecated in %s on line %d -test <b>bold</b> italic test - -Deprecated: stream_filter_append(): The string.strip_tags filter is deprecated in %s on line %d -test <b>bold</b> italic test diff --git a/ext/standard/tests/general_functions/010.phpt b/ext/standard/tests/general_functions/010.phpt index 51132c6a15..99971616d2 100644 --- a/ext/standard/tests/general_functions/010.phpt +++ b/ext/standard/tests/general_functions/010.phpt @@ -3,24 +3,19 @@ register_shutdown_function() & __call --FILE-- <?php class test { - function _foo() { - throw new Exception('test'); - } - function __call($name=null, $args=null) { - return test::_foo(); - } + function _foo() { + throw new Exception('test'); + } + function __call($name=null, $args=null) { + return test::_foo(); + } } -try { - var_dump(register_shutdown_function(array("test","__call"))); -} catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; -} +var_dump(register_shutdown_function(array("test","__call"))); echo "Done\n"; ?> --EXPECTF-- -Exception: Non-static method test::__call() cannot be called statically +Warning: register_shutdown_function(): Invalid shutdown callback 'test::__call' passed in %s on line %d +bool(false) Done - -Fatal error: Non-static method test::__call() cannot be called statically in %s on line %d diff --git a/ext/standard/tests/general_functions/bug32647.phpt b/ext/standard/tests/general_functions/bug32647.phpt index c6ff94833d..a9d84e798b 100644 --- a/ext/standard/tests/general_functions/bug32647.phpt +++ b/ext/standard/tests/general_functions/bug32647.phpt @@ -46,13 +46,8 @@ Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed Warning: register_shutdown_function(): Invalid shutdown callback 'bar' passed in %s on line %d -Deprecated: Non-static method bar::barfoo() should not be called statically in %sbug32647.php on line %d +Warning: register_shutdown_function(): Invalid shutdown callback 'bar::barfoo' passed in %sbug32647.php on line %d Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foobar' passed in %sbug32647.php on line %d foo! - -Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0 - -Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0 -bar! bar! diff --git a/ext/standard/tests/general_functions/bug41970.phpt b/ext/standard/tests/general_functions/bug41970.phpt index 6f05137afc..f43bf64380 100644 --- a/ext/standard/tests/general_functions/bug41970.phpt +++ b/ext/standard/tests/general_functions/bug41970.phpt @@ -6,22 +6,26 @@ Bug #41970 (call_user_func_*() leaks on failure) $a = array(4,3,2); var_dump(call_user_func_array("sort", array($a))); -var_dump(call_user_func_array("strlen", array($a))); +try { + var_dump(call_user_func_array("strlen", array($a))); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(call_user_func("sort", $a)); -var_dump(call_user_func("strlen", $a)); +try { + var_dump(call_user_func("strlen", $a)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> --EXPECTF-- -Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 5 +Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line %d bool(true) +strlen() expects parameter 1 to be string, array given -Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 6 -NULL - -Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 7 +Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line %d bool(true) - -Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 8 -NULL +strlen() expects parameter 1 to be string, array given Done diff --git a/ext/standard/tests/general_functions/bug47857.phpt b/ext/standard/tests/general_functions/bug47857.phpt index d19eca7248..c06673bc34 100644 --- a/ext/standard/tests/general_functions/bug47857.phpt +++ b/ext/standard/tests/general_functions/bug47857.phpt @@ -8,18 +8,20 @@ class foo { } } var_dump(is_callable(array('foo','bar'))); -foo::bar(); +try { + foo::bar(); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} var_dump(is_callable(array('Exception','getMessage'))); -Exception::getMessage(); +try { + Exception::getMessage(); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -bool(true) - -Deprecated: Non-static method foo::bar() should not be called statically in %sbug47857.php on line %d -ok +--EXPECT-- +bool(false) +Non-static method foo::bar() cannot be called statically bool(false) - -Fatal error: Uncaught Error: Non-static method Exception::getMessage() cannot be called statically in %sbug47857.php:%d -Stack trace: -#0 {main} - thrown in %sbug47857.php on line %d +Non-static method Exception::getMessage() cannot be called statically diff --git a/ext/standard/tests/general_functions/bug70018.phpt b/ext/standard/tests/general_functions/bug70018.phpt index d4c38b9d8a..43139fc029 100644 --- a/ext/standard/tests/general_functions/bug70018.phpt +++ b/ext/standard/tests/general_functions/bug70018.phpt @@ -1,11 +1,5 @@ --TEST-- Bug #70018 (exec does not strip all whitespace) ---SKIPIF-- -<?php -if ("cli" != php_sapi_name()) { - die("skip.. CLI only test"); -} -?> --FILE-- <?php $output = array(); diff --git a/ext/standard/tests/general_functions/callbacks_001.phpt b/ext/standard/tests/general_functions/callbacks_001.phpt index a58f19d932..76d0e94c82 100644 --- a/ext/standard/tests/general_functions/callbacks_001.phpt +++ b/ext/standard/tests/general_functions/callbacks_001.phpt @@ -69,7 +69,11 @@ class P extends O { $this->call(array('parent', 'who')); $this->call(array('P', 'parent::who')); $this->call(array($this, 'O::who')); - $this->call(array($this, 'B::who')); + try { + $this->call(array($this, 'B::who')); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } } @@ -103,6 +107,5 @@ O $this|O::who O $this|B::who - -Warning: call_user_func() expects parameter 1 to be a valid callback, class 'P' is not a subclass of 'B' in %s on line %d +call_user_func() expects parameter 1 to be a valid callback, class 'P' is not a subclass of 'B' ===DONE=== diff --git a/ext/standard/tests/general_functions/callbacks_002.phpt b/ext/standard/tests/general_functions/callbacks_002.phpt index 22130c524a..0d44035e0e 100644 --- a/ext/standard/tests/general_functions/callbacks_002.phpt +++ b/ext/standard/tests/general_functions/callbacks_002.phpt @@ -3,14 +3,24 @@ call_user_func(): Wrong parameters --FILE-- <?php -call_user_func(array('Foo', 'bar')); -call_user_func(array(NULL, 'bar')); -call_user_func(array('stdclass', NULL)); +try { + call_user_func(array('Foo', 'bar')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + call_user_func(array(NULL, 'bar')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + call_user_func(array('stdclass', NULL)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- -Warning: call_user_func() expects parameter 1 to be a valid callback, class 'Foo' not found in %s on line %d - -Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d - -Warning: call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method in %s on line %d +call_user_func() expects parameter 1 to be a valid callback, class 'Foo' not found +call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object +call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method diff --git a/ext/standard/tests/general_functions/error_get_last.phpt b/ext/standard/tests/general_functions/error_get_last.phpt index 71f068f104..e6cea73f4d 100644 --- a/ext/standard/tests/general_functions/error_get_last.phpt +++ b/ext/standard/tests/general_functions/error_get_last.phpt @@ -4,7 +4,11 @@ error_get_last() tests <?php var_dump(error_get_last()); -var_dump(error_get_last(true)); +try { + var_dump(error_get_last(true)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(error_get_last()); $a = $b; @@ -15,19 +19,8 @@ echo "Done\n"; ?> --EXPECTF-- NULL - -Warning: error_get_last() expects exactly 0 parameters, 1 given in %s on line %d +error_get_last() expects exactly 0 parameters, 1 given NULL -array(4) { - ["type"]=> - int(2) - ["message"]=> - string(54) "error_get_last() expects exactly 0 parameters, 1 given" - ["file"]=> - string(%i) "%s" - ["line"]=> - int(4) -} Notice: Undefined variable: b in %s on line %d array(4) { @@ -38,6 +31,6 @@ array(4) { ["file"]=> string(%i) "%s" ["line"]=> - int(7) + int(11) } Done diff --git a/ext/standard/tests/general_functions/floatval.phpt b/ext/standard/tests/general_functions/floatval.phpt index 1bb4d1151c..2b681e631d 100644 --- a/ext/standard/tests/general_functions/floatval.phpt +++ b/ext/standard/tests/general_functions/floatval.phpt @@ -91,18 +91,6 @@ foreach ($not_float_types as $type ) { var_dump( doubleval($type) ); } - - - -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( floatval() ); -var_dump( doubleval() ); - -//arguments more than expected -var_dump( floatval(TRUE, FALSE) ); -var_dump( doubleval(TRUE, FALSE) ); - echo "\nDone\n"; @@ -194,18 +182,4 @@ float(1) float(0) float(0) -*** Testing error conditions *** - -Warning: floatval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: doubleval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: floatval() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: doubleval() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt index 33d4af03d2..c74e4f71fe 100644 --- a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt +++ b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt @@ -14,10 +14,14 @@ $result = get_extension_funcs("standard"); var_dump(gettype($result)); var_dump(in_array("cos", $result)); +// Unknown extension +var_dump(get_extension_funcs("foo")); + ?> ===DONE=== --EXPECT-- Simple testcase for get_extension_funcs() function string(5) "array" bool(true) +bool(false) ===DONE=== diff --git a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt b/ext/standard/tests/general_functions/get_extension_funcs_error.phpt deleted file mode 100644 index 44bd822d12..0000000000 --- a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Test get_extension_funcs() function : error conditions ---FILE-- -<?php -/* Prototype : array get_extension_funcs ( string $module_name ) - * Description: Returns an array with the names of the functions of a module. - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -echo "*** Testing get_extension_funcs() : error conditions ***\n"; - -echo "\n-- Too few arguments --\n"; -var_dump(get_extension_funcs()); - -$extra_arg = 1; -echo "\n-- Too many arguments --\n"; -var_dump(get_extension_funcs("standard", $extra_arg)); - -echo "\n-- Invalid extension name --\n"; -var_dump(get_extension_funcs("foo")); - -?> -===DONE=== ---EXPECTF-- -*** Testing get_extension_funcs() : error conditions *** - --- Too few arguments -- - -Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Too many arguments -- - -Warning: get_extension_funcs() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Invalid extension name -- -bool(false) -===DONE=== diff --git a/ext/standard/tests/general_functions/get_include_path_basic.phpt b/ext/standard/tests/general_functions/get_include_path_basic.phpt index 2017bf697a..5b45c86449 100644 --- a/ext/standard/tests/general_functions/get_include_path_basic.phpt +++ b/ext/standard/tests/general_functions/get_include_path_basic.phpt @@ -19,19 +19,10 @@ if (ini_get("include_path") == get_include_path()) { echo "FAILED\n"; } -echo "\nError cases:\n"; -var_dump(get_include_path(TRUE)); - - ?> ===DONE=== --EXPECTF-- *** Testing get_include_path() string(1) "." PASSED - -Error cases: - -Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/get_included_files.phpt b/ext/standard/tests/general_functions/get_included_files.phpt index e6d00a56a1..e4dfe0f974 100644 --- a/ext/standard/tests/general_functions/get_included_files.phpt +++ b/ext/standard/tests/general_functions/get_included_files.phpt @@ -22,9 +22,6 @@ include(dirname(__FILE__)."/get_included_files_inc2.inc"); echo "\n-- List included files atfter including inc2 which will include inc3 which includes inc1 --\n"; var_dump(get_included_files()); -echo "\n-- Error cases --\n"; -var_dump(get_included_files(true)); - ?> ===DONE=== --EXPECTF-- @@ -55,9 +52,4 @@ array(4) { [3]=> string(%d) "%sget_included_files_inc3.inc" } - --- Error cases -- - -Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/getrusage.phpt b/ext/standard/tests/general_functions/getrusage.phpt index 4caca88e1b..8ec131809f 100644 --- a/ext/standard/tests/general_functions/getrusage.phpt +++ b/ext/standard/tests/general_functions/getrusage.phpt @@ -8,16 +8,12 @@ getrusage() tests var_dump(gettype(getrusage())); var_dump(gettype(getrusage(1))); var_dump(gettype(getrusage(-1))); -var_dump(getrusage(array())); echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- string(5) "array" string(5) "array" string(5) "array" - -Warning: getrusage() expects parameter 1 to be int, array given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/getservbyport_variation1.phpt b/ext/standard/tests/general_functions/getservbyport_variation1.phpt index a876ac1fea..f387161bf4 100644 --- a/ext/standard/tests/general_functions/getservbyport_variation1.phpt +++ b/ext/standard/tests/general_functions/getservbyport_variation1.phpt @@ -12,29 +12,13 @@ Simone Gentili (sensorario@gmail.com) var_dump(getservbyport( -1, "tcp" )); var_dump(getservbyport( 80, "ppp" )); var_dump(getservbyport( null, null)); - var_dump(getservbyport( array(), array())); - var_dump(getservbyport( array(80), array("tcp"))); - var_dump(getservbyport( array(2, 3), array("one"=>1, "two"=>2))); var_dump(getservbyport( 2, 2)); var_dump(getservbyport( "80", "tcp")); - var_dump(getservbyport( new stdClass(), new stdClass())); ?> --EXPECTF-- bool(false) bool(false) bool(false) - -Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d -NULL bool(false) string(%d) "%s" - -Warning: getservbyport() expects parameter 1 to be int, object given in %s on line %d -NULL diff --git a/ext/standard/tests/general_functions/gettype_settype_error.phpt b/ext/standard/tests/general_functions/gettype_settype_error.phpt index 325e91e47f..e204c64d4c 100644 --- a/ext/standard/tests/general_functions/gettype_settype_error.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_error.phpt @@ -13,19 +13,7 @@ Test gettype() & settype() functions : error conditions echo "**** Testing gettype() and settype() functions ****\n"; -echo "\n*** Testing gettype(): error conditions ***\n"; -//Zero arguments -var_dump( gettype() ); -// args more than expected -var_dump( gettype( "1", "2" ) ); - echo "\n*** Testing settype(): error conditions ***\n"; -//Zero arguments -var_dump( settype() ); - -// args more than expected -$var = 10.5; -var_dump( settype( $var, $var, "int" ) ); // passing an invalid type to set var_dump( settype( $var, "unknown" ) ); @@ -35,22 +23,8 @@ echo "Done\n"; --EXPECTF-- **** Testing gettype() and settype() functions **** -*** Testing gettype(): error conditions *** - -Warning: gettype() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: gettype() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing settype(): error conditions *** -Warning: settype() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: settype() expects exactly 2 parameters, 3 given in %s on line %d -NULL - Warning: settype(): Invalid type in %s on line %d bool(false) Done diff --git a/ext/standard/tests/general_functions/head.phpt b/ext/standard/tests/general_functions/head.phpt index 059c56b258..f8d4c28338 100644 --- a/ext/standard/tests/general_functions/head.phpt +++ b/ext/standard/tests/general_functions/head.phpt @@ -1,11 +1,5 @@ --TEST-- header() and friends ---SKIPIF-- -<?php -if (php_sapi_name() != "cli") { - die("skip this test is for CLI"); -} -?> --FILE-- <?php diff --git a/ext/standard/tests/general_functions/include_path.phpt b/ext/standard/tests/general_functions/include_path.phpt index 8b6626fbc8..de6aa278eb 100644 --- a/ext/standard/tests/general_functions/include_path.phpt +++ b/ext/standard/tests/general_functions/include_path.phpt @@ -6,14 +6,9 @@ include_path=. <?php var_dump(get_include_path()); -var_dump(get_include_path("var")); var_dump(restore_include_path()); -var_dump(restore_include_path("")); - -var_dump(set_include_path()); -var_dump(get_include_path()); var_dump(set_include_path("var")); var_dump(get_include_path()); @@ -32,9 +27,6 @@ var_dump(get_include_path()); var_dump(restore_include_path()); var_dump(get_include_path()); -var_dump(set_include_path(array())); -var_dump(get_include_path()); - var_dump(restore_include_path()); var_dump(get_include_path()); @@ -43,18 +35,8 @@ echo "Done\n"; ?> --EXPECTF-- string(1) "." - -Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d -NULL -NULL - -Warning: restore_include_path() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: set_include_path() expects exactly 1 parameter, 0 given in %s on line %d NULL string(1) "." -string(1) "." string(3) "var" NULL string(1) "." @@ -66,10 +48,6 @@ bool(false) string(1) "." NULL string(1) "." - -Warning: set_include_path() expects parameter 1 to be a valid path, array given in %s on line %d -NULL -string(1) "." NULL string(1) "." Done diff --git a/ext/standard/tests/general_functions/intval.phpt b/ext/standard/tests/general_functions/intval.phpt index 7f3d895fbe..00b2dc04ab 100644 --- a/ext/standard/tests/general_functions/intval.phpt +++ b/ext/standard/tests/general_functions/intval.phpt @@ -146,13 +146,6 @@ foreach ($not_int_types as $type ) { var_dump( intval($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( intval() ); - -//arguments more than expected -var_dump( intval(TRUE, FALSE, TRUE) ); - echo "\n--- Done ---\n"; @@ -295,12 +288,4 @@ int(0) int(0) int(0) -*** Testing error conditions *** - -Warning: intval() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: intval() expects at most 2 parameters, 3 given in %s on line %d -NULL - --- Done --- diff --git a/ext/standard/tests/general_functions/intval_variation1.phpt b/ext/standard/tests/general_functions/intval_variation1.phpt index e76d7083d4..e44bc1db80 100644 --- a/ext/standard/tests/general_functions/intval_variation1.phpt +++ b/ext/standard/tests/general_functions/intval_variation1.phpt @@ -11,8 +11,8 @@ Test intval() function : usage variation echo "*** Testing intval() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { // report non-silenced errors echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } diff --git a/ext/standard/tests/general_functions/is_array.phpt b/ext/standard/tests/general_functions/is_array.phpt index 223b732904..f3b0c75db3 100644 --- a/ext/standard/tests/general_functions/is_array.phpt +++ b/ext/standard/tests/general_functions/is_array.phpt @@ -98,13 +98,6 @@ foreach ($varient_arrays as $type ) { var_dump( is_array ($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_array() ); - -//arguments more than expected -var_dump( is_array ($fp, $fp) ); - echo "Done\n"; /* close resources */ fclose($fp); @@ -202,12 +195,4 @@ bool(false) bool(false) -- Iteration 29 -- bool(false) - -*** Testing error conditions *** - -Warning: is_array() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_array() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_bool.phpt b/ext/standard/tests/general_functions/is_bool.phpt index a6c6111fa1..4f0ae4fff5 100644 --- a/ext/standard/tests/general_functions/is_bool.phpt +++ b/ext/standard/tests/general_functions/is_bool.phpt @@ -127,13 +127,6 @@ foreach ($not_bool_types as $type ) { var_dump( is_bool($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_bool() ); - -//arguments more than expected -var_dump( is_bool(TRUE, FALSE) ); - echo "Done\n"; // close resources @@ -283,12 +276,4 @@ bool(false) bool(false) -- Iteration 65 -- bool(false) - -*** Testing error conditions *** - -Warning: is_bool() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_bool() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_callable_basic2.phpt b/ext/standard/tests/general_functions/is_callable_basic2.phpt index 7657875311..7b43191aab 100644 --- a/ext/standard/tests/general_functions/is_callable_basic2.phpt +++ b/ext/standard/tests/general_functions/is_callable_basic2.phpt @@ -207,12 +207,12 @@ object_class::func bool(false) object_class::func -- Innerloop iteration 10 of Outerloop iteration 1 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 2 --- -- Innerloop iteration 1 of Outerloop iteration 2 -- @@ -288,12 +288,12 @@ no_member_class::func bool(false) no_member_class::func -- Innerloop iteration 10 of Outerloop iteration 2 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 3 --- -- Innerloop iteration 1 of Outerloop iteration 3 -- @@ -369,12 +369,12 @@ contains_object_class::func bool(true) contains_object_class::func -- Innerloop iteration 10 of Outerloop iteration 3 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 4 --- -- Innerloop iteration 1 of Outerloop iteration 4 -- @@ -450,12 +450,12 @@ contains_object_class::func bool(true) contains_object_class::func -- Innerloop iteration 10 of Outerloop iteration 4 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 5 --- -- Innerloop iteration 1 of Outerloop iteration 5 -- @@ -531,12 +531,12 @@ object_class::func bool(false) object_class::func -- Innerloop iteration 10 of Outerloop iteration 5 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 6 --- -- Innerloop iteration 1 of Outerloop iteration 6 -- @@ -612,12 +612,12 @@ no_member_class::func bool(false) no_member_class::func -- Innerloop iteration 10 of Outerloop iteration 6 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 7 --- -- Innerloop iteration 1 of Outerloop iteration 7 -- @@ -693,12 +693,12 @@ object_class::func bool(false) object_class::func -- Innerloop iteration 10 of Outerloop iteration 7 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 8 --- -- Innerloop iteration 1 of Outerloop iteration 8 -- @@ -774,11 +774,11 @@ Array bool(false) Array -- Innerloop iteration 10 of Outerloop iteration 8 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 ===DONE=== diff --git a/ext/standard/tests/general_functions/is_countable_with_variables.phpt b/ext/standard/tests/general_functions/is_countable_with_variables.phpt index 700077ef17..0cb18769d6 100644 --- a/ext/standard/tests/general_functions/is_countable_with_variables.phpt +++ b/ext/standard/tests/general_functions/is_countable_with_variables.phpt @@ -7,7 +7,6 @@ Gabriel Caruso (carusogabriel34@gmail.com) var_dump(is_countable([1, 2, 3])); var_dump(is_countable((array) 1)); var_dump(is_countable((object) ['foo', 'bar', 'baz'])); -var_dump(is_countable()); $foo = ['', []]; @@ -24,9 +23,6 @@ if (!is_countable($bar)) { bool(true) bool(true) bool(false) - -Warning: is_countable() expects exactly 1 parameter, 0 given in %s on line %d -NULL int(2) Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d diff --git a/ext/standard/tests/general_functions/is_float.phpt b/ext/standard/tests/general_functions/is_float.phpt index b71a5283db..0ee1c60959 100644 --- a/ext/standard/tests/general_functions/is_float.phpt +++ b/ext/standard/tests/general_functions/is_float.phpt @@ -127,17 +127,6 @@ foreach ($not_floats as $value ) { var_dump( is_real($value) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_float() ); -var_dump( is_double() ); -var_dump( is_real() ); - -//arguments more than expected -var_dump( is_float( $floats[0], $floats[1]) ); -var_dump( is_double( $floats[0], $floats[1]) ); -var_dump( is_real( $floats[0], $floats[1]) ); - echo "Done\n"; // close the resources used @@ -417,24 +406,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_float_64bit.phpt b/ext/standard/tests/general_functions/is_float_64bit.phpt index 9410a21fe2..76cbf0c5d2 100644 --- a/ext/standard/tests/general_functions/is_float_64bit.phpt +++ b/ext/standard/tests/general_functions/is_float_64bit.phpt @@ -129,17 +129,6 @@ foreach ($not_floats as $value ) { var_dump( is_real($value) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_float() ); -var_dump( is_double() ); -var_dump( is_real() ); - -//arguments more than expected -var_dump( is_float( $floats[0], $floats[1]) ); -var_dump( is_double( $floats[0], $floats[1]) ); -var_dump( is_real( $floats[0], $floats[1]) ); - echo "Done\n"; ?> --EXPECTF-- @@ -414,24 +403,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_int.phpt b/ext/standard/tests/general_functions/is_int.phpt index d154b30748..2f452cd48b 100644 --- a/ext/standard/tests/general_functions/is_int.phpt +++ b/ext/standard/tests/general_functions/is_int.phpt @@ -132,17 +132,6 @@ foreach ($not_int_types as $type ) { var_dump( is_long($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_int() ); -var_dump( is_integer() ); -var_dump( is_long() ); - -//arguments more than expected -var_dump( is_int(TRUE, FALSE) ); -var_dump( is_integer(TRUE, FALSE) ); -var_dump( is_long(TRUE, FALSE) ); - echo "Done\n"; // close the resources @@ -442,24 +431,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_int_64bit.phpt b/ext/standard/tests/general_functions/is_int_64bit.phpt index 68ef75b35b..ac919ced16 100644 --- a/ext/standard/tests/general_functions/is_int_64bit.phpt +++ b/ext/standard/tests/general_functions/is_int_64bit.phpt @@ -134,17 +134,6 @@ foreach ($not_int_types as $type ) { var_dump( is_long($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_int() ); -var_dump( is_integer() ); -var_dump( is_long() ); - -//arguments more than expected -var_dump( is_int(TRUE, FALSE) ); -var_dump( is_integer(TRUE, FALSE) ); -var_dump( is_long(TRUE, FALSE) ); - echo "Done\n"; ?> --EXPECTF-- @@ -439,24 +428,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_null.phpt b/ext/standard/tests/general_functions/is_null.phpt index fa7c87f791..5a3269a28a 100644 --- a/ext/standard/tests/general_functions/is_null.phpt +++ b/ext/standard/tests/general_functions/is_null.phpt @@ -127,13 +127,6 @@ foreach ($not_null_types as $type ) { var_dump( is_null($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_null() ); - -//arguments more than expected -var_dump( is_null(NULL, null) ); - echo "Done\n"; // close the resources used @@ -285,12 +278,4 @@ bool(false) bool(false) -- Iteration 59 -- bool(false) - -*** Testing error conditions *** - -Warning: is_null() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_null() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_numeric.phpt b/ext/standard/tests/general_functions/is_numeric.phpt index 0019cf18d2..509ee7e686 100644 --- a/ext/standard/tests/general_functions/is_numeric.phpt +++ b/ext/standard/tests/general_functions/is_numeric.phpt @@ -145,13 +145,6 @@ foreach ($not_numerics as $type ) { var_dump( is_numeric($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_numeric() ); - -//arguments more than expected -var_dump( is_numeric("10", "20") ); - echo "Done\n"; // close the resources used @@ -373,12 +366,4 @@ bool(false) bool(false) -- Iteration 29 -- bool(false) - -*** Testing error conditions *** - -Warning: is_numeric() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/is_object.phpt b/ext/standard/tests/general_functions/is_object.phpt index 8abc766376..2b5d1ae475 100644 --- a/ext/standard/tests/general_functions/is_object.phpt +++ b/ext/standard/tests/general_functions/is_object.phpt @@ -138,13 +138,6 @@ foreach ($not_objects as $type ) { var_dump( is_object($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_object() ); - -//arguments more than expected -var_dump( is_object($myClass_object, $myClass_object) ); - echo "Done\n"; // close the resources used @@ -216,12 +209,4 @@ bool(false) bool(false) -- Iteration 19 -- bool(false) - -*** Testing error conditions *** - -Warning: is_object() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_object() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_scalar.phpt b/ext/standard/tests/general_functions/is_scalar.phpt index 53620178c4..f7ef3f5317 100644 --- a/ext/standard/tests/general_functions/is_scalar.phpt +++ b/ext/standard/tests/general_functions/is_scalar.phpt @@ -105,14 +105,6 @@ foreach( $variation_array as $value ) { var_dump( is_scalar($value) ); } -echo "\n*** Testing error conditions ***\n"; -// Zero arguments -var_dump( is_scalar() ); - -// Arguments more than expected -var_dump( is_scalar( $scalar_variables[2], $scalar_variables[2]) ); -var_dump( is_scalar( new stdclass, new stdclass) ); - echo "Done\n"; // close the resources used @@ -226,15 +218,4 @@ bool(false) bool(false) -- Iteration 18 -- bool(false) - -*** Testing error conditions *** - -Warning: is_scalar() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/is_string.phpt b/ext/standard/tests/general_functions/is_string.phpt index 72a885a57a..d48fbd1729 100644 --- a/ext/standard/tests/general_functions/is_string.phpt +++ b/ext/standard/tests/general_functions/is_string.phpt @@ -140,13 +140,6 @@ foreach ($not_strings as $type ) { var_dump( is_string($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_string() ); - -//arguments more than expected -var_dump( is_string("string", "test") ); - echo "Done\n"; // close the resources used @@ -292,12 +285,4 @@ bool(false) bool(false) -- Iteration 45 -- bool(false) - -*** Testing error conditions *** - -Warning: is_string() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_string() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/ob_get_flush_error.phpt b/ext/standard/tests/general_functions/ob_get_flush_error.phpt index 0664043eba..5603e3d238 100644 --- a/ext/standard/tests/general_functions/ob_get_flush_error.phpt +++ b/ext/standard/tests/general_functions/ob_get_flush_error.phpt @@ -12,10 +12,6 @@ output_buffering=0 echo "*** Testing ob_get_flush() : error conditions ***\n"; -// One extra argument -$extra_arg = 10; -var_dump( ob_get_flush( $extra_arg ) ); - // No ob_start() executed var_dump( ob_get_flush() ); @@ -24,9 +20,6 @@ var_dump( ob_get_flush() ); --EXPECTF-- *** Testing ob_get_flush() : error conditions *** -Warning: ob_get_flush() expects exactly 0 parameters, 1 given in %s on line %d -NULL - Notice: ob_get_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/general_functions/ob_get_length_basic.phpt b/ext/standard/tests/general_functions/ob_get_length_basic.phpt index b3470bec55..75e22e7741 100644 --- a/ext/standard/tests/general_functions/ob_get_length_basic.phpt +++ b/ext/standard/tests/general_functions/ob_get_length_basic.phpt @@ -31,9 +31,6 @@ dump_string_length( ' lsf' ); dump_string_length( '' ); dump_string_length( null ); -// Extra argument -var_dump( ob_get_length( 'foobar' ) ); - ?> ===DONE=== --EXPECTF-- @@ -45,7 +42,4 @@ int(1) int(15) int(0) int(0) - -Warning: ob_get_length() expects exactly 0 parameters, 1 given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/parse_ini_file.phpt b/ext/standard/tests/general_functions/parse_ini_file.phpt index ebc714455d..14c1fc18ef 100644 --- a/ext/standard/tests/general_functions/parse_ini_file.phpt +++ b/ext/standard/tests/general_functions/parse_ini_file.phpt @@ -8,8 +8,6 @@ parse_ini_file() multiple calls $filename = dirname(__FILE__)."/parse_ini_file.dat"; @unlink($filename); /* Make sure the file really does not exist! */ -var_dump(parse_ini_file()); -var_dump(parse_ini_file(1,1,1,1)); var_dump(parse_ini_file($filename)); var_dump(parse_ini_file($filename, true)); @@ -121,16 +119,10 @@ var_dump(parse_ini_file($filename, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: parse_ini_file() expects at least 1 parameter, 0 given in %sparse_ini_file.php on line 6 +Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line %d bool(false) -Warning: parse_ini_file() expects at most 3 parameters, 4 given in %sparse_ini_file.php on line 7 -bool(false) - -Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 8 -bool(false) - -Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 9 +Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line %d bool(false) array(1) { ["test"]=> @@ -138,11 +130,11 @@ array(1) { } Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2 - in %sparse_ini_file.php on line 20 + in %sparse_ini_file.php on line %d bool(false) Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2 - in %sparse_ini_file.php on line 26 + in %sparse_ini_file.php on line %d bool(false) array(1) { ["test"]=> diff --git a/ext/standard/tests/general_functions/parse_ini_string_002.phpt b/ext/standard/tests/general_functions/parse_ini_string_002.phpt index 106cd0c842..384398cdb2 100644 --- a/ext/standard/tests/general_functions/parse_ini_string_002.phpt +++ b/ext/standard/tests/general_functions/parse_ini_string_002.phpt @@ -3,9 +3,6 @@ parse_ini_string() multiple calls --FILE-- <?php -var_dump(parse_ini_string()); -var_dump(parse_ini_string(1,1,1,1)); - $ini = " test = "; @@ -87,11 +84,6 @@ var_dump(parse_ini_string($ini, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: parse_ini_string() expects at least 1 parameter, 0 given in %s -bool(false) - -Warning: parse_ini_string() expects at most 3 parameters, 4 given in %s -bool(false) array(1) { ["test"]=> string(0) "" diff --git a/ext/standard/tests/general_functions/php_uname_error.phpt b/ext/standard/tests/general_functions/php_uname_error.phpt index 392e1c930e..ec5b2b5839 100644 --- a/ext/standard/tests/general_functions/php_uname_error.phpt +++ b/ext/standard/tests/general_functions/php_uname_error.phpt @@ -8,49 +8,15 @@ Test php_uname() function - error conditions - pass function incorrect argument echo "*** Testing php_uname() - error test\n"; -echo "\n-- Testing php_uname() function with more than expected no. of arguments --\n"; -var_dump( php_uname('a', true) ); - echo "\n-- Testing php_uname() function with invalid mode --\n"; // am invalid mode should result in same o/p as mode 'a' var_dump( php_uname('z') == php_uname('z') ); -class barClass { -} - -$fp = fopen(__FILE__, "r"); - -echo "\n-- Testing php_uname() function with invalid argument types --\n"; -var_dump(php_uname(array())); -var_dump(php_uname(array('color' => 'red', 'item' => 'pen'))); -var_dump(php_uname(new barClass())); -var_dump(php_uname($fp)); - -fclose($fp); ?> ===DONE=== --EXPECTF-- *** Testing php_uname() - error test --- Testing php_uname() function with more than expected no. of arguments -- - -Warning: php_uname() expects at most 1 parameter, 2 given in %s on line %d -NULL - -- Testing php_uname() function with invalid mode -- bool(true) - --- Testing php_uname() function with invalid argument types -- - -Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: php_uname() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: php_uname() expects parameter 1 to be string, resource given in %s on line %d -NULL ===DONE=== diff --git a/ext/standard/tests/general_functions/phpcredits.phpt b/ext/standard/tests/general_functions/phpcredits.phpt index 044232570e..dfcddc61f3 100644 --- a/ext/standard/tests/general_functions/phpcredits.phpt +++ b/ext/standard/tests/general_functions/phpcredits.phpt @@ -4,7 +4,6 @@ phpcredits() <?php var_dump(phpcredits()); -var_dump(phpcredits(array())); echo "--\n"; var_dump(phpcredits(0)); @@ -40,9 +39,6 @@ PHP Quality Assurance Team %wWebsites and Infrastructure team%w %a bool(true) - -Warning: phpcredits() expects parameter 1 to be int, array given in %sphpcredits.php on line 4 -NULL -- PHP Credits bool(true) diff --git a/ext/standard/tests/general_functions/phpcredits2.phpt b/ext/standard/tests/general_functions/phpcredits2.phpt index 9966f23a96..6aa023e919 100644 --- a/ext/standard/tests/general_functions/phpcredits2.phpt +++ b/ext/standard/tests/general_functions/phpcredits2.phpt @@ -6,7 +6,6 @@ dummy=x <?php var_dump(phpcredits()); -var_dump(phpcredits(array())); echo "--\n"; var_dump(phpcredits(0)); @@ -18,9 +17,6 @@ var_dump(phpcredits(CREDITS_GROUP)); --EXPECTF-- <!DOCTYPE %a>%s</html> bool(true) - -Warning: phpcredits() expects parameter 1 to be int, array given in %sphpcredits2.php on line 4 -NULL -- <h1>PHP Credits</h1> bool(true) diff --git a/ext/standard/tests/general_functions/phpinfo.phpt b/ext/standard/tests/general_functions/phpinfo.phpt index a805876aab..5f4d99ffba 100644 --- a/ext/standard/tests/general_functions/phpinfo.phpt +++ b/ext/standard/tests/general_functions/phpinfo.phpt @@ -5,9 +5,6 @@ phpinfo() var_dump(phpinfo()); echo "--\n"; -var_dump(phpinfo(array())); - -echo "--\n"; var_dump(phpinfo(0)); echo "--\n"; @@ -62,10 +59,6 @@ PHP License %A bool(true) -- - -Warning: phpinfo() expects parameter 1 to be int, array given in %sphpinfo.php on line 5 -NULL --- phpinfo() bool(true) -- diff --git a/ext/standard/tests/general_functions/phpinfo2.phpt b/ext/standard/tests/general_functions/phpinfo2.phpt index f422f923d9..5a36aa9d28 100644 --- a/ext/standard/tests/general_functions/phpinfo2.phpt +++ b/ext/standard/tests/general_functions/phpinfo2.phpt @@ -7,9 +7,6 @@ dummy=x var_dump(phpinfo()); echo "--\n"; -var_dump(phpinfo(array())); - -echo "--\n"; var_dump(phpinfo(0)); echo "--\n"; @@ -20,10 +17,6 @@ var_dump(phpinfo(INFO_LICENSE)); <!DOCTYPE %s> %a</html>bool(true) -- - -Warning: phpinfo() expects parameter 1 to be int, array given in %sphpinfo2.php on line 5 -NULL --- <!DOCTYPE %s> %a</html>bool(true) -- diff --git a/ext/standard/tests/general_functions/print_r.phpt b/ext/standard/tests/general_functions/print_r.phpt index fe02a97c18..15155fe0d2 100644 --- a/ext/standard/tests/general_functions/print_r.phpt +++ b/ext/standard/tests/general_functions/print_r.phpt @@ -271,24 +271,6 @@ $misc_values = array ( /* calling check_printr() to display miscelleneous data using print_r() */ check_printr($misc_values); -/* checking print_r() on functions */ -echo "\n*** Testing print_r() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -print_r( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump( print_r() ); - -//passing more than required no. of arguments -var_dump( print_r(123, true, "abc") ); - -// check when second arg is given other than boolean TRUE -var_dump( print_r ($value, "string") ); - /* closing resource handle used */ closedir($dir_handle); @@ -1714,23 +1696,4 @@ Array -- Iteration 4 -- - -*** Testing print_r() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -2 * 3 = 6 -Deprecated: Function create_function() is deprecated in %s on line %d - - -*** Testing error conditions *** - -Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - -Notice: Undefined variable: value in %s on line %d -string(0) "" Done diff --git a/ext/standard/tests/general_functions/print_r_64bit.phpt b/ext/standard/tests/general_functions/print_r_64bit.phpt index 5447a94db8..db5b92bf84 100644 --- a/ext/standard/tests/general_functions/print_r_64bit.phpt +++ b/ext/standard/tests/general_functions/print_r_64bit.phpt @@ -275,24 +275,6 @@ $misc_values = array ( /* calling check_printr() to display miscelleneous data using print_r() */ check_printr($misc_values); -/* checking print_r() on functions */ -echo "\n*** Testing print_r() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -print_r( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump( print_r() ); - -//passing more than required no. of arguments -var_dump( print_r(123, true, "abc") ); - -// check when second arg is given other than boolean TRUE -var_dump( print_r ($value, "string") ); - /* closing resource handle used */ closedir($dir_handle); @@ -1718,23 +1700,4 @@ Array -- Iteration 4 -- - -*** Testing print_r() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -2 * 3 = 6 -Deprecated: Function create_function() is deprecated in %s on line %d - - -*** Testing error conditions *** - -Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - -Notice: Undefined variable: value in %s on line %d -string(0) "" Done diff --git a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt index 87a4545501..37f8e17af2 100644 --- a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt +++ b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt @@ -8,10 +8,6 @@ if (!defined('PHP_WINDOWS_VERSION_MAJOR')) { die('skip: Only for Windows'); } -if (PHP_SAPI != 'cli') { - die('skip: Only for CLI'); -} - if (getenv('SKIP_SLOW_TESTS')) { doe('skip: Slow test'); } diff --git a/ext/standard/tests/general_functions/proc_open-mb0.phpt b/ext/standard/tests/general_functions/proc_open-mb0.phpt index 69c3dd53e5..3b832f6ea4 100644 --- a/ext/standard/tests/general_functions/proc_open-mb0.phpt +++ b/ext/standard/tests/general_functions/proc_open-mb0.phpt @@ -2,7 +2,6 @@ proc_open with bypass_shell subprocess parameter passing --SKIPIF-- <?php -if (php_sapi_name() != "cli") die('skip CLI only test'); if (!function_exists("proc_open")) echo "skip proc_open() is not available"; ?> --FILE-- diff --git a/ext/standard/tests/general_functions/proc_open-mb1.phpt b/ext/standard/tests/general_functions/proc_open-mb1.phpt index 2b922917f3..b91b44a739 100644 --- a/ext/standard/tests/general_functions/proc_open-mb1.phpt +++ b/ext/standard/tests/general_functions/proc_open-mb1.phpt @@ -2,7 +2,6 @@ proc_open without bypass_shell subprocess parameter passing --SKIPIF-- <?php -if (php_sapi_name() != "cli") die('skip CLI only test'); if (!function_exists("proc_open")) echo "skip proc_open() is not available"; ?> --FILE-- diff --git a/ext/standard/tests/general_functions/rand.phpt b/ext/standard/tests/general_functions/rand.phpt index e6639a71c7..73dec4eb75 100644 --- a/ext/standard/tests/general_functions/rand.phpt +++ b/ext/standard/tests/general_functions/rand.phpt @@ -4,60 +4,36 @@ rand() and mt_rand() tests <?php var_dump(mt_rand()); -var_dump(mt_rand(-1)); var_dump(mt_rand(-1,1)); var_dump(mt_rand(0,3)); var_dump(rand()); -var_dump(rand(-1)); var_dump(rand(-1,1)); var_dump(rand(0,3)); var_dump(srand()); var_dump(srand(-1)); -var_dump(srand(array())); var_dump(mt_srand()); var_dump(mt_srand(-1)); -var_dump(mt_srand(array())); var_dump(getrandmax()); -var_dump(getrandmax(1)); var_dump(mt_getrandmax()); -var_dump(mt_getrandmax(1)); echo "Done\n"; ?> --EXPECTF-- int(%d) - -Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line %d -NULL int(%i) int(%d) int(%d) - -Warning: rand() expects exactly 2 parameters, 1 given in %s on line %d -NULL int(%i) int(%d) NULL NULL - -Warning: srand() expects parameter 1 to be int, array given in %s on line %d -NULL -NULL NULL - -Warning: mt_srand() expects parameter 1 to be int, array given in %s on line %d NULL int(%d) - -Warning: getrandmax() expects exactly 0 parameters, 1 given in %s on line %d -NULL int(%d) - -Warning: mt_getrandmax() expects exactly 0 parameters, 1 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/sleep_error.phpt b/ext/standard/tests/general_functions/sleep_error.phpt index c4f069a3d2..3b46a35e5d 100644 --- a/ext/standard/tests/general_functions/sleep_error.phpt +++ b/ext/standard/tests/general_functions/sleep_error.phpt @@ -10,14 +10,6 @@ Test sleep() function : error conditions echo "*** Testing sleep() : error conditions ***\n"; -echo "\n-- Testing sleep() function with zero arguments --\n"; -var_dump( sleep() ); - -echo "\n-- Testing sleep() function with more than expected no. of arguments --\n"; -$seconds = 10; -$extra_arg = 10; -var_dump( sleep($seconds, $extra_arg) ); - echo "\n-- Testing sleep() function with negative interval --\n"; $seconds = -10; var_dump( sleep($seconds) ); @@ -27,16 +19,6 @@ var_dump( sleep($seconds) ); --EXPECTF-- *** Testing sleep() : error conditions *** --- Testing sleep() function with zero arguments -- - -Warning: sleep() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing sleep() function with more than expected no. of arguments -- - -Warning: sleep() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -- Testing sleep() function with negative interval -- Warning: sleep(): Number of seconds must be greater than or equal to 0 in %s on line %d diff --git a/ext/standard/tests/general_functions/strval.phpt b/ext/standard/tests/general_functions/strval.phpt index b814733dd0..0e513a3c47 100644 --- a/ext/standard/tests/general_functions/strval.phpt +++ b/ext/standard/tests/general_functions/strval.phpt @@ -141,13 +141,6 @@ foreach ($not_scalars as $value ) { var_dump( strval($value) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( strval() ); - -//arguments more than expected -var_dump( strval( $scalars[0], $scalars[1]) ); - echo "Done\n"; // close the resources used @@ -306,12 +299,4 @@ string(0) "" string(0) "" -- Iteration 11 -- string(0) "" - -*** Testing error conditions *** - -Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/sys_getloadavg.phpt b/ext/standard/tests/general_functions/sys_getloadavg.phpt index 5763084f70..1775978a12 100644 --- a/ext/standard/tests/general_functions/sys_getloadavg.phpt +++ b/ext/standard/tests/general_functions/sys_getloadavg.phpt @@ -7,14 +7,11 @@ if (!function_exists("sys_getloadavg")) die("skip"); --FILE-- <?php -var_dump(sys_getloadavg("")); var_dump(sys_getloadavg()); echo "Done\n"; ?> --EXPECTF-- -Warning: sys_getloadavg() expects exactly 0 parameters, %d given in %s -NULL array(3) { [0]=> float(%f) diff --git a/ext/standard/tests/general_functions/usleep_error.phpt b/ext/standard/tests/general_functions/usleep_error.phpt index 474aab7d5d..283e7f30e5 100644 --- a/ext/standard/tests/general_functions/usleep_error.phpt +++ b/ext/standard/tests/general_functions/usleep_error.phpt @@ -11,14 +11,6 @@ set_time_limit(20); echo "*** Testing usleep() : error conditions ***\n"; -echo "\n-- Testing usleep() function with zero arguments --\n"; -var_dump( usleep() ); - -echo "\n-- Testing usleep() function with more than expected no. of arguments --\n"; -$seconds = 10; -$extra_arg = 10; -var_dump( usleep($seconds, $extra_arg) ); - echo "\n-- Testing usleep() function with negative interval --\n"; $seconds = -10; var_dump( usleep($seconds) ); @@ -28,16 +20,6 @@ var_dump( usleep($seconds) ); --EXPECTF-- *** Testing usleep() : error conditions *** --- Testing usleep() function with zero arguments -- - -Warning: usleep() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing usleep() function with more than expected no. of arguments -- - -Warning: usleep() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -- Testing usleep() function with negative interval -- Warning: usleep(): Number of microseconds must be greater than or equal to 0 in %s on line %d diff --git a/ext/standard/tests/general_functions/var_dump.phpt b/ext/standard/tests/general_functions/var_dump.phpt index f0da840c3b..5de84c531e 100644 --- a/ext/standard/tests/general_functions/var_dump.phpt +++ b/ext/standard/tests/general_functions/var_dump.phpt @@ -274,18 +274,6 @@ echo "\n*** Testing var_dump() on multiple arguments ***\n"; var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources, $objects, $misc_values, $variations ); -/* checking var_dump() on functions */ -echo "\n*** Testing var_dump() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -var_dump( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump(); - /* closing resource handle used */ closedir($dir_handle); @@ -1561,17 +1549,4 @@ array(6) { string(5) "/00\7" } } - -*** Testing var_dump() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -string(9) "2 * 3 = 6" - -Deprecated: Function create_function() is deprecated in %s on line %d -string(9) " - -*** Testing error conditions *** - -Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d Done diff --git a/ext/standard/tests/general_functions/var_dump_64bit.phpt b/ext/standard/tests/general_functions/var_dump_64bit.phpt index a2476ef3f6..0815c9d62f 100644 --- a/ext/standard/tests/general_functions/var_dump_64bit.phpt +++ b/ext/standard/tests/general_functions/var_dump_64bit.phpt @@ -274,18 +274,6 @@ echo "\n*** Testing var_dump() on multiple arguments ***\n"; var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources, $objects, $misc_values, $variations ); -/* checking var_dump() on functions */ -echo "\n*** Testing var_dump() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -var_dump( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump(); - /* closing resource handle used */ closedir($dir_handle); @@ -1561,17 +1549,4 @@ array(6) { string(5) "/00\7" } } - -*** Testing var_dump() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -string(9) "2 * 3 = 6" - -Deprecated: Function create_function() is deprecated in %s on line %d -string(9) " - -*** Testing error conditions *** - -Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d Done diff --git a/ext/standard/tests/general_functions/var_export-locale.phpt b/ext/standard/tests/general_functions/var_export-locale.phpt index e8939f1d0a..52896eb788 100644 --- a/ext/standard/tests/general_functions/var_export-locale.phpt +++ b/ext/standard/tests/general_functions/var_export-locale.phpt @@ -300,14 +300,7 @@ echo "\n"; $counter++; } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_export( var_export() ); - -//arguments more than expected -var_export( var_export(TRUE, FALSE, TRUE) ); - -echo "\n\nDone"; +echo "\nDone"; ?> @@ -1135,11 +1128,4 @@ NULL string(4) "NULL" -*** Testing error conditions *** - -Warning: var_export() expects at least 1 parameter, 0 given in %s on line %d -NULL -Warning: var_export() expects at most 2 parameters, 3 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/image/getimagesize_variation2.phpt b/ext/standard/tests/image/getimagesize_variation2.phpt index eec2301c40..1bb515fe24 100644 --- a/ext/standard/tests/image/getimagesize_variation2.phpt +++ b/ext/standard/tests/image/getimagesize_variation2.phpt @@ -8,7 +8,7 @@ Test getimagesize() function : usage variations - unexpected type for arg 2 * Alias to functions: */ -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { +function test_error_handler($err_no, $err_msg, $filename, $linenum) { echo "Error: $err_no - $err_msg, $filename($linenum)\n"; } set_error_handler('test_error_handler'); diff --git a/ext/standard/tests/image/image_type_to_extension.phpt b/ext/standard/tests/image/image_type_to_extension.phpt index 8418a4b8c7..249df57943 100644 --- a/ext/standard/tests/image/image_type_to_extension.phpt +++ b/ext/standard/tests/image/image_type_to_extension.phpt @@ -29,12 +29,8 @@ image_type_to_extension() printf("Constant: %s\n\tWith dot: %s\n\tWithout dot: %s\n", $name, image_type_to_extension($constant), image_type_to_extension($constant, false)); } - var_dump(image_type_to_extension(-1, array())); - var_dump(image_type_to_extension(new stdclass)); var_dump(image_type_to_extension(1000000, NULL)); - var_dump(image_type_to_extension()); var_dump(image_type_to_extension(0)); - var_dump(image_type_to_extension(0, 0, 0)); ?> Done --EXPECTF-- @@ -89,18 +85,6 @@ Constant: IMAGETYPE_XBM Constant: IMAGETYPE_WEBP With dot: .webp Without dot: webp - -Warning: image_type_to_extension() expects parameter 2 to be bool, array given in %s on line %d -bool(false) - -Warning: image_type_to_extension() expects parameter 1 to be int, object given in %s on line %d -bool(false) bool(false) - -Warning: image_type_to_extension() expects at least 1 parameter, 0 given in %s on line %d -bool(false) -bool(false) - -Warning: image_type_to_extension() expects at most 2 parameters, 3 given in %s on line %d bool(false) Done diff --git a/ext/standard/tests/math/acos_variation.phpt b/ext/standard/tests/math/acos_variation.phpt index 5575ec5796..4fe8437fd5 100644 --- a/ext/standard/tests/math/acos_variation.phpt +++ b/ext/standard/tests/math/acos_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(NAN) float(NAN) float(NAN) float(NAN) - -Warning: acos() expects parameter 1 to be float, string given in %s on line %d -NULL float(NAN) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/acosh_variation.phpt b/ext/standard/tests/math/acosh_variation.phpt index cc89ce3e76..12200e035c 100644 --- a/ext/standard/tests/math/acosh_variation.phpt +++ b/ext/standard/tests/math/acosh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(3.828168471) float(3.828168471) float(3.847562739) float(3.847562739) - -Warning: acosh() expects parameter 1 to be float, string given in %s on line %d -NULL float(7.60090221) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/asin_variation.phpt b/ext/standard/tests/math/asin_variation.phpt index c8063849fd..c5d170e8db 100644 --- a/ext/standard/tests/math/asin_variation.phpt +++ b/ext/standard/tests/math/asin_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(NAN) float(NAN) float(NAN) float(NAN) - -Warning: asin() expects parameter 1 to be float, string given in %s on line %d -NULL float(NAN) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/asinh_variation.phpt b/ext/standard/tests/math/asinh_variation.phpt index 5e41a45900..2470f7d401 100644 --- a/ext/standard/tests/math/asinh_variation.phpt +++ b/ext/standard/tests/math/asinh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(3.829113652) float(3.829113652) float(3.848471992) float(3.848471992) - -Warning: asinh() expects parameter 1 to be float, string given in %s on line %d -NULL float(7.60090271) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/atan_variation.phpt b/ext/standard/tests/math/atan_variation.phpt index b6a9a9ec32..625b6d0b83 100644 --- a/ext/standard/tests/math/atan_variation.phpt +++ b/ext/standard/tests/math/atan_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1.527345431) float(1.527345431) float(1.528178225) float(1.528178225) - -Warning: atan() expects parameter 1 to be float, string given in %s on line %d -NULL float(1.569796327) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/atanh_variation.phpt b/ext/standard/tests/math/atanh_variation.phpt index 2b0a4b1085..f14406bb0d 100644 --- a/ext/standard/tests/math/atanh_variation.phpt +++ b/ext/standard/tests/math/atanh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(NAN) float(NAN) float(NAN) float(NAN) - -Warning: atanh() expects parameter 1 to be float, string given in %s on line %d -NULL float(NAN) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/base_convert_error.phpt b/ext/standard/tests/math/base_convert_error.phpt index f27d0a66cf..7e1a12c8bc 100644 --- a/ext/standard/tests/math/base_convert_error.phpt +++ b/ext/standard/tests/math/base_convert_error.phpt @@ -14,30 +14,18 @@ class classA { } -echo "Incorrect number of arguments\n"; -base_convert(); -base_convert(35); -base_convert(35,2); +echo "Incorrect input\n"; base_convert(1234, 1, 10); base_convert(1234, 10, 37); - -echo "Incorrect input\n"; base_convert(new classA(), 8, 10); ?> --EXPECTF-- *** Testing base_convert() : error conditions *** -Incorrect number of arguments - -Warning: base_convert() expects exactly 3 parameters, 0 given in %s on line %d - -Warning: base_convert() expects exactly 3 parameters, 1 given in %s on line %d - -Warning: base_convert() expects exactly 3 parameters, 2 given in %s on line %d +Incorrect input Warning: base_convert(): Invalid `from base' (1) in %s on line %d Warning: base_convert(): Invalid `to base' (37) in %s on line %d -Incorrect input Recoverable fatal error: Object of class classA could not be converted to string in %s on line %d diff --git a/ext/standard/tests/math/cos_variation.phpt b/ext/standard/tests/math/cos_variation.phpt index 6323042dc7..f9d1b26246 100644 --- a/ext/standard/tests/math/cos_variation.phpt +++ b/ext/standard/tests/math/cos_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(-0.5328330203) float(-0.5328330203) float(-0.1117112391) float(-0.1117112391) - -Warning: cos() expects parameter 1 to be float, string given in %s on line %d -NULL float(0.5623790763) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/cosh_variation.phpt b/ext/standard/tests/math/cosh_variation.phpt index cd64670668..ec58c0151f 100644 --- a/ext/standard/tests/math/cosh_variation.phpt +++ b/ext/standard/tests/math/cosh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(4872401723) float(4872401723) float(7641446995) float(7641446995) - -Warning: cosh() expects parameter 1 to be float, string given in %s on line %d -NULL float(INF) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/deg2rad_variation.phpt b/ext/standard/tests/math/deg2rad_variation.phpt index d5f6920ea7..eb3c7eae0e 100644 --- a/ext/standard/tests/math/deg2rad_variation.phpt +++ b/ext/standard/tests/math/deg2rad_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(0.401425728) float(0.401425728) float(0.4092797096) float(0.4092797096) - -Warning: deg2rad() expects parameter 1 to be float, string given in %s on line %d -NULL float(17.45329252) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/lcg_value_basic.phpt b/ext/standard/tests/math/lcg_value_basic.phpt index 44304f2475..7660f67c24 100644 --- a/ext/standard/tests/math/lcg_value_basic.phpt +++ b/ext/standard/tests/math/lcg_value_basic.phpt @@ -21,22 +21,6 @@ if ($i != 100) { echo "PASSED\n"; } -echo "\n lcg_value error cases..\n"; -$res = lcg_value(23); - -if (is_null($res)) { - echo "PASSED\n"; -} else { - echo "FAILED\n"; -} - -$res = lcg_value(10,false); -if (is_null($res)) { - echo "PASSED\n"; -} else { - echo "FAILED\n"; -} - echo "MATHS test script completed\n"; ?> @@ -45,12 +29,4 @@ MATHS test script started lcg_value tests... PASSED - - lcg_value error cases.. - -Warning: lcg_value() expects exactly 0 parameters, 1 given in %slcg_value_basic.php on line %d -PASSED - -Warning: lcg_value() expects exactly 0 parameters, 2 given in %slcg_value_basic.php on line %d -PASSED MATHS test script completed diff --git a/ext/standard/tests/math/log10_variation.phpt b/ext/standard/tests/math/log10_variation.phpt index 5304325952..8dbea47a84 100644 --- a/ext/standard/tests/math/log10_variation.phpt +++ b/ext/standard/tests/math/log10_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1.361727836) float(1.361727836) float(1.370142847) float(1.370142847) - -Warning: log10() expects parameter 1 to be float, string given in %s on line %d -NULL float(3) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/log_error.phpt b/ext/standard/tests/math/log_error.phpt index 48a23df3c0..7c305a4cba 100644 --- a/ext/standard/tests/math/log_error.phpt +++ b/ext/standard/tests/math/log_error.phpt @@ -4,13 +4,7 @@ Test log() - wrong params test log() precision=14 --FILE-- <?php -log(); -log(36,4,true); log(36, -4); ?> --EXPECTF-- -Warning: log() expects at least 1 parameter, 0 given in %s on line %d - -Warning: log() expects at most 2 parameters, 3 given in %s on line %d - Warning: log(): base must be greater than 0 in %s on line %d diff --git a/ext/standard/tests/math/rad2deg_variation.phpt b/ext/standard/tests/math/rad2deg_variation.phpt index 596a1940a4..6ea7d0c8a4 100644 --- a/ext/standard/tests/math/rad2deg_variation.phpt +++ b/ext/standard/tests/math/rad2deg_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1317.802929) float(1317.802929) float(1343.58603) float(1343.58603) - -Warning: rad2deg() expects parameter 1 to be float, string given in %s on line %d -NULL float(57295.77951) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/sin_variation.phpt b/ext/standard/tests/math/sin_variation.phpt index 5b635dfbdc..d044a16b40 100644 --- a/ext/standard/tests/math/sin_variation.phpt +++ b/ext/standard/tests/math/sin_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(-0.8462204042) float(-0.8462204042) float(-0.9937407102) float(-0.9937407102) - -Warning: sin() expects parameter 1 to be float, string given in %s on line %d -NULL float(0.8268795405) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/sinh_variation.phpt b/ext/standard/tests/math/sinh_variation.phpt index e47e94d629..5e576f447f 100644 --- a/ext/standard/tests/math/sinh_variation.phpt +++ b/ext/standard/tests/math/sinh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(4872401723) float(4872401723) float(7641446995) float(7641446995) - -Warning: sinh() expects parameter 1 to be float, string given in %s on line %d -NULL float(INF) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/sqrt_variation.phpt b/ext/standard/tests/math/sqrt_variation.phpt index 7369b98dfd..6e2304b437 100644 --- a/ext/standard/tests/math/sqrt_variation.phpt +++ b/ext/standard/tests/math/sqrt_variation.phpt @@ -22,7 +22,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -47,9 +46,6 @@ float(4.7958315233127) float(4.7958315233127) float(4.8425200051213) float(4.8425200051213) - -Warning: sqrt() expects parameter 1 to be float, string given in %s on line %d -NULL float(31.622776601684) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/tan_variation.phpt b/ext/standard/tests/math/tan_variation.phpt index 81546bbf6f..2c9ede4738 100644 --- a/ext/standard/tests/math/tan_variation.phpt +++ b/ext/standard/tests/math/tan_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1.588153083) float(1.588153083) float(8.895619796) float(8.895619796) - -Warning: tan() expects parameter 1 to be float, string given in %s on line %d -NULL float(1.470324156) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/math/tanh_variation.phpt b/ext/standard/tests/math/tanh_variation.phpt index b1b477c150..907f802b8a 100644 --- a/ext/standard/tests/math/tanh_variation.phpt +++ b/ext/standard/tests/math/tanh_variation.phpt @@ -21,7 +21,6 @@ $values = array(23, "23", "23.45", "2.345e1", - "nonsense", "1000", "1000ABC", null, @@ -44,9 +43,6 @@ float(1) float(1) float(1) float(1) - -Warning: tanh() expects parameter 1 to be float, string given in %s on line %d -NULL float(1) Notice: A non well formed numeric value encountered in %s on line %d diff --git a/ext/standard/tests/misc/get_browser_error.phpt b/ext/standard/tests/misc/get_browser_error.phpt index 049c8b9431..cf15e3c5ef 100644 --- a/ext/standard/tests/misc/get_browser_error.phpt +++ b/ext/standard/tests/misc/get_browser_error.phpt @@ -30,9 +30,6 @@ echo "*** Testing get_browser() : error functionality ***\n"; /* Unknown browser uses defaults. */ var_dump( get_browser( 'foobar', true ) ); -/* More than expected arguments */ -var_dump( get_browser( 'foobar', true, 15 ) ); - /* Some wrong parameters, no HTTP_USER_AGENT set */ var_dump( get_browser( null, 'foobar' ) ); @@ -111,9 +108,6 @@ array(34) { string(1) "0" } -Warning: get_browser() expects at most 2 parameters, 3 given in %s on line %d -NULL - Warning: get_browser(): HTTP_USER_AGENT variable is not set, cannot determine user agent name in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/network/fsockopen_error.phpt b/ext/standard/tests/network/fsockopen_error.phpt index 638412b47f..ea08335f2d 100644 --- a/ext/standard/tests/network/fsockopen_error.phpt +++ b/ext/standard/tests/network/fsockopen_error.phpt @@ -11,21 +11,6 @@ Test fsockopen() function : error conditions echo "*** Testing fsockopen() : basic error conditions ***\n"; - -echo "\n-- Testing fsockopen() function with more than expected no. of arguments --\n"; -$hostname = 'string_val'; -$port = 10; -$errno = 10; -$errstr = 'string_val'; -$timeout = 10.5; -$extra_arg = 10; -var_dump( fsockopen($hostname, $port, $errno, $errstr, $timeout, $extra_arg) ); -var_dump($errstr); -var_dump($errno); - -echo "\n-- Testing fsockopen() function with less than expected no. of arguments --\n"; -var_dump( fsockopen() ); - echo "\n-- Attempting to connect to a non-existent socket --\n"; $hostname = 'tcp://127.0.0.1'; // loopback address $port = 31337; @@ -49,18 +34,6 @@ echo "Done"; --EXPECTF-- *** Testing fsockopen() : basic error conditions *** --- Testing fsockopen() function with more than expected no. of arguments -- - -Warning: fsockopen() expects at most 5 parameters, 6 given in %s on line %d -bool(false) -string(10) "string_val" -int(10) - --- Testing fsockopen() function with less than expected no. of arguments -- - -Warning: fsockopen() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -- Attempting to connect to a non-existent socket -- Warning: fsockopen(): unable to connect to tcp://127.0.0.1:31337 (%a) in %s on line %d diff --git a/ext/standard/tests/network/gethostbyaddr_error.phpt b/ext/standard/tests/network/gethostbyaddr_error.phpt index f7982d5ca4..a33a71185f 100644 --- a/ext/standard/tests/network/gethostbyaddr_error.phpt +++ b/ext/standard/tests/network/gethostbyaddr_error.phpt @@ -11,16 +11,6 @@ Test gethostbyaddr() function : error conditions echo "Testing gethostbyaddr : error conditions\n"; -// Zero arguments -echo "\n-- Testing gethostbyaddr function with Zero arguments --\n"; -var_dump( gethostbyaddr() ); - -//Test gethostbyaddr with one more than the expected number of arguments -echo "\n-- Testing gethostbyaddr function with more than expected no. of arguments --\n"; -$ip_address = 'string_val'; -$extra_arg = 10; -var_dump( gethostbyaddr($ip_address, $extra_arg) ); - echo "\n-- Testing gethostbyaddr function with invalid addresses --\n"; $ip_address = 'invalid'; @@ -37,16 +27,6 @@ echo "Done"; --EXPECTREGEX-- Testing gethostbyaddr : error conditions --- Testing gethostbyaddr function with Zero arguments -- - -Warning: gethostbyaddr\(\) expects exactly 1 parameter, 0 given in .* on line \d+ -NULL - --- Testing gethostbyaddr function with more than expected no. of arguments -- - -Warning: gethostbyaddr\(\) expects exactly 1 parameter, 2 given in .* on line \d+ -NULL - -- Testing gethostbyaddr function with invalid addresses -- Warning: gethostbyaddr\(\): Address is not (in a.b.c.d form|a valid IPv4 or IPv6 address) in .* on line \d+ diff --git a/ext/standard/tests/network/gethostname.phpt b/ext/standard/tests/network/gethostname.phpt index e7caaf48eb..57f4c498d0 100644 --- a/ext/standard/tests/network/gethostname.phpt +++ b/ext/standard/tests/network/gethostname.phpt @@ -5,10 +5,6 @@ marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao p --FILE-- <?php var_dump(gethostname()); -var_dump(gethostname("php-zend-brazil")); ?> --EXPECTF-- -%s - -Warning: gethostname() expects exactly %d parameters, %d given in %s on line %d -NULL +string(%d) "%s" diff --git a/ext/standard/tests/network/getprotobyname_error.phpt b/ext/standard/tests/network/getprotobyname_error.phpt index 7ee366ac7a..52ef3b8ee0 100644 --- a/ext/standard/tests/network/getprotobyname_error.phpt +++ b/ext/standard/tests/network/getprotobyname_error.phpt @@ -4,13 +4,8 @@ getprotobyname function errors test edgarsandi - <edgar.r.sandi@gmail.com> --FILE-- <?php - // empty protocol name - var_dump(getprotobyname()); - - // invalid protocol name - var_dump(getprotobyname('abc')); +// invalid protocol name +var_dump(getprotobyname('abc')); ?> ---EXPECTF-- -Warning: getprotobyname() expects exactly 1 parameter, 0 given in %s on line %d -NULL +--EXPECT-- bool(false) diff --git a/ext/standard/tests/network/getprotobynumber_error.phpt b/ext/standard/tests/network/getprotobynumber_error.phpt index 7df12e864a..dda2661b5a 100644 --- a/ext/standard/tests/network/getprotobynumber_error.phpt +++ b/ext/standard/tests/network/getprotobynumber_error.phpt @@ -4,13 +4,8 @@ getprotobynumber function errors test edgarsandi - <edgar.r.sandi@gmail.com> --FILE-- <?php - // empty protocol number - var_dump(getprotobynumber()); - - // invalid protocol number - var_dump(getprotobynumber(999)); +// invalid protocol number +var_dump(getprotobynumber(999)); ?> ---EXPECTF-- -Warning: getprotobynumber() expects exactly 1 parameter, 0 given in %s on line %d -NULL +--EXPECT-- bool(false) diff --git a/ext/standard/tests/network/inet.phpt b/ext/standard/tests/network/inet.phpt index a1e70a0020..81db0016b5 100644 --- a/ext/standard/tests/network/inet.phpt +++ b/ext/standard/tests/network/inet.phpt @@ -14,12 +14,10 @@ var_dump(inet_ntop($packed)); $packed = chr(255) . chr(255) . chr(255) . chr(0); var_dump(inet_ntop($packed)); -var_dump(inet_ntop()); var_dump(inet_ntop(-1)); var_dump(inet_ntop("")); var_dump(inet_ntop("blah-blah")); -var_dump(inet_pton()); var_dump(inet_pton("")); var_dump(inet_pton(-1)); var_dump(inet_pton("abra")); @@ -40,15 +38,9 @@ echo "Done\n"; --EXPECTF-- string(9) "127.0.0.1" string(13) "255.255.255.0" - -Warning: inet_ntop() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) bool(false) bool(false) bool(false) - -Warning: inet_pton() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) bool(false) bool(false) bool(false) diff --git a/ext/standard/tests/network/ip.phpt b/ext/standard/tests/network/ip.phpt index 5237c89776..831eee018a 100644 --- a/ext/standard/tests/network/ip.phpt +++ b/ext/standard/tests/network/ip.phpt @@ -21,16 +21,11 @@ foreach ($array as $ip) { var_dump(long2ip($long)); } -var_dump(ip2long()); var_dump(ip2long("")); var_dump(ip2long("777.777.777.777")); var_dump(ip2long("111.111.111.111")); -var_dump(ip2long(array())); -var_dump(long2ip()); var_dump(long2ip(-110000)); -var_dump(long2ip("")); -var_dump(long2ip(array())); echo "Done\n"; ?> @@ -47,23 +42,8 @@ int(0) string(7) "0.0.0.0" int(1118019956) string(14) "66.163.161.116" - -Warning: ip2long() expects exactly 1 parameter, 0 given in %sip.php on line %d -NULL bool(false) bool(false) int(1869573999) - -Warning: ip2long() expects parameter 1 to be string, array given in %sip.php on line %d -NULL - -Warning: long2ip() expects exactly 1 parameter, 0 given in %sip.php on line %d -NULL string(13) "255.254.82.80" - -Warning: long2ip() expects parameter 1 to be int, string given in %sip.php on line %d -NULL - -Warning: long2ip() expects parameter 1 to be int, array given in %sip.php on line %d -NULL Done diff --git a/ext/standard/tests/network/ip_x86_64.phpt b/ext/standard/tests/network/ip_x86_64.phpt index 3c530b8371..06ed1549a6 100644 --- a/ext/standard/tests/network/ip_x86_64.phpt +++ b/ext/standard/tests/network/ip_x86_64.phpt @@ -21,16 +21,11 @@ foreach ($array as $ip) { var_dump(long2ip($long)); } -var_dump(ip2long()); var_dump(ip2long("")); var_dump(ip2long("777.777.777.777")); var_dump(ip2long("111.111.111.111")); -var_dump(ip2long(array())); -var_dump(long2ip()); var_dump(long2ip(-110000)); -var_dump(long2ip("")); -var_dump(long2ip(array())); echo "Done\n"; ?> @@ -47,23 +42,8 @@ int(0) string(7) "0.0.0.0" int(1118019956) string(14) "66.163.161.116" - -Warning: ip2long() expects exactly 1 parameter, 0 given in %sip_x86_64.php on line %d -NULL bool(false) bool(false) int(1869573999) - -Warning: ip2long() expects parameter 1 to be string, array given in %sip_x86_64.php on line %d -NULL - -Warning: long2ip() expects exactly 1 parameter, 0 given in %sip_x86_64.php on line %d -NULL string(13) "255.254.82.80" - -Warning: long2ip() expects parameter 1 to be int, string given in %sip_x86_64.php on line %d -NULL - -Warning: long2ip() expects parameter 1 to be int, array given in %sip_x86_64.php on line %d -NULL Done diff --git a/ext/standard/tests/password/password_bcrypt_errors.phpt b/ext/standard/tests/password/password_bcrypt_errors.phpt index a0826080e6..64496744cb 100644 --- a/ext/standard/tests/password/password_bcrypt_errors.phpt +++ b/ext/standard/tests/password/password_bcrypt_errors.phpt @@ -8,14 +8,6 @@ var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => 3))); var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => 32))); -var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => "foo"))); - -var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => "123456789012345678901"))); - -var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => 123))); - -var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => "foo"))); - ?> --EXPECTF-- Warning: password_hash(): Invalid bcrypt cost parameter specified: 3 in %s on line %d @@ -23,21 +15,3 @@ NULL Warning: password_hash(): Invalid bcrypt cost parameter specified: 32 in %s on line %d NULL - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d - -Warning: password_hash(): Provided salt is too short: 3 expecting 22 in %s on line %d -NULL - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d - -Warning: password_hash(): Provided salt is too short: 21 expecting 22 in %s on line %d -NULL - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d - -Warning: password_hash(): Provided salt is too short: 3 expecting 22 in %s on line %d -NULL - -Warning: password_hash(): Invalid bcrypt cost parameter specified: 0 in %s on line %d -NULL diff --git a/ext/standard/tests/password/password_deprecated_salts.phpt b/ext/standard/tests/password/password_deprecated_salts.phpt deleted file mode 100644 index c173401067..0000000000 --- a/ext/standard/tests/password/password_deprecated_salts.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Test deprecated operation of password_hash() ---FILE-- -<?php -//-=-=-=- - - -var_dump(password_hash("rasmuslerdorf", PASSWORD_BCRYPT, array("cost" => 7, "salt" => "usesomesillystringforsalt"))); - -var_dump(password_hash("test", PASSWORD_BCRYPT, array("salt" => "123456789012345678901" . chr(0)))); - -echo "OK!"; -?> ---EXPECTF-- -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d -string(60) "$2y$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi" - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d -string(60) "$2y$10$MTIzNDU2Nzg5MDEyMzQ1Nej0NmcAWSLR.oP7XOR9HD/vjUuOj100y" -OK! diff --git a/ext/standard/tests/password/password_hash_error.phpt b/ext/standard/tests/password/password_hash_error.phpt index 6416eca91b..04a8249ced 100644 --- a/ext/standard/tests/password/password_hash_error.phpt +++ b/ext/standard/tests/password/password_hash_error.phpt @@ -4,30 +4,31 @@ Test error operation of password_hash() <?php //-=-=-=- -var_dump(password_hash()); - -var_dump(password_hash("foo")); +try { + var_dump(password_hash("foo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(password_hash("foo", array())); var_dump(password_hash("foo", 19, new StdClass)); -var_dump(password_hash("foo", PASSWORD_BCRYPT, "baz")); - -var_dump(password_hash(array(), PASSWORD_BCRYPT)); +try { + var_dump(password_hash("foo", PASSWORD_BCRYPT, "baz")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} -var_dump(password_hash("123", PASSWORD_BCRYPT, array("salt" => array()))); - -/* Non-string salt, checking for memory leaks */ -var_dump(password_hash('123', PASSWORD_BCRYPT, array('salt' => 1234))); +try { + var_dump(password_hash(array(), PASSWORD_BCRYPT)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- -Warning: password_hash() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: password_hash() expects at least 2 parameters, 1 given in %s on line %d -NULL +password_hash() expects at least 2 parameters, 1 given Notice: Array to string conversion in %s on line %d @@ -36,19 +37,5 @@ NULL Warning: password_hash(): Unknown password hashing algorithm: 19 in %s on line %d NULL - -Warning: password_hash() expects parameter 3 to be array, string given in %s on line %d -NULL - -Warning: password_hash() expects parameter 1 to be string, array given in %s on line %d -NULL - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d - -Warning: password_hash(): Non-string salt parameter supplied in %s on line %d -NULL - -Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d - -Warning: password_hash(): Provided salt is too short: 4 expecting 22 in %s on line %d -NULL +password_hash() expects parameter 3 to be array, string given +password_hash() expects parameter 1 to be string, array given diff --git a/ext/standard/tests/password/password_needs_rehash_error.phpt b/ext/standard/tests/password/password_needs_rehash_error.phpt index 7180d11de7..f64723ee85 100644 --- a/ext/standard/tests/password/password_needs_rehash_error.phpt +++ b/ext/standard/tests/password/password_needs_rehash_error.phpt @@ -3,29 +3,32 @@ Test error operation of password_needs_rehash() --FILE-- <?php //-=-=-=- -var_dump(password_needs_rehash()); -var_dump(password_needs_rehash('')); +try { + var_dump(password_needs_rehash('')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(password_needs_rehash('', [])); -var_dump(password_needs_rehash(array(), PASSWORD_BCRYPT)); +try { + var_dump(password_needs_rehash(array(), PASSWORD_BCRYPT)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} -var_dump(password_needs_rehash("", PASSWORD_BCRYPT, "foo")); +try { + var_dump(password_needs_rehash("", PASSWORD_BCRYPT, "foo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "OK!"; ?> --EXPECTF-- -Warning: password_needs_rehash() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: password_needs_rehash() expects at least 2 parameters, 1 given in %s on line %d -NULL +password_needs_rehash() expects at least 2 parameters, 1 given bool(false) - -Warning: password_needs_rehash() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: password_needs_rehash() expects parameter 3 to be array, string given in %s on line %d -NULL +password_needs_rehash() expects parameter 1 to be string, array given +password_needs_rehash() expects parameter 3 to be array, string given OK! diff --git a/ext/standard/tests/password/password_removed_salt_option.phpt b/ext/standard/tests/password/password_removed_salt_option.phpt new file mode 100644 index 0000000000..356bdec3e8 --- /dev/null +++ b/ext/standard/tests/password/password_removed_salt_option.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test removed support for explicit salt option +--FILE-- +<?php +//-=-=-=- + + +var_dump(strlen(password_hash("rasmuslerdorf", PASSWORD_BCRYPT, array("cost" => 7, "salt" => "usesomesillystringforsalt")))); + +var_dump(strlen(password_hash("test", PASSWORD_BCRYPT, array("salt" => "123456789012345678901" . chr(0))))); + +echo "OK!"; +?> +--EXPECTF-- +Warning: password_hash(): The 'salt' option is no longer supported. The provided salt has been been ignored in %s on line %d +int(60) + +Warning: password_hash(): The 'salt' option is no longer supported. The provided salt has been been ignored in %s on line %d +int(60) +OK! diff --git a/ext/standard/tests/password/password_verify_error.phpt b/ext/standard/tests/password/password_verify_error.phpt index 7f680af448..192a4ae288 100644 --- a/ext/standard/tests/password/password_verify_error.phpt +++ b/ext/standard/tests/password/password_verify_error.phpt @@ -4,14 +4,12 @@ Test error operation of password_verify() <?php //-=-=-=- -var_dump(password_verify()); - -var_dump(password_verify("foo")); +try { + var_dump(password_verify("foo")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: password_verify() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) - -Warning: password_verify() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) +--EXPECT-- +password_verify() expects exactly 2 parameters, 1 given diff --git a/ext/standard/tests/streams/bug46426.phpt b/ext/standard/tests/streams/bug46426.phpt index 8c95ea456e..b69c6c557b 100644 --- a/ext/standard/tests/streams/bug46426.phpt +++ b/ext/standard/tests/streams/bug46426.phpt @@ -21,8 +21,6 @@ echo stream_get_contents($tmp, 1, 0); echo "\n"; echo stream_get_contents($tmp, -1); -@unlink($tmp); - ?> --EXPECT-- 23 diff --git a/ext/standard/tests/streams/stream_get_contents_001.phpt b/ext/standard/tests/streams/stream_get_contents_001.phpt index dc7fcb239c..6f5abcb782 100644 --- a/ext/standard/tests/streams/stream_get_contents_001.phpt +++ b/ext/standard/tests/streams/stream_get_contents_001.phpt @@ -12,8 +12,6 @@ echo stream_get_contents($tmp, 2), "--\n"; echo stream_get_contents($tmp, 2, 3), "--\n"; echo stream_get_contents($tmp, 2, -1), "--\n"; -@unlink($tmp); - ?> --EXPECT-- -- diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt index bb98d7c6e7..5530322fec 100644 --- a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt +++ b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt @@ -10,21 +10,6 @@ Test stream_get_meta_data() function : error conditions echo "*** Testing stream_get_meta_data() : error conditions ***\n"; -// Zero arguments -echo "\n-- Testing stream_get_meta_data() function with Zero arguments --\n"; -var_dump( stream_get_meta_data() ); - -//Test stream_get_meta_data with one more than the expected number of arguments -echo "\n-- Testing stream_get_meta_data() function with more than expected no. of arguments --\n"; - -$fp = null; -$extra_arg = 10; -var_dump( stream_get_meta_data($fp, $extra_arg) ); - -echo "\n-- Testing stream_get_meta_data() function with invalid stream resource --\n"; -$fp = null; -var_dump(stream_get_meta_data($fp)); - echo "\n-- Testing stream_get_meta_data() function with closed stream resource --\n"; $fp = fopen(__FILE__, 'r'); fclose($fp); @@ -35,21 +20,6 @@ echo "Done"; --EXPECTF-- *** Testing stream_get_meta_data() : error conditions *** --- Testing stream_get_meta_data() function with Zero arguments -- - -Warning: stream_get_meta_data() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing stream_get_meta_data() function with more than expected no. of arguments -- - -Warning: stream_get_meta_data() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Testing stream_get_meta_data() function with invalid stream resource -- - -Warning: stream_get_meta_data() expects parameter 1 to be resource, null given in %s on line %d -NULL - -- Testing stream_get_meta_data() function with closed stream resource -- Warning: stream_get_meta_data(): supplied resource is not a valid stream resource in %s on line %d diff --git a/ext/standard/tests/streams/stream_resolve_include_path.phpt b/ext/standard/tests/streams/stream_resolve_include_path.phpt index 4109b5672e..f77c0730f3 100644 --- a/ext/standard/tests/streams/stream_resolve_include_path.phpt +++ b/ext/standard/tests/streams/stream_resolve_include_path.phpt @@ -14,8 +14,6 @@ mkdir($include_path_nested); file_put_contents($include_path_file, 'include_path'); file_put_contents($include_path_nested_file, 'include_path'); -var_dump(stream_resolve_include_path()); - set_include_path($include_path . PATH_SEPARATOR . $include_path_nested); var_dump(stream_resolve_include_path('file-does-not-exist')); @@ -24,13 +22,20 @@ var_dump(stream_resolve_include_path('file')); set_include_path($include_path_nested . PATH_SEPARATOR . $include_path); var_dump(stream_resolve_include_path('file')); +?> +--CLEAN-- +<?php +$include_path = __DIR__ . '/test_path'; +$include_path_nested = $include_path . '/nested'; +$include_path_file = $include_path . DIRECTORY_SEPARATOR . 'file'; +$include_path_nested_file = $include_path_nested . DIRECTORY_SEPARATOR . 'file'; + unlink($include_path_nested_file); rmdir($include_path_nested); unlink($include_path_file); rmdir($include_path); +?> --EXPECTF-- -Warning: stream_resolve_include_path() expects exactly 1 parameter, 0 given in %s on line %d -NULL bool(false) string(%d) "%stest_path%sfile" string(%d) "%stest_path%snested%sfile" diff --git a/ext/standard/tests/streams/stream_set_chunk_size.phpt b/ext/standard/tests/streams/stream_set_chunk_size.phpt index 8c2ae9865b..851fd2cfcf 100644 --- a/ext/standard/tests/streams/stream_set_chunk_size.phpt +++ b/ext/standard/tests/streams/stream_set_chunk_size.phpt @@ -51,7 +51,6 @@ var_dump(strlen(fwrite($f, str_repeat('b', 250)))); echo "\nerror conditions\n"; var_dump(stream_set_chunk_size($f, 0)); var_dump(stream_set_chunk_size($f, -1)); -var_dump(stream_set_chunk_size($f, array())); --EXPECTF-- bool(true) should return previous chunk size (8192) @@ -87,6 +86,3 @@ bool(false) Warning: stream_set_chunk_size(): The chunk size must be a positive integer, given -1 in %s on line %d bool(false) - -Warning: stream_set_chunk_size() expects parameter 2 to be int, array given in %s on line %d -bool(false) diff --git a/ext/standard/tests/streams/stream_set_timeout_error.phpt b/ext/standard/tests/streams/stream_set_timeout_error.phpt index 0334b951e0..6c5b992dd5 100644 --- a/ext/standard/tests/streams/stream_set_timeout_error.phpt +++ b/ext/standard/tests/streams/stream_set_timeout_error.phpt @@ -10,9 +10,6 @@ Test stream_set_timeout() function : error conditions echo "*** Testing stream_set_timeout() : error conditions ***\n"; -//Test stream_set_timeout with one more than the expected number of arguments -echo "\n-- Testing stream_set_timeout() function with more than expected no. of arguments --\n"; - for ($i=0; $i<100; $i++) { $port = rand(10000, 65000); /* Setup socket server */ @@ -26,23 +23,11 @@ $client = fsockopen("tcp://127.0.0.1:$port"); $seconds = 10; $microseconds = 10; -$extra_arg = 10; -var_dump( stream_set_timeout($client, $seconds, $microseconds, $extra_arg) ); - -// Testing stream_set_timeout with one less than the expected number of arguments -echo "\n-- Testing stream_set_timeout() function with less than expected no. of arguments --\n"; - -$seconds = 10; -var_dump( stream_set_timeout($client) ); - echo "\n-- Testing stream_set_timeout() function with a closed socket --\n"; fclose($client); var_dump( stream_set_timeout($client, $seconds) ); -echo "\n-- Testing stream_set_timeout() function with an invalid stream --\n"; -var_dump( stream_set_timeout($seconds, $seconds) ); - echo "\n-- Testing stream_set_timeout() function with a stream that does not support timeouts --\n"; $filestream = fopen(__FILE__, "r"); var_dump( stream_set_timeout($filestream, $seconds) ); @@ -55,26 +40,11 @@ echo "Done"; --EXPECTF-- *** Testing stream_set_timeout() : error conditions *** --- Testing stream_set_timeout() function with more than expected no. of arguments -- - -Warning: stream_set_timeout() expects at most 3 parameters, 4 given in %s on line %d -NULL - --- Testing stream_set_timeout() function with less than expected no. of arguments -- - -Warning: stream_set_timeout() expects at least 2 parameters, 1 given in %s on line %d -NULL - -- Testing stream_set_timeout() function with a closed socket -- Warning: stream_set_timeout(): supplied resource is not a valid stream resource in %s on line %d bool(false) --- Testing stream_set_timeout() function with an invalid stream -- - -Warning: stream_set_timeout() expects parameter 1 to be resource, int given in %s on line %d -NULL - -- Testing stream_set_timeout() function with a stream that does not support timeouts -- bool(false) Done diff --git a/ext/standard/tests/streams/stream_socket_sendto.phpt b/ext/standard/tests/streams/stream_socket_sendto.phpt index 2812d30930..ab223f4314 100644 --- a/ext/standard/tests/streams/stream_socket_sendto.phpt +++ b/ext/standard/tests/streams/stream_socket_sendto.phpt @@ -16,8 +16,6 @@ $sock = stream_socket_server($serverUri, $errno, $errstr); if (is_resource($sock)) { fwrite($sock, $stringFWrite); - var_dump(stream_socket_sendto()); - var_dump(stream_socket_sendto($sock)); var_dump(stream_socket_sendto($sock, $stringSocket)); var_dump(stream_socket_sendto($sock, $stringSocket, STREAM_OOB)); var_dump(stream_socket_sendto($sock, $stringSocket, STREAM_OOB, $serverUri)); @@ -29,12 +27,6 @@ if (is_resource($sock)) { --EXPECTF-- Notice: fwrite(): send of %i bytes failed with errno=%i Broken pipe in %s on line %d -Warning: stream_socket_sendto() expects at least %i parameters, %i given in %s on line %d -bool(%s) - -Warning: stream_socket_sendto() expects at least %i parameters, %i given in %s on line %d -bool(%s) - Warning: stream_socket_sendto(): Broken pipe in %s on line %d int(%i) diff --git a/ext/standard/tests/strings/addcslashes_001.phpt b/ext/standard/tests/strings/addcslashes_001.phpt Binary files differindex 4080c7214d..5b60f6168d 100644 --- a/ext/standard/tests/strings/addcslashes_001.phpt +++ b/ext/standard/tests/strings/addcslashes_001.phpt diff --git a/ext/standard/tests/strings/bug24208.phpt b/ext/standard/tests/strings/bug24208.phpt deleted file mode 100644 index f85c9c1e54..0000000000 --- a/ext/standard/tests/strings/bug24208.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Bug #24208 (parse_str() is not working) ---FILE-- -<?php -$a = $b = $c = "oops"; -parse_str("a=1&b=2&c=3"); -var_dump($a, $b, $c); -?> ---EXPECTF-- -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d -string(1) "1" -string(1) "2" -string(1) "3" diff --git a/ext/standard/tests/strings/bug37262.phpt b/ext/standard/tests/strings/bug37262.phpt index b964c4a659..92abb29206 100644 --- a/ext/standard/tests/strings/bug37262.phpt +++ b/ext/standard/tests/strings/bug37262.phpt @@ -2,9 +2,7 @@ Bug #37262 (var_export() does not escape \0 character) --FILE-- <?php -$func = create_function('$a', 'return $a;'); -var_export($func); +var_export("foo\0bar"); ?> ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -'' . "\0" . 'lambda_%d' +--EXPECT-- +'foo' . "\0" . 'bar' diff --git a/ext/standard/tests/strings/bug54322.phpt b/ext/standard/tests/strings/bug54322.phpt index 6b8d10daa7..f31f94fd84 100644 --- a/ext/standard/tests/strings/bug54322.phpt +++ b/ext/standard/tests/strings/bug54322.phpt @@ -2,9 +2,11 @@ Bug #54322: Null pointer deref in get_html_translation_table due to information loss in long-to-int conversion --FILE-- <?php -var_dump( -get_html_translation_table(NAN, 0, "UTF-8") > 0 -); ---EXPECTF-- -Warning: get_html_translation_table() expects parameter 1 to be int, float given in %s on line %d -bool(false) +try { + var_dump(get_html_translation_table(NAN, 0, "UTF-8") > 0); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +?> +--EXPECT-- +get_html_translation_table() expects parameter 1 to be int, float given diff --git a/ext/standard/tests/strings/bug77439.phpt b/ext/standard/tests/strings/bug77439.phpt index ee8a3d2845..98ae56222b 100644 --- a/ext/standard/tests/strings/bug77439.phpt +++ b/ext/standard/tests/strings/bug77439.phpt @@ -2,12 +2,11 @@ Bug #77439: parse_str segfaults when inserting item into existing array --FILE-- <?php -$a = []; -parse_str('a[1]=1'); -var_dump($a); +$vars = ['a' => []]; +parse_str('a[1]=1', $vars); +var_dump($vars['a']); ?> ---EXPECTF-- -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d +--EXPECT-- array(1) { [1]=> string(1) "1" diff --git a/ext/standard/tests/strings/chr_error.phpt b/ext/standard/tests/strings/chr_error.phpt index d5fb974559..7f089ac5b5 100644 --- a/ext/standard/tests/strings/chr_error.phpt +++ b/ext/standard/tests/strings/chr_error.phpt @@ -11,11 +11,19 @@ Test chr() function : error conditions echo "*** Testing chr() : error conditions ***\n"; echo "\n-- Testing chr() function with no arguments --\n"; -var_dump( chr() ); +try { + var_dump( chr() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing chr() function with more than expected no. of arguments --\n"; $extra_arg = 10; -var_dump( chr(72, $extra_arg) ); +try { + var_dump( chr(72, $extra_arg) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== @@ -23,12 +31,8 @@ var_dump( chr(72, $extra_arg) ); *** Testing chr() : error conditions *** -- Testing chr() function with no arguments -- - -Warning: Wrong parameter count for chr() in %s on line %d -NULL +Wrong parameter count for chr() -- Testing chr() function with more than expected no. of arguments -- - -Warning: Wrong parameter count for chr() in %s on line %d -NULL +Wrong parameter count for chr() ===DONE=== diff --git a/ext/standard/tests/strings/chr_ord.phpt b/ext/standard/tests/strings/chr_ord.phpt Binary files differindex be0b1a32da..43e31a20f3 100644 --- a/ext/standard/tests/strings/chr_ord.phpt +++ b/ext/standard/tests/strings/chr_ord.phpt diff --git a/ext/standard/tests/strings/chunk_split_variation5.phpt b/ext/standard/tests/strings/chunk_split_variation5.phpt Binary files differindex 8a5a8cd6bb..8650f2cb92 100644 --- a/ext/standard/tests/strings/chunk_split_variation5.phpt +++ b/ext/standard/tests/strings/chunk_split_variation5.phpt diff --git a/ext/standard/tests/strings/chunk_split_variation8.phpt b/ext/standard/tests/strings/chunk_split_variation8.phpt index bfafd1af0b..9804ee21e1 100644 --- a/ext/standard/tests/strings/chunk_split_variation8.phpt +++ b/ext/standard/tests/strings/chunk_split_variation8.phpt @@ -46,7 +46,11 @@ $values = array ( // loop through each element of values for 'chunklen' for($count = 0; $count < count($values); $count++) { echo "-- Iteration ".($count+1). " --\n"; - var_dump( chunk_split($heredoc_str, $values[$count], $ending) ); + try { + var_dump( chunk_split($heredoc_str, $values[$count], $ending) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } echo "Done" @@ -82,9 +86,7 @@ string(129) "This's heredoc string with and It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test chunk_split():::" -- Iteration 7 -- - -Warning: chunk_split() expects parameter 2 to be int, float given in %s on line %d -NULL +chunk_split() expects parameter 2 to be int, float given -- Iteration 8 -- Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d diff --git a/ext/standard/tests/strings/convert_cyr_string.phpt b/ext/standard/tests/strings/convert_cyr_string.phpt index af239543c5..a1473ad316 100644 --- a/ext/standard/tests/strings/convert_cyr_string.phpt +++ b/ext/standard/tests/strings/convert_cyr_string.phpt @@ -3,11 +3,7 @@ basic convert_cyr_string() tests --FILE-- <?php -var_dump(convert_cyr_string()); -var_dump(convert_cyr_string("")); -var_dump(convert_cyr_string("", "")); var_dump(convert_cyr_string("", "", "")); -var_dump(convert_cyr_string(array(), array(), array())); var_dump(convert_cyr_string("[[[[[[", "q", "m")); var_dump(convert_cyr_string("[[[[[[", "k", "w")); @@ -20,23 +16,11 @@ var_dump(convert_cyr_string("", "d", "i")); echo "Done\n"; ?> --EXPECTF-- -Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d -NULL - -Warning: convert_cyr_string() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d -NULL - Warning: convert_cyr_string(): Unknown source charset: in %s on line %d Warning: convert_cyr_string(): Unknown destination charset: in %s on line %d string(0) "" -Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d -NULL - Warning: convert_cyr_string(): Unknown source charset: q in %s on line %d string(6) "[[[[[[" string(6) "[[[[[[" diff --git a/ext/standard/tests/strings/convert_cyr_string_error.phpt b/ext/standard/tests/strings/convert_cyr_string_error.phpt index 66effea430..6ac438efaf 100644 --- a/ext/standard/tests/strings/convert_cyr_string_error.phpt +++ b/ext/standard/tests/strings/convert_cyr_string_error.phpt @@ -15,15 +15,6 @@ $extra_arg = 10; echo "*** Testing convert_cyr_string() : error conditions ***\n"; -echo "\n-- Testing convert_cyr_string() function with no arguments --\n"; -var_dump( convert_cyr_string() ); - -echo "\n-- Testing convert_cyr_string() function with no 'to' character set --\n"; -var_dump( convert_cyr_string($str, $from) ); - -echo "\n-- Testing convert_cyr_string() function with more than expected no. of arguments --\n"; -var_dump( convert_cyr_string($str, $from, $to, $extra_arg) ); - echo "\n-- Testing convert_cyr_string() function with invalid 'from' character set --\n"; var_dump(bin2hex( convert_cyr_string($str, "?", $to) )); @@ -38,21 +29,6 @@ var_dump(bin2hex( convert_cyr_string($str, ">", "?")) ); --EXPECTF-- *** Testing convert_cyr_string() : error conditions *** --- Testing convert_cyr_string() function with no arguments -- - -Warning: convert_cyr_string() expects exactly 3 parameters, 0 given in %s on line %d -NULL - --- Testing convert_cyr_string() function with no 'to' character set -- - -Warning: convert_cyr_string() expects exactly 3 parameters, 2 given in %s on line %d -NULL - --- Testing convert_cyr_string() function with more than expected no. of arguments -- - -Warning: convert_cyr_string() expects exactly 3 parameters, 4 given in %s on line %d -NULL - -- Testing convert_cyr_string() function with invalid 'from' character set -- Warning: convert_cyr_string(): Unknown source charset: ? in %s on line %d diff --git a/ext/standard/tests/strings/crypt.phpt b/ext/standard/tests/strings/crypt.phpt index f64b61cb5f..270f0372d1 100644 --- a/ext/standard/tests/strings/crypt.phpt +++ b/ext/standard/tests/strings/crypt.phpt @@ -19,8 +19,6 @@ echo (CRYPT_MD5) ? ((crypt($str, $salt3) === $res_3) ? 'MD5' : 'MD5 - ERROR echo (CRYPT_BLOWFISH) ? ((crypt($str, $salt4) === $res_4) ? 'BLO' : 'BLO - ERROR') : 'BLO', "\n"; var_dump(crypt($str)); -var_dump(crypt()); -var_dump(crypt("", "", "")); ?> --EXPECTF-- @@ -31,9 +29,3 @@ BLO Notice: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash. in %s on line %d string(%d) "%s" - -Warning: crypt() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: crypt() expects at most 2 parameters, 3 given in %s on line %d -NULL diff --git a/ext/standard/tests/strings/dirname_error.phpt b/ext/standard/tests/strings/dirname_error.phpt index 98a9ea5b45..79fac30029 100644 --- a/ext/standard/tests/strings/dirname_error.phpt +++ b/ext/standard/tests/strings/dirname_error.phpt @@ -6,26 +6,15 @@ Test dirname() function : error conditions Description: Returns directory name component of path. */ echo "*** Testing error conditions ***\n"; -// zero arguments -var_dump( dirname() ); // Bad arg var_dump( dirname("/var/tmp/bar.gz", 0) ); -// more than expected no. of arguments -var_dump( dirname("/var/tmp/bar.gz", 1, ".gz") ); - echo "Done\n"; ?> --EXPECTF-- *** Testing error conditions *** -Warning: dirname() expects at least 1 parameter, 0 given in %s on line %d -NULL - Warning: dirname(): Invalid argument, levels must be >= 1 in %s on line %d NULL - -Warning: dirname() expects at most 2 parameters, 3 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/strings/explode1.phpt b/ext/standard/tests/strings/explode1.phpt index 6842947605..de3049a47b 100644 --- a/ext/standard/tests/strings/explode1.phpt +++ b/ext/standard/tests/strings/explode1.phpt @@ -77,11 +77,6 @@ class string1 { $obj = new string1; var_dump( explode("b", $obj) ); -echo "\n*** Testing error conditions ***\n"; -/* checking for arguments <2 and >3 */ -var_dump( explode(":", "array1:array2:array3", -1, -33) ); -var_dump( explode(":") ); - echo "Done\n"; ?> --EXPECTF-- @@ -498,12 +493,4 @@ array(2) { [1]=> string(4) "ject" } - -*** Testing error conditions *** - -Warning: explode() expects at most 3 parameters, 4 given in %s on line %d -NULL - -Warning: explode() expects at least 2 parameters, 1 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/strings/fprintf_error.phpt b/ext/standard/tests/strings/fprintf_error.phpt index ccc37407e8..1ffc188051 100644 --- a/ext/standard/tests/strings/fprintf_error.phpt +++ b/ext/standard/tests/strings/fprintf_error.phpt @@ -7,25 +7,31 @@ Test fprintf() function (errors) echo "*** Testing Error Conditions ***\n"; /* zero argument */ -var_dump( fprintf() ); +try { + var_dump( fprintf() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* scalar argument */ -var_dump( fprintf(3) ); +try { + var_dump( fprintf(3) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* NULL argument */ -var_dump( fprintf(NULL) ); +try { + var_dump( fprintf(NULL) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> --EXPECTF-- *** Testing Error Conditions *** - -Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d -NULL - -Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d -NULL - -Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d -NULL +Wrong parameter count for fprintf() +Wrong parameter count for fprintf() +Wrong parameter count for fprintf() Done diff --git a/ext/standard/tests/strings/highlight_file.phpt b/ext/standard/tests/strings/highlight_file.phpt index 65636908e6..10ea752291 100644 --- a/ext/standard/tests/strings/highlight_file.phpt +++ b/ext/standard/tests/strings/highlight_file.phpt @@ -13,7 +13,6 @@ allow_url_fopen=1 $filename = dirname(__FILE__)."/highlight_file.dat"; -var_dump(highlight_file()); var_dump(highlight_file($filename)); var_dump(highlight_file('data:,<?php echo "test"; ?>')); @@ -37,9 +36,6 @@ var_dump(highlight_file($filename)); echo "Done\n"; ?> --EXPECTF-- -Warning: highlight_file() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - Warning: highlight_file(%shighlight_file.dat): failed to open stream: No such file or directory in %s on line %d Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d diff --git a/ext/standard/tests/strings/htmlentities24.phpt b/ext/standard/tests/strings/htmlentities24.phpt index 5a023df701..f2abfd5ba8 100644 --- a/ext/standard/tests/strings/htmlentities24.phpt +++ b/ext/standard/tests/strings/htmlentities24.phpt @@ -35,12 +35,6 @@ var_dump( htmlentities($str, ENT_QUOTES) ); var_dump( htmlentities($str, ENT_NOQUOTES) ); var_dump( htmlentities($str, ENT_COMPAT) ); -echo "\n*** Testing error conditions ***\n"; -/* zero argument */ -var_dump( htmlentities() ); -/* arguments more than expected */ -var_dump( htmlentities("\x84\x91",ENT_QUOTES, 'cp1252', "test1") ); - echo "Done\n"; ?> --EXPECTF-- @@ -320,10 +314,4 @@ string(36) "A 'quote' is <b>bold</b>" string(46) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" - -*** Testing error conditions *** - -Warning: htmlentities() expects at least 1 parameter, 0 given in %s on line %d -NULL -string(14) "„‘" Done diff --git a/ext/standard/tests/strings/htmlspecialchars.phpt b/ext/standard/tests/strings/htmlspecialchars.phpt index 8506c73e72..6e5c5fac36 100644 --- a/ext/standard/tests/strings/htmlspecialchars.phpt +++ b/ext/standard/tests/strings/htmlspecialchars.phpt @@ -35,13 +35,6 @@ var_dump( htmlspecialchars($str, ENT_QUOTES) ); var_dump( htmlspecialchars($str, ENT_NOQUOTES) ); var_dump( htmlspecialchars($str, ENT_COMPAT) ); -echo "\n*** Testing error conditions ***\n"; -/* zero argument */ -var_dump( htmlspecialchars() ); - -/* giving arguments more than expected */ -var_dump( htmlspecialchars("<br>",ENT_QUOTES,'iso-8859-1', "test2") ); - echo "Done\n" ?> --EXPECTF-- @@ -321,10 +314,4 @@ string(36) "A 'quote' is <b>bold</b>" string(46) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" string(36) "A 'quote' is <b>bold</b>" - -*** Testing error conditions *** - -Warning: htmlspecialchars() expects at least 1 parameter, 0 given in %s on line %d -NULL -string(10) "<br>" Done diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt Binary files differindex d5de391e96..9d9afc6f3c 100644 --- a/ext/standard/tests/strings/implode1.phpt +++ b/ext/standard/tests/strings/implode1.phpt diff --git a/ext/standard/tests/strings/join_error.phpt b/ext/standard/tests/strings/join_error.phpt index 36ee9d7ba6..832fb58c05 100644 --- a/ext/standard/tests/strings/join_error.phpt +++ b/ext/standard/tests/strings/join_error.phpt @@ -10,18 +10,6 @@ Test join() function: error conditions echo "*** Testing join() : error conditions ***\n"; -// Zero argument -echo "\n-- Testing join() function with Zero arguments --\n"; -var_dump( join() ); - -// More than expected number of arguments -echo "\n-- Testing join() function with more than expected no. of arguments --\n"; -$glue = 'string_val'; -$pieces = array(1, 2); -$extra_arg = 10; - -var_dump( join($glue, $pieces, $extra_arg) ); - // Less than expected number of arguments echo "\n-- Testing join() with less than expected no. of arguments --\n"; $glue = 'string_val'; @@ -33,16 +21,6 @@ echo "Done\n"; --EXPECTF-- *** Testing join() : error conditions *** --- Testing join() function with Zero arguments -- - -Warning: join() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing join() function with more than expected no. of arguments -- - -Warning: join() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Testing join() with less than expected no. of arguments -- Warning: join(): Argument must be an array in %s on line %d diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt Binary files differindex 8178fa2eb5..38cb7e566f 100644 --- a/ext/standard/tests/strings/lcfirst.phpt +++ b/ext/standard/tests/strings/lcfirst.phpt diff --git a/ext/standard/tests/strings/levenshtein.phpt b/ext/standard/tests/strings/levenshtein.phpt index 1ac05cf2ae..b4b7c03e7f 100644 --- a/ext/standard/tests/strings/levenshtein.phpt +++ b/ext/standard/tests/strings/levenshtein.phpt @@ -63,10 +63,8 @@ $n += test_me("gt maxlength2", -1, "A", "AbcdefghijklmnopqrstuvwxyzAbcdefghijkl echo ($n==0)?"all passed\n":"$n failed\n"; -var_dump(levenshtein(array(), array())); var_dump(levenshtein("", "", -1, -1, -1)); var_dump(levenshtein("", "", 10, 10, 10)); -var_dump(levenshtein("")); ?> --EXPECTF-- @@ -76,11 +74,5 @@ Warning: levenshtein(): Argument string(s) too long in %s on line %d Warning: levenshtein(): Argument string(s) too long in %s on line %d all passed - -Warning: levenshtein() expects parameter 1 to be string, array given in %s on line %d -NULL int(0) int(0) - -Warning: Wrong parameter count for levenshtein() in %s on line %d -NULL diff --git a/ext/standard/tests/strings/ltrim.phpt b/ext/standard/tests/strings/ltrim.phpt index 638c93557f..51287e04d7 100644 --- a/ext/standard/tests/strings/ltrim.phpt +++ b/ext/standard/tests/strings/ltrim.phpt @@ -9,12 +9,6 @@ Test ltrim() function echo "\n *** Output for Error Conditions ***\n"; - echo "\n *** Output for zero argument ***\n"; - var_dump( ltrim() ); - - echo "\n *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) ***\n"; - var_dump( ltrim("", " ", 1) ); - /* heredoc string */ $str = <<<EOD us @@ -50,16 +44,6 @@ echo "\nDone\n"; --EXPECTF-- *** Output for Error Conditions *** - *** Output for zero argument *** - -Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d -NULL - - *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) *** - -Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d -NULL - *** Using heredoc string *** string(17) "ng heredoc string" diff --git a/ext/standard/tests/strings/ltrim_error.phpt b/ext/standard/tests/strings/ltrim_error.phpt index 694d9fea18..58324d7f3a 100644 --- a/ext/standard/tests/strings/ltrim_error.phpt +++ b/ext/standard/tests/strings/ltrim_error.phpt @@ -11,14 +11,6 @@ Test ltrim() function : error conditions echo "*** Testing ltrim() : error conditions ***\n"; -echo "\n-- Testing ltrim() function with no arguments --\n"; -var_dump( ltrim() ); - -echo "\n-- Testing ltrim() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( ltrim("Hello World", "Heo", $extra_arg) ); - - $hello = " Hello World\n"; echo "\n-- Test ltrim function with various invalid charlists\n"; var_dump(ltrim($hello, "..a")); @@ -31,16 +23,6 @@ var_dump(ltrim($hello, "a..b..c")); --EXPECTF-- *** Testing ltrim() : error conditions *** --- Testing ltrim() function with no arguments -- - -Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing ltrim() function with more than expected no. of arguments -- - -Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Test ltrim function with various invalid charlists Warning: ltrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d diff --git a/ext/standard/tests/strings/md5_file.phpt b/ext/standard/tests/strings/md5_file.phpt Binary files differindex 45009669f4..e56987cd6a 100644 --- a/ext/standard/tests/strings/md5_file.phpt +++ b/ext/standard/tests/strings/md5_file.phpt diff --git a/ext/standard/tests/strings/metaphone.phpt b/ext/standard/tests/strings/metaphone.phpt index ef1d23d89a..c70b4846a1 100644 --- a/ext/standard/tests/strings/metaphone.phpt +++ b/ext/standard/tests/strings/metaphone.phpt @@ -3,7 +3,6 @@ metaphone() tests --FILE-- <?php -var_dump(metaphone()); var_dump(metaphone("")); var_dump(metaphone(-1)); var_dump(metaphone(-1, -1)); @@ -26,8 +25,6 @@ foreach($array as $str) { echo "Done\n"; ?> --EXPECTF-- -Warning: metaphone() expects at least 1 parameter, 0 given in %s on line %d -NULL string(0) "" string(0) "" bool(false) diff --git a/ext/standard/tests/strings/money_format_error.phpt b/ext/standard/tests/strings/money_format_error.phpt index 454b593537..8a4366f1bb 100644 --- a/ext/standard/tests/strings/money_format_error.phpt +++ b/ext/standard/tests/strings/money_format_error.phpt @@ -23,15 +23,6 @@ $extra_arg = 10; echo "*** Testing money_format() : error conditions ***\n"; -echo "\n-- Testing money_format() function with no arguments --\n"; -var_dump( money_format() ); - -echo "\n-- Testing money_format() function with insufficient arguments --\n"; -var_dump( money_format($string) ); - -echo "\n-- Testing money_format() function with more than expected no. of arguments --\n"; -var_dump( money_format($string, $value, $extra_arg) ); - echo "\n-- Testing money_format() function with more than one token --\n"; var_dump( money_format($string . $string, $value) ); ?> @@ -39,21 +30,6 @@ var_dump( money_format($string . $string, $value) ); --EXPECTF-- *** Testing money_format() : error conditions *** --- Testing money_format() function with no arguments -- - -Warning: money_format() expects exactly 2 parameters, 0 given in %s on line %d -NULL - --- Testing money_format() function with insufficient arguments -- - -Warning: money_format() expects exactly 2 parameters, 1 given in %s on line %d -NULL - --- Testing money_format() function with more than expected no. of arguments -- - -Warning: money_format() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -- Testing money_format() function with more than one token -- Warning: money_format(): Only a single %ci or %cn token can be used in %s on line %d diff --git a/ext/standard/tests/strings/parse_str_basic1.phpt b/ext/standard/tests/strings/parse_str_basic1.phpt index b3f2fe5cfc..e442c0fd70 100644 --- a/ext/standard/tests/strings/parse_str_basic1.phpt +++ b/ext/standard/tests/strings/parse_str_basic1.phpt @@ -3,18 +3,13 @@ Test parse_str() function : basic functionality --FILE-- <?php -/* Prototype : void parse_str ( string $str [, array &$arr ] ) +/* Prototype : void parse_str ( string $str , array &$arr ) * Description: Parses the string into variables * Source code: ext/standard/string.c */ echo "*** Testing parse_str() : basic functionality ***\n"; -echo "Basic test WITHOUT result arg\n"; -$s1 = "first=val1&second=val2&third=val3"; -var_dump(parse_str($s1)); -var_dump($first, $second, $third); - echo "\nBasic test WITH undefined var for result arg\n"; $s1 = "first=val1&second=val2&third=val3"; var_dump(parse_str($s1, $res1)); @@ -35,13 +30,6 @@ var_dump($res3_array); ===DONE=== --EXPECTF-- *** Testing parse_str() : basic functionality *** -Basic test WITHOUT result arg - -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d -NULL -string(4) "val1" -string(4) "val2" -string(4) "val3" Basic test WITH undefined var for result arg NULL diff --git a/ext/standard/tests/strings/parse_str_basic3.phpt b/ext/standard/tests/strings/parse_str_basic3.phpt Binary files differindex 0368dea5f9..06f9579188 100644 --- a/ext/standard/tests/strings/parse_str_basic3.phpt +++ b/ext/standard/tests/strings/parse_str_basic3.phpt diff --git a/ext/standard/tests/strings/pathinfo.phpt b/ext/standard/tests/strings/pathinfo.phpt index a3d735069d..2bbea73588 100644 --- a/ext/standard/tests/strings/pathinfo.phpt +++ b/ext/standard/tests/strings/pathinfo.phpt @@ -3,7 +3,6 @@ pathinfo() tests --FILE-- <?php -var_dump(pathinfo()); var_dump(pathinfo("")); var_dump(pathinfo(".")); var_dump(pathinfo("..")); @@ -27,8 +26,6 @@ var_dump(pathinfo(__FILE__, PATHINFO_DIRNAME|PATHINFO_BASENAME)); echo "Done\n"; ?> --EXPECTF-- -Warning: pathinfo() expects at least 1 parameter, 0 given in %s on line %d -NULL array(2) { ["basename"]=> string(0) "" diff --git a/ext/standard/tests/strings/php_strip_whitespace.phpt b/ext/standard/tests/strings/php_strip_whitespace.phpt index d9376b101a..caab3bc1d2 100644 --- a/ext/standard/tests/strings/php_strip_whitespace.phpt +++ b/ext/standard/tests/strings/php_strip_whitespace.phpt @@ -5,7 +5,6 @@ php_strip_whitespace() tests $filename = dirname(__FILE__)."/php_strip_whitespace.dat"; -var_dump(php_strip_whitespace()); var_dump(php_strip_whitespace($filename)); $data = '/* test comment */'; @@ -40,9 +39,6 @@ var_dump(php_strip_whitespace($filename)); echo "Done\n"; ?> --EXPECTF-- -Warning: php_strip_whitespace() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - Warning: php_strip_whitespace(%sphp_strip_whitespace.dat): failed to open stream: No such file or directory in %s on line %d string(0) "" string(18) "/* test comment */" diff --git a/ext/standard/tests/strings/printf.phpt b/ext/standard/tests/strings/printf.phpt index eab44a4a65..89b1b9ace2 100644 --- a/ext/standard/tests/strings/printf.phpt +++ b/ext/standard/tests/strings/printf.phpt @@ -28,7 +28,11 @@ $strings = array( NULL, "abc", 'aaa' ); /* Zero argument */ echo "\n*** Output for zero argument ***\n"; -printf(); +try { + printf(); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* Number of arguments not matching as specified in format field */ echo "\n*** Output for insufficient number of arguments ***\n"; @@ -226,8 +230,7 @@ printf("%d", $tempstring); ?> --EXPECTF-- *** Output for zero argument *** - -Warning: printf() expects at least %d parameter, %d given in %s on line %d +printf() expects at least %d parameter, %d given *** Output for insufficient number of arguments *** diff --git a/ext/standard/tests/strings/printf_64bit.phpt b/ext/standard/tests/strings/printf_64bit.phpt index 1a90970371..0106f71445 100644 --- a/ext/standard/tests/strings/printf_64bit.phpt +++ b/ext/standard/tests/strings/printf_64bit.phpt @@ -28,7 +28,11 @@ $strings = array( NULL, "abc", 'aaa' ); /* Zero argument */ echo "\n*** Output for zero argument ***\n"; -printf(); +try { + printf(); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* Number of arguments not matching as specified in format field */ echo "\n*** Output for insufficient number of arguments ***\n"; @@ -226,8 +230,7 @@ printf("%d", $tempstring); ?> --EXPECTF-- *** Output for zero argument *** - -Warning: printf() expects at least 1 parameter, 0 given in %s on line %d +printf() expects at least 1 parameter, 0 given *** Output for insufficient number of arguments *** diff --git a/ext/standard/tests/strings/printf_error.phpt b/ext/standard/tests/strings/printf_error.phpt index a88390bc04..aff95426e6 100644 --- a/ext/standard/tests/strings/printf_error.phpt +++ b/ext/standard/tests/strings/printf_error.phpt @@ -11,7 +11,11 @@ echo "*** Testing printf() : error conditions ***\n"; // Zero arguments echo "\n-- Testing printf() function with Zero arguments --\n"; -var_dump( printf() ); +try { + var_dump( printf() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing printf() function with less than expected no. of arguments --\n"; $format1 = '%s'; @@ -38,9 +42,7 @@ var_dump( printf($format3) ); *** Testing printf() : error conditions *** -- Testing printf() function with Zero arguments -- - -Warning: printf() expects at least 1 parameter, 0 given in %s on line %d -bool(false) +printf() expects at least 1 parameter, 0 given -- Testing printf() function with less than expected no. of arguments -- diff --git a/ext/standard/tests/strings/quoted_printable_encode_001.phpt b/ext/standard/tests/strings/quoted_printable_encode_001.phpt index 1ce7d791dc..df26d5cf4b 100644 --- a/ext/standard/tests/strings/quoted_printable_encode_001.phpt +++ b/ext/standard/tests/strings/quoted_printable_encode_001.phpt @@ -3,30 +3,18 @@ quoted_printable_encode() tests - 1 --FILE-- <?php -var_dump(quoted_printable_encode()); var_dump(quoted_printable_encode("")); var_dump(quoted_printable_encode("test")); -var_dump(quoted_printable_encode("test", "more")); -$a = array("str"); -var_dump(quoted_printable_encode($a)); var_dump(quoted_printable_encode(1)); var_dump(quoted_printable_encode(NULL)); var_dump(quoted_printable_encode(false)); echo "Done\n"; ?> ---EXPECTF-- -Warning: quoted_printable_encode() expects exactly 1 parameter, 0 given in %s on line %d -NULL +--EXPECT-- string(0) "" string(4) "test" - -Warning: quoted_printable_encode() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: quoted_printable_encode() expects parameter 1 to be string, array given in %s on line %d -NULL string(1) "1" string(0) "" string(0) "" diff --git a/ext/standard/tests/strings/quotemeta_basic_1.phpt b/ext/standard/tests/strings/quotemeta_basic_1.phpt index 4b479a9a60..4d1feb5ae1 100644 --- a/ext/standard/tests/strings/quotemeta_basic_1.phpt +++ b/ext/standard/tests/strings/quotemeta_basic_1.phpt @@ -1,5 +1,5 @@ --TEST-- -Test function quotemeta() - using an empty string is given as str. +Test function quotemeta() - using an empty string is given as str --CREDITS-- Rodrigo Prado de Jesus <royopa [at] gmail [dot] com> User Group: PHPSP #PHPTestFestBrasil @@ -9,4 +9,4 @@ $str = ""; var_dump(quotemeta($str)); ?> --EXPECT-- -bool(false) +string(0) "" diff --git a/ext/standard/tests/strings/rtrim.phpt b/ext/standard/tests/strings/rtrim.phpt Binary files differindex 5f57b0e850..223a839f58 100644 --- a/ext/standard/tests/strings/rtrim.phpt +++ b/ext/standard/tests/strings/rtrim.phpt diff --git a/ext/standard/tests/strings/rtrim_error.phpt b/ext/standard/tests/strings/rtrim_error.phpt index 108f96a1f0..210fb58c4e 100644 --- a/ext/standard/tests/strings/rtrim_error.phpt +++ b/ext/standard/tests/strings/rtrim_error.phpt @@ -11,14 +11,6 @@ Test rtrim() function : error conditions echo "*** Testing rtrim() : error conditions ***\n"; -echo "\n-- Testing rtrim() function with no arguments --\n"; -var_dump( rtrim() ); - -echo "\n-- Testing rtrim() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( rtrim("Hello World", "Heo", $extra_arg) ); - - $hello = " Hello World\n"; echo "\n-- Test rtrim function with various invalid charlists\n"; var_dump(rtrim($hello, "..a")); @@ -31,16 +23,6 @@ var_dump(rtrim($hello, "a..b..c")); --EXPECTF-- *** Testing rtrim() : error conditions *** --- Testing rtrim() function with no arguments -- - -Warning: rtrim() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing rtrim() function with more than expected no. of arguments -- - -Warning: rtrim() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Test rtrim function with various invalid charlists Warning: rtrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d diff --git a/ext/standard/tests/strings/setlocale_error.phpt b/ext/standard/tests/strings/setlocale_error.phpt index 14bb7d7ed5..c2b18b1992 100644 --- a/ext/standard/tests/strings/setlocale_error.phpt +++ b/ext/standard/tests/strings/setlocale_error.phpt @@ -18,14 +18,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { echo "*** Testing setlocale() : error conditions ***\n"; -// Zero argument -echo "\n-- Testing setlocale() function with Zero arguments --"; -var_dump( setlocale()); - -// One argument -echo "\n-- Testing setlocale() function with One argument, 'category' = LC_ALL --"; -var_dump( setlocale(LC_ALL) ); - echo "\n-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --\n"; //Invalid array of locales $invalid_locales = array("en_US.invalid", "en_AU.invalid", "ko_KR.invalid"); @@ -44,14 +36,6 @@ echo "\nDone"; --EXPECTF-- *** Testing setlocale() : error conditions *** --- Testing setlocale() function with Zero arguments -- -Warning: setlocale() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing setlocale() function with One argument, 'category' = LC_ALL -- -Warning: setlocale() expects at least 2 parameters, 1 given in %s on line %d -NULL - -- Testing setlocale() function with invalid locale array, 'category' = LC_ALL -- bool(false) diff --git a/ext/standard/tests/strings/sha1_file.phpt b/ext/standard/tests/strings/sha1_file.phpt index 102dab75ff..09e81be014 100644 --- a/ext/standard/tests/strings/sha1_file.phpt +++ b/ext/standard/tests/strings/sha1_file.phpt @@ -46,12 +46,6 @@ var_dump( sha1_file(12) ); echo "\n-- NULL as filename --\n"; var_dump( sha1_file(NULL) ); -echo "\n-- Zero arguments --\n"; - var_dump ( sha1_file() ); - -echo "\n-- More than valid number of arguments ( valid is 2) --\n"; -var_dump ( sha1_file("EmptyFileSHA1.txt", true, NULL) ); - echo "\n-- Hexadecimal Output for Empty file as Argument --\n"; var_dump( sha1_file("EmptyFileSHA1.txt") ); @@ -95,16 +89,6 @@ bool(false) Warning: sha1_file(): Filename cannot be empty in %s on line %d bool(false) --- Zero arguments -- - -Warning: sha1_file() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- More than valid number of arguments ( valid is 2) -- - -Warning: sha1_file() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Hexadecimal Output for Empty file as Argument -- string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709" diff --git a/ext/standard/tests/strings/soundex.phpt b/ext/standard/tests/strings/soundex.phpt index 650236c2e5..744f71c17a 100644 --- a/ext/standard/tests/strings/soundex.phpt +++ b/ext/standard/tests/strings/soundex.phpt @@ -5,7 +5,6 @@ soundex() tests var_dump(soundex("")); var_dump(soundex(-1)); -var_dump(soundex(array())); $array = array( "From", @@ -34,9 +33,6 @@ echo "Done\n"; --EXPECTF-- bool(false) string(4) "0000" - -Warning: soundex() expects parameter 1 to be string, array given in %s on line %d -NULL string(4) "F650" string(4) "T300" string(4) "T500" diff --git a/ext/standard/tests/strings/sprintf_error.phpt b/ext/standard/tests/strings/sprintf_error.phpt index 1c12cd3168..1b21b8b141 100644 --- a/ext/standard/tests/strings/sprintf_error.phpt +++ b/ext/standard/tests/strings/sprintf_error.phpt @@ -11,7 +11,11 @@ echo "*** Testing sprintf() : error conditions ***\n"; // Zero arguments echo "\n-- Testing sprintf() function with Zero arguments --\n"; -var_dump( sprintf() ); +try { + var_dump( sprintf() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing sprintf() function with less than expected no. of arguments --\n"; $format1 = '%s'; @@ -38,9 +42,7 @@ echo "Done"; *** Testing sprintf() : error conditions *** -- Testing sprintf() function with Zero arguments -- - -Warning: sprintf() expects at least %d parameter, %d given in %s on line %d -bool(false) +sprintf() expects at least %d parameter, %d given -- Testing sprintf() function with less than expected no. of arguments -- diff --git a/ext/standard/tests/strings/sscanf_error.phpt b/ext/standard/tests/strings/sscanf_error.phpt index ca967758ab..3e54a42f1e 100644 --- a/ext/standard/tests/strings/sscanf_error.phpt +++ b/ext/standard/tests/strings/sscanf_error.phpt @@ -12,12 +12,6 @@ echo "*** Testing sscanf() : error conditions ***\n"; $str = "Hello World"; $format = "%s %s"; -echo "\n-- Testing sscanf() function with no arguments --\n"; -var_dump( sscanf() ); - -echo "\n-- Testing sscanf() function with one argument --\n"; -var_dump( sscanf($str) ); - echo "\n-- Testing sscanf() function with more than expected no. of arguments --\n"; var_dump( sscanf($str, $format, $str1, $str2, $extra_str) ); @@ -27,16 +21,6 @@ var_dump( sscanf($str, $format, $str1, $str2, $extra_str) ); --EXPECTF-- *** Testing sscanf() : error conditions *** --- Testing sscanf() function with no arguments -- - -Warning: sscanf() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing sscanf() function with one argument -- - -Warning: sscanf() expects at least 2 parameters, 1 given in %s on line %d -NULL - -- Testing sscanf() function with more than expected no. of arguments -- Warning: sscanf(): Variable is not assigned by any conversion specifiers in %s on line %d diff --git a/ext/standard/tests/strings/str_ireplace.phpt b/ext/standard/tests/strings/str_ireplace.phpt index 526b8ac723..71a9d1e127 100644 --- a/ext/standard/tests/strings/str_ireplace.phpt +++ b/ext/standard/tests/strings/str_ireplace.phpt @@ -3,9 +3,6 @@ str_ireplace() tests --FILE-- <?php -var_dump(str_ireplace()); -var_dump(str_ireplace("")); -var_dump(str_ireplace("", "")); var_dump(str_ireplace("", "", "")); var_dump(str_ireplace("tt", "a", "ttttTttttttttTT")); @@ -48,14 +45,6 @@ var_dump($Data = str_ireplace("\n", "<br>", $Data)); echo "Done\n"; ?> --EXPECTF-- -Warning: str_ireplace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: str_ireplace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: str_ireplace() expects at least 3 parameters, 2 given in %s on line %d -NULL string(0) "" string(8) "aaaaaaaT" string(8) "aaaaaaaT" diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt Binary files differindex b44a9517ab..be4c9ed942 100644 --- a/ext/standard/tests/strings/str_pad.phpt +++ b/ext/standard/tests/strings/str_pad.phpt diff --git a/ext/standard/tests/strings/str_repeat.phpt b/ext/standard/tests/strings/str_repeat.phpt Binary files differindex 306b7d381a..766bea1f9c 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.phpt b/ext/standard/tests/strings/str_replace.phpt index 7b411abac5..bef11f872a 100644 --- a/ext/standard/tests/strings/str_replace.phpt +++ b/ext/standard/tests/strings/str_replace.phpt @@ -223,15 +223,6 @@ var_dump( str_replace("worldS", "FOUND", "$strS") ); var_dump( str_replace("worldS", "FOUND", "${str}S") ); var_dump( str_replace("worldS", "FOUND", "{$str}S") ); - -echo "\n*** Testing error conditions ***"; -/* Invalid arguments */ -var_dump( str_replace() ); -var_dump( str_replace("") ); -var_dump( str_replace(NULL) ); -var_dump( str_replace(1, 2) ); -var_dump( str_replace(1,2,3,$var,5) ); - fclose($resource1); closedir($resource2); echo "Done\n"; @@ -938,20 +929,4 @@ Notice: Undefined variable: strS in %s on line %d string(0) "" string(5) "FOUND" string(5) "FOUND" - -*** Testing error conditions *** -Warning: str_replace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: str_replace() expects at least 3 parameters, 2 given in %s on line %d -NULL - -Warning: str_replace() expects at most 4 parameters, 5 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/strings/str_split_variation6.phpt b/ext/standard/tests/strings/str_split_variation6.phpt index a477800a26..1aea668026 100644 --- a/ext/standard/tests/strings/str_split_variation6.phpt +++ b/ext/standard/tests/strings/str_split_variation6.phpt @@ -30,7 +30,6 @@ $values = array ( 0234, //octal number 0x1A, //hexadecimal number 2147483647, //max positive integer number - 2147483648, //max positive integer+1 -2147483648, //min negative integer ); @@ -157,10 +156,6 @@ array(1) { } -- Iteration 7 -- -Warning: str_split() expects parameter 2 to be int, float given in %s line %d -NULL --- Iteration 8 -- - Warning: str_split(): The length of each segment must be greater than zero in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/str_split_variation7.phpt b/ext/standard/tests/strings/str_split_variation7.phpt index 5082c7ba2f..1a2471a20a 100644 --- a/ext/standard/tests/strings/str_split_variation7.phpt +++ b/ext/standard/tests/strings/str_split_variation7.phpt @@ -32,7 +32,6 @@ $values = array ( 0234, //octal number 0x1A, //hexadecimal number 2147483647, //max positive integer number - 2147483648, //max positive integer+1 -2147483648, //min negative integer ); @@ -135,10 +134,6 @@ array(1) { } -- Iteration 7 -- -Warning: str_split() expects parameter 2 to be int, float given in %s on line %d -NULL --- Iteration 8 -- - Warning: str_split(): The length of each segment must be greater than zero in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/str_word_count.phpt b/ext/standard/tests/strings/str_word_count.phpt index f88646370b..e8fa12aca6 100644 --- a/ext/standard/tests/strings/str_word_count.phpt +++ b/ext/standard/tests/strings/str_word_count.phpt @@ -13,28 +13,20 @@ var_dump(str_word_count($str, 3)); var_dump(str_word_count($str, 123)); var_dump(str_word_count($str, -1)); var_dump(str_word_count($str, 999999999)); -var_dump(str_word_count($str, array())); -var_dump(str_word_count($str, $b)); var_dump($str); $str2 = "F0o B4r 1s bar foo"; var_dump(str_word_count($str2, NULL, "04")); var_dump(str_word_count($str2, NULL, "01")); var_dump(str_word_count($str2, NULL, "014")); -var_dump(str_word_count($str2, NULL, array())); -var_dump(str_word_count($str2, NULL, new stdClass)); var_dump(str_word_count($str2, NULL, "")); var_dump(str_word_count($str2, 1, "04")); var_dump(str_word_count($str2, 1, "01")); var_dump(str_word_count($str2, 1, "014")); -var_dump(str_word_count($str2, 1, array())); -var_dump(str_word_count($str2, 1, new stdClass)); var_dump(str_word_count($str2, 1, "")); var_dump(str_word_count($str2, 2, "04")); var_dump(str_word_count($str2, 2, "01")); var_dump(str_word_count($str2, 2, "014")); -var_dump(str_word_count($str2, 2, array())); -var_dump(str_word_count($str2, 2, new stdClass)); var_dump(str_word_count($str2, 2, "")); var_dump(str_word_count("foo'0 bar-0var", 2, "0")); var_dump(str_word_count("'foo'", 2)); @@ -86,23 +78,11 @@ bool(false) Warning: str_word_count(): Invalid format value 999999999 in %s on line %d bool(false) - -Warning: str_word_count() expects parameter 2 to be int, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 2 to be int, string given in %s on line %d -NULL string(55) "Hello friend, you're looking good today!" int(5) int(6) int(5) - -Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d -NULL int(7) array(5) { [0]=> @@ -142,12 +122,6 @@ array(5) { [4]=> string(3) "foo" } - -Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d -NULL array(7) { [0]=> string(1) "F" @@ -202,12 +176,6 @@ array(5) { [15]=> string(3) "foo" } - -Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d -NULL - -Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d -NULL array(7) { [0]=> string(1) "F" diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt Binary files differindex 3086c2be92..d9063cc9de 100644 --- a/ext/standard/tests/strings/strcasecmp.phpt +++ b/ext/standard/tests/strings/strcasecmp.phpt diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt Binary files differindex 397e072c52..fd20e50195 100644 --- a/ext/standard/tests/strings/strcmp.phpt +++ b/ext/standard/tests/strings/strcmp.phpt diff --git a/ext/standard/tests/strings/stripos.phpt b/ext/standard/tests/strings/stripos.phpt index 057b8ca494..4c3c5a7fcc 100644 --- a/ext/standard/tests/strings/stripos.phpt +++ b/ext/standard/tests/strings/stripos.phpt @@ -28,7 +28,7 @@ stripos() function test echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- int(0) int(5) int(5) @@ -45,23 +45,11 @@ int(0) bool(false) bool(false) bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) +int(0) int(1) Done diff --git a/ext/standard/tests/strings/stripos_error.phpt b/ext/standard/tests/strings/stripos_error.phpt index 324014cf6d..0420bb090b 100644 --- a/ext/standard/tests/strings/stripos_error.phpt +++ b/ext/standard/tests/strings/stripos_error.phpt @@ -8,14 +8,6 @@ Test stripos() function : error conditions */ echo "*** Testing stripos() function: error conditions ***\n"; -echo "\n-- With Zero arguments --"; -var_dump( stripos() ); - -echo "\n-- With less than expected number of arguments --"; -var_dump( stripos("String") ); - -echo "\n-- With more than expected number of arguments --"; -var_dump( stripos("string", "String", 1, 'extra_arg') ); echo "\n-- Offset beyond the end of the string --"; var_dump( stripos("Hello World", "o", 12) ); @@ -28,18 +20,6 @@ echo "*** Done ***"; --EXPECTF-- *** Testing stripos() function: error conditions *** --- With Zero arguments -- -Warning: stripos() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- With less than expected number of arguments -- -Warning: stripos() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- With more than expected number of arguments -- -Warning: stripos() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Offset beyond the end of the string -- Warning: stripos(): Offset not contained in string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/stripos_variation1.phpt b/ext/standard/tests/strings/stripos_variation1.phpt index a3fc324dd7..53d6be65e7 100644 --- a/ext/standard/tests/strings/stripos_variation1.phpt +++ b/ext/standard/tests/strings/stripos_variation1.phpt @@ -81,7 +81,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing stripos() function: with double quoted strings *** -- Iteration 1 -- int(2) @@ -117,32 +117,16 @@ int(9) int(8) bool(false) -- Iteration 12 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 13 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 14 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(8) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 16 -- bool(false) diff --git a/ext/standard/tests/strings/stripos_variation10.phpt b/ext/standard/tests/strings/stripos_variation10.phpt index 81b8f5adb1..6792b4d0b2 100644 --- a/ext/standard/tests/strings/stripos_variation10.phpt +++ b/ext/standard/tests/strings/stripos_variation10.phpt @@ -83,7 +83,11 @@ $needles = array ( $counter = 1; for($index = 0; $index < count($needles); $index ++) { echo "\n-- Iteration $counter --\n"; - var_dump( stripos($haystack, $needles[$index]) ); + try { + var_dump( stripos($haystack, $needles[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -95,101 +99,61 @@ echo "*** Done ***"; *** Testing stripos() function with unexpected values for needle *** -- Iteration 1 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(7) -- Iteration 2 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(9) -- Iteration 3 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 5 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(16) -- Iteration 6 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(21) -- Iteration 7 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 8 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 9 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(17) -- Iteration 10 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +stripos() expects parameter 2 to be string, array given -- Iteration 11 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +stripos() expects parameter 2 to be string, array given -- Iteration 12 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +stripos() expects parameter 2 to be string, array given -- Iteration 13 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +stripos() expects parameter 2 to be string, array given -- Iteration 14 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -bool(false) +stripos() expects parameter 2 to be string, array given -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(9) -- Iteration 16 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(9) -- Iteration 18 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) +int(64) -- Iteration 20 -- bool(false) @@ -198,27 +162,17 @@ bool(false) bool(false) -- Iteration 22 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 23 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 24 -- - -Warning: stripos(): needle is not a string or an integer in %s on line %d -%s +stripos() expects parameter 2 to be string, resource given -- Iteration 25 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/stripos_variation11.phpt b/ext/standard/tests/strings/stripos_variation11.phpt index b4b83a1641..aab3181df3 100644 --- a/ext/standard/tests/strings/stripos_variation11.phpt +++ b/ext/standard/tests/strings/stripos_variation11.phpt @@ -81,8 +81,16 @@ $counter = 1; for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; $haystack = $values[$index]; - var_dump( stripos($values[$index], $values[$index]) ); - var_dump( stripos($values[$index], $values[$index], 1) ); + try { + var_dump( stripos($values[$index], $values[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( stripos($values[$index], $values[$index], 1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -91,109 +99,49 @@ echo "*** Done ***"; --EXPECTF-- *** Testing stripos() function with unexpected values for haystack and needle *** -- Iteration 1 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 2 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 3 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 4 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 5 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 6 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 7 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 8 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 9 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 10 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 11 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 12 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 13 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 14 -- - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, array given in %s on line %d -NULL +stripos() expects parameter 1 to be string, array given +stripos() expects parameter 1 to be string, array given -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 16 -- bool(false) @@ -201,11 +149,7 @@ bool(false) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 18 -- bool(false) @@ -213,15 +157,7 @@ bool(false) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +int(0) bool(false) -- Iteration 20 -- bool(false) @@ -244,12 +180,8 @@ bool(false) Warning: stripos(): Offset not contained in string in %s on line %d bool(false) -- Iteration 24 -- - -Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d -NULL - -Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d -NULL +stripos() expects parameter 1 to be string, resource given +stripos() expects parameter 1 to be string, resource given -- Iteration 25 -- bool(false) diff --git a/ext/standard/tests/strings/stripos_variation2.phpt b/ext/standard/tests/strings/stripos_variation2.phpt index bb77d1becb..0f4c887869 100644 --- a/ext/standard/tests/strings/stripos_variation2.phpt +++ b/ext/standard/tests/strings/stripos_variation2.phpt @@ -83,7 +83,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing stripos() function: with single quoted strings *** -- Iteration 1 -- int(2) @@ -119,32 +119,16 @@ bool(false) int(10) int(10) -- Iteration 12 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 14 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 15 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 16 -- bool(false) @@ -234,11 +218,7 @@ bool(false) bool(false) bool(false) -- Iteration 45 -- - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(26) - -Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +bool(false) bool(false) -- Iteration 46 -- int(0) diff --git a/ext/standard/tests/strings/stristr.phpt b/ext/standard/tests/strings/stristr.phpt index 8fca54b082..92cfa09eb1 100644 --- a/ext/standard/tests/strings/stristr.phpt +++ b/ext/standard/tests/strings/stristr.phpt @@ -2,10 +2,6 @@ stristr() function --FILE-- <?php - var_dump(stristr()); - var_dump(stristr(array(), "")); - var_dump(stristr("", array())); - var_dump(stristr(array(), array())); var_dump(stristr("tEsT sTrInG", "tEsT")); var_dump(stristr("tEsT sTrInG", "stRiNg")); var_dump(stristr("tEsT sTrInG", "stRiN")); @@ -19,17 +15,6 @@ stristr() function var_dump(stristr("tEsT sTrInG", " ")); ?> --EXPECTF-- -Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) - -Warning: stristr() expects parameter 1 to be string, array given in %s on line %d -NULL string(11) "tEsT sTrInG" string(6) "sTrInG" string(6) "sTrInG" diff --git a/ext/standard/tests/strings/stristr2.phpt b/ext/standard/tests/strings/stristr2.phpt index b899b4739d..ae2c8e93cf 100644 --- a/ext/standard/tests/strings/stristr2.phpt +++ b/ext/standard/tests/strings/stristr2.phpt @@ -16,14 +16,10 @@ var_dump(stristr($email, 97)); var_dump(stristr($email, 97, 1)); ?> ---EXPECTF-- +--EXPECT-- string(7) "cCdEfGh" string(2) "Ab" string(5) "eEfGh" string(4) "AbCd" - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(11) "azAbCdeEfGh" - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -string(1) "w" +bool(false) +bool(false) diff --git a/ext/standard/tests/strings/stristr_error.phpt b/ext/standard/tests/strings/stristr_error.phpt index a0057574f9..a7b683d3b8 100644 --- a/ext/standard/tests/strings/stristr_error.phpt +++ b/ext/standard/tests/strings/stristr_error.phpt @@ -8,17 +8,6 @@ Test stristr() function : error conditions */ echo "*** Testing stristr() : error conditions ***\n"; -echo "\n-- Testing stristr() function with no arguments --\n"; -var_dump( stristr() ); -var_dump( stristr("") ); - -echo "\n-- Testing stristr() function with no needle --\n"; -var_dump( stristr("Hello World") ); // without "needle" - -echo "\n-- Testing stristr() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( stristr("Hello World", "World", true, $extra_arg) ); - echo "\n-- Testing stristr() function with empty haystack --\n"; var_dump( stristr(NULL, "") ); @@ -30,24 +19,6 @@ var_dump( stristr("Hello World", "") ); --EXPECTF-- *** Testing stristr() : error conditions *** --- Testing stristr() function with no arguments -- - -Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing stristr() function with no needle -- - -Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d -NULL - --- Testing stristr() function with more than expected no. of arguments -- - -Warning: stristr() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Testing stristr() function with empty haystack -- Warning: stristr(): Empty needle in %s on line %d diff --git a/ext/standard/tests/strings/stristr_variation2.phpt b/ext/standard/tests/strings/stristr_variation2.phpt index 4a0b62f261..fd842d1106 100644 --- a/ext/standard/tests/strings/stristr_variation2.phpt +++ b/ext/standard/tests/strings/stristr_variation2.phpt @@ -72,7 +72,11 @@ $pad_length = "20"; $count = 1; foreach($inputs as $input) { echo "-- Iteration $count --\n"; - var_dump( stristr("Hello World", $input) ); + try { + var_dump( stristr("Hello World", $input) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count ++; } @@ -83,85 +87,55 @@ fclose($file_handle); //closing the file handle --EXPECTF-- *** Testing stristr() function: with unexpected inputs for 'needle' argument *** -- Iteration 1 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 2 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 3 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 5 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 6 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 7 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 8 -- - -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +stristr() expects parameter 2 to be string, array given -- Iteration 9 -- - -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +stristr() expects parameter 2 to be string, array given -- Iteration 10 -- - -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +stristr() expects parameter 2 to be string, array given -- Iteration 11 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 12 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 14 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) -- Iteration 15 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) -- Iteration 16 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) -- Iteration 17 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d bool(false) -- Iteration 18 -- - -Warning: stristr(): needle is not a string or an integer in %s on line %d -bool(false) +stristr() expects parameter 2 to be string, resource given -- Iteration 19 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) -- Iteration 20 -- -Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +Warning: stristr(): Empty needle in %s on line %d bool(false) ===DONE=== diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt Binary files differindex a546bdb8d2..156038ed7b 100644 --- a/ext/standard/tests/strings/strlen.phpt +++ b/ext/standard/tests/strings/strlen.phpt diff --git a/ext/standard/tests/strings/strncasecmp_error.phpt b/ext/standard/tests/strings/strncasecmp_error.phpt index d443f8113b..00ddfaed9b 100644 --- a/ext/standard/tests/strings/strncasecmp_error.phpt +++ b/ext/standard/tests/strings/strncasecmp_error.phpt @@ -10,18 +10,6 @@ Test strncasecmp() function : error conditions echo "*** Testing strncasecmp() function: error conditions ***\n"; $str1 = 'string_val'; $str2 = 'string_val'; -$len = 10; -$extra_arg = 10; - -echo "\n-- Testing strncasecmp() function with Zero arguments --"; -var_dump( strncasecmp() ); - -echo "\n-- Testing strncasecmp() function with less than expected number of arguments --"; -var_dump( strncasecmp($str1) ); -var_dump( strncasecmp($str1, $str2) ); - -echo "\n-- Testing strncasecmp() function with more than expected number of arguments --"; -var_dump( strncasecmp($str1, $str2, $len, $extra_arg) ); echo "\n-- Testing strncasecmp() function with invalid argument --"; $len = -10; @@ -31,21 +19,6 @@ echo "*** Done ***\n"; --EXPECTF-- *** Testing strncasecmp() function: error conditions *** --- Testing strncasecmp() function with Zero arguments -- -Warning: strncasecmp() expects exactly 3 parameters, 0 given in %s on line %d -NULL - --- Testing strncasecmp() function with less than expected number of arguments -- -Warning: strncasecmp() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: strncasecmp() expects exactly 3 parameters, 2 given in %s on line %d -NULL - --- Testing strncasecmp() function with more than expected number of arguments -- -Warning: strncasecmp() expects exactly 3 parameters, 4 given in %s on line %d -NULL - -- Testing strncasecmp() function with invalid argument -- Warning: Length must be greater than or equal to 0 in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strncmp_error.phpt b/ext/standard/tests/strings/strncmp_error.phpt index 4eb73eb318..13a4cb0350 100644 --- a/ext/standard/tests/strings/strncmp_error.phpt +++ b/ext/standard/tests/strings/strncmp_error.phpt @@ -12,13 +12,6 @@ Test strncmp() function : error conditions echo "*** Testing strncmp() function: error conditions ***\n"; $str1 = 'string_val'; $str2 = 'string_val'; -$len = 10; -$extra_arg = 10; - -var_dump( strncmp() ); //Zero argument -var_dump( strncmp($str1) ); //One argument, less than expected no. of args -var_dump( strncmp($str1, $str2) ); //Two arguments, less than expected no. of args -var_dump( strncmp($str1, $str2, $len, $extra_arg) ); //Four arguments, greater than expected no. of args /* Invalid argument for $len */ $len = -10; @@ -28,18 +21,6 @@ echo "*** Done ***\n"; --EXPECTF-- *** Testing strncmp() function: error conditions *** -Warning: strncmp() expects exactly 3 parameters, 0 given in %s on line %d -NULL - -Warning: strncmp() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: strncmp() expects exactly 3 parameters, 2 given in %s on line %d -NULL - -Warning: strncmp() expects exactly 3 parameters, 4 given in %s on line %d -NULL - Warning: Length must be greater than or equal to 0 in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strpbrk_error.phpt b/ext/standard/tests/strings/strpbrk_error.phpt index 658e2f429e..cce843c2f1 100644 --- a/ext/standard/tests/strings/strpbrk_error.phpt +++ b/ext/standard/tests/strings/strpbrk_error.phpt @@ -11,47 +11,17 @@ Test strpbrk() function : error conditions echo "*** Testing strpbrk() : error conditions ***\n"; $haystack = 'This is a Simple text.'; -$char_list = 'string_val'; -$extra_arg = 10; - -echo "\n-- Testing strpbrk() function with more than expected no. of arguments --\n"; -var_dump( strpbrk($haystack, $char_list, $extra_arg) ); - -echo "\n-- Testing strpbrk() function with less than expected no. of arguments --\n"; -var_dump( strpbrk($haystack) ); echo "\n-- Testing strpbrk() function with empty second argument --\n"; var_dump( strpbrk($haystack, '') ); -echo "\n-- Testing strpbrk() function with arrays --\n"; -var_dump( strpbrk($haystack, array('a', 'b', 'c') ) ); -var_dump( strpbrk(array('foo', 'bar'), 'b') ); - ?> ===DONE=== --EXPECTF-- *** Testing strpbrk() : error conditions *** --- Testing strpbrk() function with more than expected no. of arguments -- - -Warning: strpbrk() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) - --- Testing strpbrk() function with less than expected no. of arguments -- - -Warning: strpbrk() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) - -- Testing strpbrk() function with empty second argument -- Warning: strpbrk(): The character list cannot be empty in %s on line %d bool(false) - --- Testing strpbrk() function with arrays -- - -Warning: strpbrk() expects parameter 2 to be string, array given in %s on line %d -bool(false) - -Warning: strpbrk() expects parameter 1 to be string, array given in %s on line %d -bool(false) ===DONE=== diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt Binary files differindex 578539804d..4640b670f3 100644 --- a/ext/standard/tests/strings/strpos.phpt +++ b/ext/standard/tests/strings/strpos.phpt diff --git a/ext/standard/tests/strings/strpos_number.phpt b/ext/standard/tests/strings/strpos_number.phpt index fd045c64d3..76cf8e59ef 100644 --- a/ext/standard/tests/strings/strpos_number.phpt +++ b/ext/standard/tests/strings/strpos_number.phpt @@ -9,10 +9,7 @@ var_dump(strpos("foo bar", 111)); // string("11") is contained var_dump(strpos("foo 11", "11")); ?> ---EXPECTF-- -Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +--EXPECT-- +int(4) bool(false) - -Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -int(1) int(4) diff --git a/ext/standard/tests/strings/strrchr_variation1.phpt b/ext/standard/tests/strings/strrchr_variation1.phpt Binary files differindex 5043128945..a75dd96bbf 100644 --- a/ext/standard/tests/strings/strrchr_variation1.phpt +++ b/ext/standard/tests/strings/strrchr_variation1.phpt diff --git a/ext/standard/tests/strings/strrchr_variation10.phpt b/ext/standard/tests/strings/strrchr_variation10.phpt index 3b06b20be1..1004a3d915 100644 --- a/ext/standard/tests/strings/strrchr_variation10.phpt +++ b/ext/standard/tests/strings/strrchr_variation10.phpt @@ -121,7 +121,11 @@ $needles = array ( $count = 1; for($index = 0; $index < count($haystacks); $index++) { echo "-- Iteration $count --\n"; - var_dump( strrchr($haystacks[$index], $needles[$index]) ); + try { + var_dump( strrchr($haystacks[$index], $needles[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $count ++; } @@ -129,108 +133,58 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrchr() function with unexpected inputs for needle *** -- Iteration 1 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "0" -- Iteration 2 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 3 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(2) "-2" -- Iteration 5 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(4) "10.5" -- Iteration 6 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "-10.5" -- Iteration 7 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(2) "10" -- Iteration 8 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(2) "10" -- Iteration 9 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 10 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, array given -- Iteration 11 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, array given -- Iteration 12 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, array given -- Iteration 13 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, array given -- Iteration 14 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, array given -- Iteration 15 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 16 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 18 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 19 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 20 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 21 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(6) "object" -- Iteration 22 -- bool(false) -- Iteration 23 -- bool(false) -- Iteration 24 -- - -Warning: strrchr(): needle is not a string or an integer in %s on line %d -bool(false) +strrchr() expects parameter 2 to be string, resource given -- Iteration 25 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation11.phpt b/ext/standard/tests/strings/strrchr_variation11.phpt index 108ba2e0f2..79ffe4c2ec 100644 --- a/ext/standard/tests/strings/strrchr_variation11.phpt +++ b/ext/standard/tests/strings/strrchr_variation11.phpt @@ -80,7 +80,11 @@ $values = array ( $counter = 1; for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; - var_dump( strrchr($values[$index], $values[$index]) ); + try { + var_dump( strrchr($values[$index], $values[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -88,108 +92,58 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrchr() function: with unexpected inputs for haystack and needle *** -- Iteration 1 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "0" -- Iteration 2 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 3 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "12345" -- Iteration 4 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "-2345" -- Iteration 5 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(4) "10.5" -- Iteration 6 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(5) "-10.5" -- Iteration 7 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(10) "1234567000" -- Iteration 8 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(4) "1E-9" -- Iteration 9 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(3) "0.5" -- Iteration 10 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 11 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 12 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 13 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 14 -- - -Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, array given -- Iteration 15 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 16 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(1) "1" -- Iteration 18 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +string(6) "object" -- Iteration 20 -- bool(false) -- Iteration 21 -- bool(false) -- Iteration 22 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 23 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 24 -- - -Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d -NULL +strrchr() expects parameter 1 to be string, resource given -- Iteration 25 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrchr_variation12.phpt b/ext/standard/tests/strings/strrchr_variation12.phpt Binary files differindex 730811ea47..a17902604a 100644 --- a/ext/standard/tests/strings/strrchr_variation12.phpt +++ b/ext/standard/tests/strings/strrchr_variation12.phpt diff --git a/ext/standard/tests/strings/strrchr_variation2.phpt b/ext/standard/tests/strings/strrchr_variation2.phpt index ddce2c2ccb..2ff6720fb9 100644 --- a/ext/standard/tests/strings/strrchr_variation2.phpt +++ b/ext/standard/tests/strings/strrchr_variation2.phpt @@ -117,23 +117,15 @@ bool(false) string(5) "\101 " -- Iteration 12 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 14 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 15 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 16 -- @@ -221,9 +213,7 @@ bool(false) string(7) "4 \101 " -- Iteration 44 -- - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d -string(37) "*+-./:;<=>?@hello123456he \x234 \101 " +string(7) "4 \101 " -- Iteration 45 -- string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " diff --git a/ext/standard/tests/strings/strrchr_variation8.phpt b/ext/standard/tests/strings/strrchr_variation8.phpt index 6b49b698f4..31a727ed6f 100644 --- a/ext/standard/tests/strings/strrchr_variation8.phpt +++ b/ext/standard/tests/strings/strrchr_variation8.phpt @@ -30,15 +30,11 @@ foreach($needles as $needle) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrchr() function: with heredoc strings *** bool(false) bool(false) - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d bool(false) bool(false) bool(false) diff --git a/ext/standard/tests/strings/strripos.phpt b/ext/standard/tests/strings/strripos.phpt index 291ff78cd7..fa15e2fcac 100644 --- a/ext/standard/tests/strings/strripos.phpt +++ b/ext/standard/tests/strings/strripos.phpt @@ -15,9 +15,6 @@ strripos() function var_dump(@strripos("a", "")); var_dump(@strripos("", "a")); var_dump(@strripos("\\\\a", "\\a")); - - $fp = fopen(__FILE__, "r"); - var_dump(@strripos("", $fp)); ?> --EXPECT-- int(5) @@ -33,4 +30,3 @@ bool(false) bool(false) bool(false) int(1) -bool(false) diff --git a/ext/standard/tests/strings/strripos_offset.phpt b/ext/standard/tests/strings/strripos_offset.phpt index 70a9534ebd..5981c9b6cb 100644 --- a/ext/standard/tests/strings/strripos_offset.phpt +++ b/ext/standard/tests/strings/strripos_offset.phpt @@ -3,11 +3,12 @@ strripos() offset integer overflow --FILE-- <?php -var_dump(strripos("t", "t", PHP_INT_MAX+1)); -var_dump(strripos("tttt", "tt", PHP_INT_MAX+1)); -var_dump(strripos(100, 101, PHP_INT_MAX+1)); -var_dump(strripos(1024, 1024, PHP_INT_MAX+1)); -var_dump(strripos(array(), array(), PHP_INT_MAX+1)); +try { + var_dump(strripos("t", "t", PHP_INT_MAX+1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + var_dump(strripos(1024, 1024, -PHP_INT_MAX)); var_dump(strripos(1024, "te", -PHP_INT_MAX)); var_dump(strripos(1024, 1024, -PHP_INT_MAX-1)); @@ -16,22 +17,7 @@ var_dump(strripos(1024, "te", -PHP_INT_MAX-1)); echo "Done\n"; ?> --EXPECTF-- -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strripos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +strripos() expects parameter 3 to be int, float given Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d bool(false) @@ -39,8 +25,6 @@ bool(false) Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d bool(false) -Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strripos_variation1.phpt b/ext/standard/tests/strings/strripos_variation1.phpt index 59d7a64686..ce396695af 100644 --- a/ext/standard/tests/strings/strripos_variation1.phpt +++ b/ext/standard/tests/strings/strripos_variation1.phpt @@ -74,7 +74,7 @@ foreach ($needles as $needle) { } ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing strripos() function: with double quoted strings *** -- Iteration 1 -- int(28) @@ -132,57 +132,25 @@ int(8) bool(false) int(8) -- Iteration 12 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +bool(false) +bool(false) +bool(false) -- Iteration 13 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +bool(false) +bool(false) +bool(false) -- Iteration 14 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +bool(false) +bool(false) +bool(false) -- Iteration 15 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) +bool(false) +bool(false) +bool(false) -- Iteration 16 -- bool(false) bool(false) diff --git a/ext/standard/tests/strings/strripos_variation2.phpt b/ext/standard/tests/strings/strripos_variation2.phpt index 7b47b787be..3800c32155 100644 --- a/ext/standard/tests/strings/strripos_variation2.phpt +++ b/ext/standard/tests/strings/strripos_variation2.phpt @@ -75,7 +75,7 @@ foreach ($needles as $needle) { } ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing strripos() function: with single quoted strings *** -- Iteration 1 -- int(32) @@ -133,56 +133,24 @@ int(10) bool(false) int(10) -- Iteration 12 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 14 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 15 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 16 -- bool(false) @@ -280,18 +248,10 @@ bool(false) bool(false) bool(false) -- Iteration 35 -- - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) +bool(false) +bool(false) +bool(false) +bool(false) -- Iteration 36 -- int(0) bool(false) diff --git a/ext/standard/tests/strings/strrpos_offset.phpt b/ext/standard/tests/strings/strrpos_offset.phpt index 9ef4f42d18..d1bbc856a3 100644 --- a/ext/standard/tests/strings/strrpos_offset.phpt +++ b/ext/standard/tests/strings/strrpos_offset.phpt @@ -3,10 +3,12 @@ strrpos() offset integer overflow --FILE-- <?php -var_dump(strrpos("t", "t", PHP_INT_MAX+1)); -var_dump(strrpos("tttt", "tt", PHP_INT_MAX+1)); -var_dump(strrpos(100, 101, PHP_INT_MAX+1)); -var_dump(strrpos(1024, 1024, PHP_INT_MAX+1)); +try { + var_dump(strrpos("t", "t", PHP_INT_MAX+1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} + var_dump(strrpos(1024, 1024, -PHP_INT_MAX)); var_dump(strrpos(1024, "te", -PHP_INT_MAX)); var_dump(strrpos(1024, 1024, -PHP_INT_MAX-1)); @@ -15,19 +17,7 @@ var_dump(strrpos(1024, "te", -PHP_INT_MAX-1)); echo "Done\n"; ?> --EXPECTF-- -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d +strrpos() expects parameter 3 to be int, float given Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d bool(false) @@ -35,8 +25,6 @@ bool(false) Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d bool(false) -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/strrpos_variation1.phpt b/ext/standard/tests/strings/strrpos_variation1.phpt index fd236d04d4..4fc480face 100644 --- a/ext/standard/tests/strings/strrpos_variation1.phpt +++ b/ext/standard/tests/strings/strrpos_variation1.phpt @@ -72,7 +72,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function: with double quoted strings *** -- Iteration 1 -- int(28) @@ -108,32 +108,16 @@ int(9) int(8) bool(false) -- Iteration 12 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 13 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 14 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(8) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 16 -- bool(false) diff --git a/ext/standard/tests/strings/strrpos_variation10.phpt b/ext/standard/tests/strings/strrpos_variation10.phpt index b9b24b9cb1..440605d430 100644 --- a/ext/standard/tests/strings/strrpos_variation10.phpt +++ b/ext/standard/tests/strings/strrpos_variation10.phpt @@ -83,7 +83,11 @@ $needles = array ( $counter = 1; for($index = 0; $index < count($needles); $index ++) { echo "-- Iteration $counter --\n"; - var_dump( strrpos($haystack, $needles[$index]) ); + try { + var_dump( strrpos($haystack, $needles[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } @@ -91,108 +95,58 @@ fclose($file_handle); //closing the file handle echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function with unexpected values for needle *** -- Iteration 1 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(42) -- Iteration 2 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(41) -- Iteration 3 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 4 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 5 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(27) -- Iteration 6 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(21) -- Iteration 7 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 8 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 9 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(28) -- Iteration 10 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 11 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 12 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 13 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 14 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, array given -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(41) -- Iteration 16 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(41) -- Iteration 18 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) +int(64) -- Iteration 20 -- bool(false) -- Iteration 21 -- bool(false) -- Iteration 22 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 23 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 24 -- - -Warning: strrpos(): needle is not a string or an integer in %s on line %d -bool(false) +strrpos() expects parameter 2 to be string, resource given -- Iteration 25 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation11.phpt b/ext/standard/tests/strings/strrpos_variation11.phpt index 94c1b9d96d..71201a1c21 100644 --- a/ext/standard/tests/strings/strrpos_variation11.phpt +++ b/ext/standard/tests/strings/strrpos_variation11.phpt @@ -81,151 +81,79 @@ $counter = 1; for($index = 0; $index < count($values); $index ++) { echo "-- Iteration $counter --\n"; $haystack = $values[$index]; - var_dump( strrpos($values[$index], $values[$index]) ); - var_dump( strrpos($values[$index], $values[$index], 1) ); + try { + var_dump( strrpos($values[$index], $values[$index]) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( strrpos($values[$index], $values[$index], 1) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } $counter ++; } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function with unexpected values for haystack and needle *** -- Iteration 1 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 2 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 3 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 4 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 5 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 6 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 7 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 8 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 9 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 10 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 11 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 12 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 13 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 14 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, array given +strrpos() expects parameter 1 to be string, array given -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 16 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 17 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 18 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 19 -- - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -bool(false) - -Notice: Object of class sample could not be converted to int in %s on line %d - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +int(0) bool(false) -- Iteration 20 -- bool(false) @@ -234,38 +162,18 @@ bool(false) bool(false) bool(false) -- Iteration 22 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 23 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 24 -- - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) +strrpos() expects parameter 1 to be string, resource given +strrpos() expects parameter 1 to be string, resource given -- Iteration 25 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 26 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation15.phpt b/ext/standard/tests/strings/strrpos_variation15.phpt deleted file mode 100644 index 798a6877e4..0000000000 --- a/ext/standard/tests/strings/strrpos_variation15.phpt +++ /dev/null @@ -1,205 +0,0 @@ ---TEST-- -Test strrpos() function : usage variations - unexpected inputs for 'haystack', 'needle' & 'offset' arguments ---SKIPIF-- -<?php if (PHP_INT_SIZE !== 4) die("skip this test is for 32-bit only"); ---FILE-- -<?php -/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] ); - * Description: Find position of last occurrence of 'needle' in 'haystack'. - * Source code: ext/standard/string.c -*/ - -/* Test strrpos() function with unexpected inputs for 'haystack', 'needle' & 'offset' arguments */ - -echo "*** Testing strrpos() function: with unexpected values for haystack, needle & offset ***\n"; - -// get an unset variable -$unset_var = 'string_val'; -unset($unset_var); - -// defining a class -class sample { - public function __toString() { - return "object"; - } -} - -//getting the resource -$file_handle = fopen(__FILE__, "r"); - -// array with different values -$values = array ( - - // integer values - 0, - 1, - 12345, - -2345, - - // float values - 10.5, - -10.5, - 10.5e10, - 10.6E-10, - .5, - - // array values - array(), - array(0), - array(1), - array(1, 2), - array('color' => 'red', 'item' => 'pen'), - - // boolean values - true, - false, - TRUE, - FALSE, - - // objects - new sample(), - - // empty string - "", - '', - - // null values - NULL, - null, - - //resource - $file_handle, - - // undefined variable - @$undefined_var, - - // unset variable - @$unset_var -); - - -// loop through each element of the array and check the working of strrpos() -$counter = 1; -for($index = 0; $index < count($values); $index ++) { - echo "-- Iteration $counter --\n"; - var_dump( strrpos($values[$index], $values[$index], $values[$index]) ); - $counter ++; -} - -echo "*** Done ***"; -?> ---EXPECTF-- -*** Testing strrpos() function: with unexpected values for haystack, needle & offset *** --- Iteration 1 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 2 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 3 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 4 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 5 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 6 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d - -Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d -bool(false) --- Iteration 7 -- - -Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d -bool(false) --- Iteration 8 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 9 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 10 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 11 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 12 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 13 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 14 -- - -Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d -bool(false) --- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 16 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 17 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 18 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 19 -- - -Warning: strrpos() expects parameter 3 to be int, object given in %s on line %d -bool(false) --- Iteration 20 -- - -Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d -bool(false) --- Iteration 21 -- - -Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d -bool(false) --- Iteration 22 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 23 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 24 -- - -Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d -bool(false) --- Iteration 25 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) --- Iteration 26 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d -bool(false) -*** Done *** diff --git a/ext/standard/tests/strings/strrpos_variation2.phpt b/ext/standard/tests/strings/strrpos_variation2.phpt index 9c0a320785..af5c9e349d 100644 --- a/ext/standard/tests/strings/strrpos_variation2.phpt +++ b/ext/standard/tests/strings/strrpos_variation2.phpt @@ -73,7 +73,7 @@ for($index=0; $index<count($needle); $index++) { } echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function: with single quoted strings *** -- Iteration 1 -- int(32) @@ -109,32 +109,16 @@ bool(false) int(10) int(10) -- Iteration 12 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 13 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 14 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 15 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) -- Iteration 16 -- bool(false) @@ -194,11 +178,7 @@ bool(false) bool(false) bool(false) -- Iteration 35 -- - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d -int(23) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d +bool(false) bool(false) -- Iteration 36 -- int(0) diff --git a/ext/standard/tests/strings/strrpos_variation7.phpt b/ext/standard/tests/strings/strrpos_variation7.phpt index 54db4b372e..c0546c74f8 100644 --- a/ext/standard/tests/strings/strrpos_variation7.phpt +++ b/ext/standard/tests/strings/strrpos_variation7.phpt @@ -22,15 +22,11 @@ var_dump( strrpos($empty_string, NULL) ); echo "*** Done ***"; ?> ---EXPECTF-- +--EXPECT-- *** Testing strrpos() function: with heredoc strings *** -- With empty heredoc string -- bool(false) bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) - -Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt Binary files differindex 2908de7a27..6bdc3feab1 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 c0ad1d0115..ff631754df 100644 --- a/ext/standard/tests/strings/strtolower-win32.phpt +++ b/ext/standard/tests/strings/strtolower-win32.phpt diff --git a/ext/standard/tests/strings/strtolower.phpt b/ext/standard/tests/strings/strtolower.phpt Binary files differindex 47dfe09762..7c7e2bb4c7 100644 --- a/ext/standard/tests/strings/strtolower.phpt +++ b/ext/standard/tests/strings/strtolower.phpt diff --git a/ext/standard/tests/strings/strtoupper1-win32.phpt b/ext/standard/tests/strings/strtoupper1-win32.phpt Binary files differindex 60701652e1..7240e5c021 100644 --- a/ext/standard/tests/strings/strtoupper1-win32.phpt +++ b/ext/standard/tests/strings/strtoupper1-win32.phpt diff --git a/ext/standard/tests/strings/strtoupper1.phpt b/ext/standard/tests/strings/strtoupper1.phpt Binary files differindex e0ebf42ea7..c243ff10c7 100644 --- a/ext/standard/tests/strings/strtoupper1.phpt +++ b/ext/standard/tests/strings/strtoupper1.phpt diff --git a/ext/standard/tests/strings/strval_error.phpt b/ext/standard/tests/strings/strval_error.phpt index 37ecfd14d5..acf3cc623a 100644 --- a/ext/standard/tests/strings/strval_error.phpt +++ b/ext/standard/tests/strings/strval_error.phpt @@ -16,17 +16,6 @@ class MyClass // no toString() method defined } -$string = "Hello"; -$extra_arg = 10; - -//Test strval with one more than the expected number of arguments -echo "\n-- Testing strval() function with more than expected no. of arguments --\n"; -var_dump( strval($string, $extra_arg) ); - -// Testing strval with one less than the expected number of arguments -echo "\n-- Testing strval() function with less than expected no. of arguments --\n"; -var_dump( strval() ); - // Testing strval with a object which has no toString() method echo "\n-- Testing strval() function with object which has not toString() method --\n"; var_dump( strval(new MyClass()) ); @@ -36,16 +25,6 @@ var_dump( strval(new MyClass()) ); --EXPECTF-- *** Testing strval() : error conditions *** --- Testing strval() function with more than expected no. of arguments -- - -Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Testing strval() function with less than expected no. of arguments -- - -Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -- Testing strval() function with object which has not toString() method -- Recoverable fatal error: Object of class MyClass could not be converted to string in %s on line %d diff --git a/ext/standard/tests/strings/substr.phpt b/ext/standard/tests/strings/substr.phpt Binary files differindex 0901d2082e..18e7cd1781 100644 --- a/ext/standard/tests/strings/substr.phpt +++ b/ext/standard/tests/strings/substr.phpt diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt index 1fdf1b144f..2e3256631c 100644 --- a/ext/standard/tests/strings/substr_compare.phpt +++ b/ext/standard/tests/strings/substr_compare.phpt @@ -12,11 +12,9 @@ var_dump(substr_compare("abcde", "cd", 1, 2) < 0); var_dump(substr_compare("abcde", "abc", 5, 1)); var_dump(substr_compare("abcde", "abcdef", -10, 10) < 0); var_dump(substr_compare("abcde", "abc", 0, 0)); -var_dump(substr_compare("abcde", -1, 0, NULL, new stdClass)); echo "Test\n"; var_dump(substr_compare("abcde", "abc", 0, -1)); var_dump(substr_compare("abcde", "abc", -1, NULL, -5) > 0); -var_dump(substr_compare("abcde", -1, 0, "str", new stdClass)); echo "Done\n"; ?> @@ -32,15 +30,9 @@ Warning: substr_compare(): The start position cannot exceed initial string lengt bool(false) bool(true) int(0) - -Warning: substr_compare() expects parameter 5 to be bool, object given in %s on line %d -bool(false) Test Warning: substr_compare(): The length must be greater than or equal to zero in %s on line %d bool(false) bool(true) - -Warning: substr_compare() expects parameter 4 to be int, string given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/strings/substr_count_error.phpt b/ext/standard/tests/strings/substr_count_error.phpt index eecc251e6c..246963d13b 100644 --- a/ext/standard/tests/strings/substr_count_error.phpt +++ b/ext/standard/tests/strings/substr_count_error.phpt @@ -6,12 +6,6 @@ Test substr_count() function (error conditions) echo "\n*** Testing error conditions ***\n"; $str = 'abcdefghik'; -/* Zero argument */ -var_dump( substr_count() ); - -/* more than expected no. of args */ -var_dump( substr_count($str, "t", 0, 15, 30) ); - /* offset before start */ var_dump(substr_count($str, "t", -20)); @@ -22,9 +16,6 @@ var_dump(substr_count($str, "t", 25)); Warning message expected, as length+offset > length of string */ var_dump( substr_count($str, "i", 5, 7) ); -/* Invalid offset argument */ -var_dump( substr_count($str, "t", "") ); - /* length too small */ var_dump( substr_count($str, "t", 2, -20) ); @@ -34,12 +25,6 @@ echo "Done\n"; --EXPECTF-- *** Testing error conditions *** -Warning: substr_count() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: substr_count() expects at most 4 parameters, 5 given in %s on line %d -NULL - Warning: substr_count(): Offset not contained in string in %s on line %d bool(false) @@ -49,9 +34,6 @@ bool(false) Warning: substr_count(): Invalid length value in %s on line %d bool(false) -Warning: substr_count() expects parameter 3 to be int, string given in %s on line %d -NULL - Warning: substr_count(): Invalid length value in %s on line %d bool(false) Done diff --git a/ext/standard/tests/strings/substr_count_variation_001.phpt b/ext/standard/tests/strings/substr_count_variation_001.phpt index 71f2d223e1..19a9a0310d 100644 --- a/ext/standard/tests/strings/substr_count_variation_001.phpt +++ b/ext/standard/tests/strings/substr_count_variation_001.phpt @@ -12,9 +12,6 @@ var_dump( substr_count($str, "i", "5t") ); var_dump( substr_count($str, "i", "5t", "10t") ); echo "\n-- 3rd or 4th arg as NULL --\n"; -var_dump( substr_count($str, "t", "") ); -var_dump( substr_count($str, "T", "") ); -var_dump( substr_count($str, "t", "", 15) ); var_dump( substr_count($str, "I", NULL) ); var_dump( substr_count($str, "i", NULL, 10) ); @@ -67,15 +64,6 @@ Notice: A non well formed numeric value encountered in %s on line %d int(2) -- 3rd or 4th arg as NULL -- - -Warning: substr_count() expects parameter 3 to be int, string given %s on line %d -NULL - -Warning: substr_count() expects parameter 3 to be int, string given %s on line %d -NULL - -Warning: substr_count() expects parameter 3 to be int, string given %s on line %d -NULL int(0) int(2) diff --git a/ext/standard/tests/strings/substr_replace_error.phpt b/ext/standard/tests/strings/substr_replace_error.phpt index ac945349fe..936d0fd1d5 100644 --- a/ext/standard/tests/strings/substr_replace_error.phpt +++ b/ext/standard/tests/strings/substr_replace_error.phpt @@ -15,13 +15,6 @@ echo "*** Testing substr_replace() : error conditions ***\n"; $s1 = "Good morning"; -echo "\n-- Testing substr_replace() function with less than expected no. of arguments --\n"; -var_dump(substr_replace()); -var_dump(substr_replace($s1, "evening")); - -echo "\n-- Testing substr_replace() function with more than expected no. of arguments --\n"; -var_dump(substr_replace($s1, "evening", 5, 7, true)); - echo "\n-- Testing substr_replace() function with start and length different types --\n"; var_dump(substr_replace($s1, "evening", array(5))); var_dump(substr_replace($s1, "evening", 5, array(8))); @@ -37,19 +30,6 @@ var_dump(substr_replace($s1, "evening", array(5), array(8))); --EXPECTF-- *** Testing substr_replace() : error conditions *** --- Testing substr_replace() function with less than expected no. of arguments -- - -Warning: substr_replace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: substr_replace() expects at least 3 parameters, 2 given in %s on line %d -NULL - --- Testing substr_replace() function with more than expected no. of arguments -- - -Warning: substr_replace() expects at most 4 parameters, 5 given in %s on line %d -NULL - -- Testing substr_replace() function with start and length different types -- Warning: substr_replace(): 'start' and 'length' should be of same type - numerical or array in %s on line %d diff --git a/ext/standard/tests/strings/trim1.phpt b/ext/standard/tests/strings/trim1.phpt Binary files differindex d0e4070d80..1ad504c61d 100644 --- a/ext/standard/tests/strings/trim1.phpt +++ b/ext/standard/tests/strings/trim1.phpt diff --git a/ext/standard/tests/strings/trim_error.phpt b/ext/standard/tests/strings/trim_error.phpt index b845cee1ac..046a2b04f9 100644 --- a/ext/standard/tests/strings/trim_error.phpt +++ b/ext/standard/tests/strings/trim_error.phpt @@ -11,14 +11,6 @@ Test trim() function : error conditions echo "*** Testing trim() : error conditions ***\n"; -echo "\n-- Testing trim() function with no arguments --\n"; -var_dump( trim() ); - -echo "\n-- Testing trim() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( trim("Hello World", "Heo", $extra_arg) ); - - $hello = " Hello World\n"; echo "\n-- Test trim function with various invalid charlists --\n"; var_dump(trim($hello, "..a")); @@ -31,16 +23,6 @@ var_dump(trim($hello, "a..b..c")); --EXPECTF-- *** Testing trim() : error conditions *** --- Testing trim() function with no arguments -- - -Warning: trim() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing trim() function with more than expected no. of arguments -- - -Warning: trim() expects at most 2 parameters, 3 given in %s on line %d -NULL - -- Test trim function with various invalid charlists -- Warning: trim(): Invalid '..'-range, no character to the left of '..' in %s on line %d diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt Binary files differindex b524b45e59..3508881d3c 100644 --- a/ext/standard/tests/strings/ucfirst.phpt +++ b/ext/standard/tests/strings/ucfirst.phpt diff --git a/ext/standard/tests/strings/unpack_error.phpt b/ext/standard/tests/strings/unpack_error.phpt index f04e493772..b34be23267 100644 --- a/ext/standard/tests/strings/unpack_error.phpt +++ b/ext/standard/tests/strings/unpack_error.phpt @@ -10,13 +10,6 @@ Test unpack() function : error conditions echo "*** Testing unpack() : error conditions ***\n"; -echo "\n-- Testing unpack() function with no arguments --\n"; -var_dump( unpack() ); - -echo "\n-- Testing unpack() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump(unpack("I", pack("I", 65534), 0, $extra_arg)); - echo "\n-- Testing unpack() function with invalid format character --\n"; $extra_arg = 10; var_dump(unpack("B", pack("I", 65534))); @@ -25,16 +18,6 @@ var_dump(unpack("B", pack("I", 65534))); --EXPECTF-- *** Testing unpack() : error conditions *** --- Testing unpack() function with no arguments -- - -Warning: unpack() expects at least 2 parameters, 0 given in %s on line %d -NULL - --- Testing unpack() function with more than expected no. of arguments -- - -Warning: unpack() expects at most 3 parameters, 4 given in %s on line %d -NULL - -- Testing unpack() function with invalid format character -- Warning: unpack(): Invalid format type B in %s on line %d diff --git a/ext/standard/tests/strings/uuencode.phpt b/ext/standard/tests/strings/uuencode.phpt index 5a1f3d2a24..8199a2ed05 100644 --- a/ext/standard/tests/strings/uuencode.phpt +++ b/ext/standard/tests/strings/uuencode.phpt @@ -3,9 +3,6 @@ uuencode family tests --FILE-- <?php -var_dump(convert_uuencode(array())); -var_dump(convert_uudecode(array())); - var_dump(convert_uuencode("")); var_dump(convert_uudecode("")); var_dump($enc = convert_uuencode("~!@#$%^&*()_}{POIUYTREWQQSDFGHJKL:<MNBVCXZ")); @@ -18,11 +15,6 @@ var_dump(convert_uudecode(substr($enc, 0, -10))); echo "Done\n"; ?> --EXPECTF-- -Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d -bool(false) bool(false) bool(false) string(60) "J?B%`(R0E7B8J*"E??7M03TE5651215=145-$1D=(2DM,.CQ-3D)60UA: diff --git a/ext/standard/tests/strings/vfprintf_error1.phpt b/ext/standard/tests/strings/vfprintf_error1.phpt index c56631ecd7..b4548e8b49 100644 --- a/ext/standard/tests/strings/vfprintf_error1.phpt +++ b/ext/standard/tests/strings/vfprintf_error1.phpt @@ -20,8 +20,16 @@ echo "\n-- Testing vfprintf() function with more than expected no. of arguments $format = 'string_val'; $args = array( 1, 2 ); $extra_arg = 10; -var_dump( vfprintf( $fp, $format, $args, $extra_arg ) ); -var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) ); +try { + var_dump( vfprintf( $fp, $format, $args, $extra_arg ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // Close handle fclose($fp); @@ -37,10 +45,6 @@ unlink( $file ); ?> --EXPECTF-- -- Testing vfprintf() function with more than expected no. of arguments -- - -Warning: Wrong parameter count for vfprintf() in %s on line %d -NULL - -Warning: Wrong parameter count for vfprintf() in %s on line %d -NULL +Wrong parameter count for vfprintf() +Wrong parameter count for vfprintf() ===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_error4.phpt b/ext/standard/tests/strings/vfprintf_error4.phpt index 2865d42a9e..e54e34f4cd 100644 --- a/ext/standard/tests/strings/vfprintf_error4.phpt +++ b/ext/standard/tests/strings/vfprintf_error4.phpt @@ -17,7 +17,11 @@ $file = 'vfprintf_error4.txt'; $fp = fopen( $file, "a+" ); echo "\n-- Testing vfprintf() function with other strangeties --\n"; -var_dump( vfprintf( 'foo', 'bar', array( 'baz' ) ) ); +try { + var_dump( vfprintf( 'foo', 'bar', array( 'baz' ) ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump( vfprintf( $fp, 'Foo %$c-0202Sd', array( 2 ) ) ); // Close handle @@ -34,9 +38,7 @@ unlink( $file ); ?> --EXPECTF-- -- Testing vfprintf() function with other strangeties -- - -Warning: vfprintf() expects parameter 1 to be resource, string given in %s on line %d -bool(false) +vfprintf() expects parameter 1 to be resource, string given Warning: vfprintf(): Argument number must be greater than zero in %s on line %d bool(false) diff --git a/ext/standard/tests/strings/vfprintf_variation1.phpt b/ext/standard/tests/strings/vfprintf_variation1.phpt index 76422011c2..7c969ffff9 100644 --- a/ext/standard/tests/strings/vfprintf_variation1.phpt +++ b/ext/standard/tests/strings/vfprintf_variation1.phpt @@ -48,8 +48,6 @@ writeAndDump( $fp, "%s %s %s", array( 'bar', 'bar', 'bar' ) ); writeAndDump( $fp, "%02d", array( 50 ) ); writeAndDump( $fp, "", array() ); writeAndDump( $fp, "Testing %b %d %f %o %s %x %X", array( 9, 6, 2.5502, 24, "foobar", 15, 65 ) ); -@writeAndDump( $funset, "Foo with %s", array( 'string' ) ); -@writeAndDump( new FooClass(), "Foo with %s", array( 'string' ) ); // Close handle fclose( $fp ); @@ -79,8 +77,4 @@ string(0) "" int(0) string(38) "Testing 1001 6 2.550200 30 foobar f 41" int(38) -bool(false) -bool(false) -bool(false) -bool(false) ===DONE=== diff --git a/ext/standard/tests/strings/wordwrap_error.phpt b/ext/standard/tests/strings/wordwrap_error.phpt index 41c5cbdb69..ad75461d3d 100644 --- a/ext/standard/tests/strings/wordwrap_error.phpt +++ b/ext/standard/tests/strings/wordwrap_error.phpt @@ -9,19 +9,10 @@ Test wordwrap() function : error conditions echo "*** Testing wordwrap() : error conditions ***\n"; -// Zero argument -echo "\n-- Testing wordwrap() function with Zero arguments --\n"; -var_dump( wordwrap() ); - -// More than expected number of arguments -echo "\n-- Testing wordwrap() function with more than expected no. of arguments --\n"; $str = 'testing wordwrap function'; $width = 10; $break = '<br />\n'; $cut = true; -$extra_arg = "extra_arg"; - -var_dump( wordwrap($str, $width, $break, $cut, $extra_arg) ); // $width arg as negative value echo "\n-- Testing wordwrap() function with negative/zero value for width argument --\n"; @@ -54,16 +45,6 @@ echo "Done\n"; --EXPECTF-- *** Testing wordwrap() : error conditions *** --- Testing wordwrap() function with Zero arguments -- - -Warning: wordwrap() expects at least 1 parameter, 0 given in %s on line %d -NULL - --- Testing wordwrap() function with more than expected no. of arguments -- - -Warning: wordwrap() expects at most 4 parameters, 5 given in %s on line %d -NULL - -- Testing wordwrap() function with negative/zero value for width argument -- -- width = 0 & cut = false -- string(39) "testing<br />\nwordwrap<br />\nfunction" diff --git a/ext/standard/tests/time/strptime_error.phpt b/ext/standard/tests/time/strptime_error.phpt index f49025be44..3f7bbbdb82 100644 --- a/ext/standard/tests/time/strptime_error.phpt +++ b/ext/standard/tests/time/strptime_error.phpt @@ -19,20 +19,8 @@ date_default_timezone_set("Europe/London"); echo "*** Testing strptime() : error conditions ***\n"; -echo "\n-- Testing strptime() function with Zero arguments --\n"; -var_dump( strptime() ); - -echo "\n-- Testing strptime() function with less than expected no. of arguments --\n"; -$format = '%b %d %Y %H:%M:%S'; -$timestamp = mktime(8, 8, 8, 8, 8, 2008); -$date = strftime($format, $timestamp); -var_dump( strptime($date) ); - -echo "\n-- Testing strptime() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( strptime($date, $format, $extra_arg) ); - echo "\n-- Testing strptime() function on failure --\n"; +$format = '%b %d %Y %H:%M:%S'; var_dump( strptime('foo', $format) ); ?> @@ -40,21 +28,6 @@ var_dump( strptime('foo', $format) ); --EXPECTF-- *** Testing strptime() : error conditions *** --- Testing strptime() function with Zero arguments -- - -Warning: strptime() expects exactly 2 parameters, 0 given in %s on line %d -NULL - --- Testing strptime() function with less than expected no. of arguments -- - -Warning: strptime() expects exactly 2 parameters, 1 given in %s on line %d -NULL - --- Testing strptime() function with more than expected no. of arguments -- - -Warning: strptime() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -- Testing strptime() function on failure -- bool(false) ===DONE=== diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c index 34e877707c..bc1010243e 100644 --- a/ext/standard/user_filters.c +++ b/ext/standard/user_filters.c @@ -164,7 +164,7 @@ php_stream_filter_status_t userfilter_filter( zval func_name; zval retval; zval args[4]; - zval zpropname; + zend_string *propname; int call_result; /* the userfilter object probably doesn't exist anymore */ @@ -239,9 +239,9 @@ php_stream_filter_status_t userfilter_filter( /* filter resources are cleaned up by the stream destructor, * keeping a reference to the stream resource here would prevent it * from being destroyed properly */ - ZVAL_STRINGL(&zpropname, "stream", sizeof("stream")-1); - Z_OBJ_HANDLER_P(obj, unset_property)(obj, &zpropname, NULL); - zval_ptr_dtor(&zpropname); + propname = zend_string_init("stream", sizeof("stream")-1, 0); + Z_OBJ_HANDLER_P(obj, unset_property)(Z_OBJ_P(obj), propname, NULL); + zend_string_release_ex(propname, 0); zval_ptr_dtor(&args[3]); zval_ptr_dtor(&args[2]); |