diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index ad6fc54aeb3ea..865ce15386ab1 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2494,12 +2494,7 @@ PHP_METHOD(SplFileObject, fscanf) RETURN_THROWS(); } - int result = php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), ZSTR_VAL(format_str), (int)num_varargs, varargs, 0, return_value); - - if (SCAN_ERROR_WRONG_PARAM_COUNT == result) { - zend_wrong_param_count(); - RETURN_THROWS(); - } + php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), ZSTR_LEN(intern->u.file.current_line), format_str, 1, num_varargs, varargs, return_value); } /* }}} */ diff --git a/ext/standard/file.c b/ext/standard/file.c index fdeabd1872d20..cdce0d0f84d7d 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -928,17 +928,17 @@ PHPAPI PHP_FUNCTION(fgetc) /* {{{ Implements a mostly ANSI compatible fscanf() */ PHP_FUNCTION(fscanf) { - int result, argc = 0; - size_t format_len; + uint32_t argc = 0; zval *args = NULL; zval *file_handle; - char *buf, *format; + char *buf; + zend_string *format; size_t len; void *what; ZEND_PARSE_PARAMETERS_START(2, -1) Z_PARAM_RESOURCE(file_handle) - Z_PARAM_STRING(format, format_len) + Z_PARAM_STR(format) Z_PARAM_VARIADIC('*', args, argc) ZEND_PARSE_PARAMETERS_END(); @@ -956,14 +956,9 @@ PHP_FUNCTION(fscanf) RETURN_FALSE; } - result = php_sscanf_internal(buf, format, argc, args, 0, return_value); + php_sscanf_internal(buf, len, format, 2, argc, args, return_value); efree(buf); - - if (SCAN_ERROR_WRONG_PARAM_COUNT == result) { - zend_wrong_param_count(); - RETURN_THROWS(); - } } /* }}} */ diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 408e5ede88812..9c0f8ab352ee4 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -65,13 +65,8 @@ #include #include #include "php.h" -#include "php_variables.h" #include -#include "zend_execute.h" -#include "zend_operators.h" #include "zend_strtod.h" -#include "php_globals.h" -#include "basic_functions.h" #include "scanf.h" /* @@ -80,7 +75,6 @@ #define SCAN_NOSKIP 0x1 /* Don't skip blanks. */ #define SCAN_SUPPRESS 0x2 /* Suppress assignment. */ #define SCAN_UNSIGNED 0x4 /* Read an unsigned value. */ -#define SCAN_WIDTH 0x8 /* A width value was supplied. */ #define SCAN_SIGNOK 0x10 /* A +/- character is allowed. */ #define SCAN_NODIGITS 0x20 /* No digits have been scanned. */ @@ -111,10 +105,10 @@ typedef zend_long (*int_string_formater)(const char*, char**, int); /* * Declarations for functions used only in this file. */ -static char *BuildCharSet(CharSet *cset, char *format); -static int CharInSet(CharSet *cset, int ch); +static const char * BuildCharSet(CharSet *cset, const char *format); +static bool CharInSet(const CharSet *cset, char c); static void ReleaseCharSet(CharSet *cset); -static inline void scan_set_error_return(int numVars, zval *return_value); +static inline void scan_set_error_return(bool assignToVariables, zval *return_value); /* {{{ BuildCharSet @@ -134,11 +128,11 @@ static inline void scan_set_error_return(int numVars, zval *return_value); * *---------------------------------------------------------------------- */ -static char * BuildCharSet(CharSet *cset, char *format) +static const char * BuildCharSet(CharSet *cset, const char *format) { - char *ch, start; + const char *ch; int nranges; - char *end; + const char *end; memset(cset, 0, sizeof(CharSet)); @@ -175,7 +169,7 @@ static char * BuildCharSet(CharSet *cset, char *format) */ cset->nchars = cset->nranges = 0; ch = format++; - start = *ch; + char start = *ch; if (*ch == ']' || *ch == '-') { cset->chars[cset->nchars++] = *ch; ch = format++; @@ -235,22 +229,22 @@ static char * BuildCharSet(CharSet *cset, char *format) * *---------------------------------------------------------------------- */ -static int CharInSet(CharSet *cset, int c) +static bool CharInSet(const CharSet *cset, char c) { - char ch = (char) c; - int i, match = 0; + int i; + bool match = false; for (i = 0; i < cset->nchars; i++) { - if (cset->chars[i] == ch) { - match = 1; + if (cset->chars[i] == c) { + match = true; break; } } if (!match) { for (i = 0; i < cset->nranges; i++) { - if ((cset->ranges[i].start <= ch) - && (ch <= cset->ranges[i].end)) { - match = 1; + if ((cset->ranges[i].start <= c) + && (c <= cset->ranges[i].end)) { + match = true; break; } } @@ -304,14 +298,17 @@ static void ReleaseCharSet(CharSet *cset) * *---------------------------------------------------------------------- */ -PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs) +static bool isFormatStringValid(const zend_string *zstr_format, uint32_t format_arg_num, uint32_t numVars, uint32_t *totalSubs) { #define STATIC_LIST_SIZE 16 - int gotXpg, gotSequential, value, i, flags; - char *end, *ch = NULL; - int staticAssign[STATIC_LIST_SIZE]; - int *nassign = staticAssign; - int objIndex, xpgSize, nspace = STATIC_LIST_SIZE; + bool gotXpg = false; + bool gotSequential = false; + uint32_t staticAssign[STATIC_LIST_SIZE]; + uint32_t *nassign = staticAssign; + uint32_t objIndex = 0; + uint32_t xpgSize = 0; + uint32_t nspace = STATIC_LIST_SIZE; + bool bindToVariables = numVars; /* * Initialize an array that records the number of times a variable @@ -319,105 +316,134 @@ PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs) * a variable is multiply assigned or left unassigned. */ if (numVars > nspace) { - nassign = (int*)safe_emalloc(sizeof(int), numVars, 0); + nassign = safe_emalloc(sizeof(uint32_t), numVars, 0); nspace = numVars; } - for (i = 0; i < nspace; i++) { - nassign[i] = 0; - } - - xpgSize = objIndex = gotXpg = gotSequential = 0; + memset(nassign, 0, sizeof(uint32_t)*numVars); - while (*format != '\0') { - ch = format++; - flags = 0; - - if (*ch != '%') { + const char *end_ptr = ZSTR_VAL(zstr_format) + ZSTR_LEN(zstr_format); + for (const char *ptr = ZSTR_VAL(zstr_format); ptr < end_ptr; ptr++) { + bool isCurrentSpecifierBound = true; + /* Look for specifier start */ + if (*ptr != '%') { continue; } - ch = format++; - if (*ch == '%') { - continue; + ptr++; + + if (UNEXPECTED(ptr == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated format specifier"); + goto error; } - if (*ch == '*') { - flags |= SCAN_SUPPRESS; - ch = format++; - goto xpgCheckDone; + + /* Literal % so continue */ + if (*ptr == '%') { + continue; + } else if (*ptr == '*') { + /* Consumed specifier but not assigned to variable */ + isCurrentSpecifierBound = false; + ptr++; + if (UNEXPECTED(ptr == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated format specifier"); + goto error; + } } - if ( isdigit( (int)*ch ) ) { - /* - * Check for an XPG3-style %n$ specification. Note: there - * must not be a mixture of XPG3 specs and non-XPG3 specs + if (isdigit(*ptr)) { + /* We might either have an XPG3-style %n$ specification, + * or we are parsing the _maximum field width_ of the specifier. + * + * Note: there must not be a mixture of XPG3 specs and non-XPG3 specs * in the same format string. */ - value = ZEND_STRTOUL(format-1, &end, 10); - if (*end != '$') { - goto notXpg; - } - format = end+1; - ch = format++; - gotXpg = 1; - if (gotSequential) { - goto mixedXPG; + + char *width_end = NULL; + zend_ulong width = ZEND_STRTOUL(ptr, &width_end, 10); + if (UNEXPECTED(width_end == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated format specifier"); + goto error; } - if ((value < 1) || (numVars && (value > numVars))) { - goto badIndex; - } else if (numVars == 0) { - /* - * In the case where no vars are specified, the user can - * specify %9999$ legally, so we have to consider special - * rules for growing the assign array. 'value' is - * guaranteed to be > 0. - */ + ptr = width_end; - /* set a lower artificial limit on this - * in the interest of security and resource friendliness - * 255 arguments should be more than enough. - cc - */ - if (value > SCAN_MAX_ARGS) { - goto badIndex; + if (*ptr != '$' && isCurrentSpecifierBound) { + gotSequential = true; + } else { + /* We indeed have an XPG3 style spec */ + ptr++; + if (UNEXPECTED(ptr == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated format specifier"); + goto error; + } + if (UNEXPECTED(gotSequential)) { + zend_argument_value_error(format_arg_num, "cannot mix \"%%\" and \"%%n$\" conversion specifiers"); + goto error; } - xpgSize = (xpgSize > value) ? xpgSize : value; - } - objIndex = value - 1; - goto xpgCheckDone; - } + zend_ulong argument_index = width; + gotXpg = true; -notXpg: - gotSequential = 1; - if (gotXpg) { -mixedXPG: - zend_value_error("%s", "cannot mix \"%\" and \"%n$\" conversion specifiers"); - goto error; - } + if (UNEXPECTED(argument_index < 1 || (bindToVariables && argument_index > numVars))) { + zend_argument_value_error(format_arg_num, "argument index %%%" ZEND_ULONG_FMT_SPEC "$ is out of range", argument_index); + goto error; + } else if (!bindToVariables) { + /* + * In the case where no vars are specified, the user can + * specify %9999$ legally, so we have to consider special + * rules for growing the assign array. 'value' is + * guaranteed to be > 0. + */ -xpgCheckDone: - /* - * Parse any width specifier. - */ - if (isdigit(UCHAR(*ch))) { - value = ZEND_STRTOUL(format-1, &format, 10); - flags |= SCAN_WIDTH; - ch = format++; + /* set a lower artificial limit on this + * in the interest of security and resource friendliness + * 255 arguments should be more than enough. - cc + */ + if (argument_index > SCAN_MAX_ARGS) { + // TODO Specify limit? + zend_argument_value_error(format_arg_num, "argument index %%%" ZEND_ULONG_FMT_SPEC "$ is out of range", argument_index); + goto error; + } + + xpgSize = MAX(argument_index, xpgSize); + } + objIndex = argument_index - 1; + + /* Check if we have a width argument with the XPG3 specifier */ + if (!isdigit(*ptr)) { + goto length_modifier; + } + /* Grab the width to be able to continue */ + width = ZEND_STRTOUL(ptr, &width_end, 10); + if (UNEXPECTED(width_end == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated format specifier"); + goto error; + } + ptr = width_end; + } + } else if (isCurrentSpecifierBound) { + if (UNEXPECTED(gotXpg)) { + zend_argument_value_error(format_arg_num, "cannot mix \"%%\" and \"%%n$\" conversion specifiers"); + goto error; + } + gotSequential = true; } - /* - * Ignore size specifier. - */ - if ((*ch == 'l') || (*ch == 'L') || (*ch == 'h')) { - ch = format++; +length_modifier: + /* Ignore length modifier */ + if (*ptr == 'l' || *ptr == 'L' || *ptr == 'h') { + ptr++; + if (UNEXPECTED(ptr == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated format specifier"); + goto error; + } } - if (!(flags & SCAN_SUPPRESS) && numVars && (objIndex >= numVars)) { - goto badIndex; + if (isCurrentSpecifierBound && bindToVariables && (objIndex >= numVars)) { + zend_argument_value_error(format_arg_num, "Different numbers of variable names and field specifiers"); + goto error; } - /* - * Handle the various field types. - */ - switch (*ch) { + /* Handle specifiers */ + ZEND_ASSERT(ptr != end_ptr); + switch (*ptr) { case 'n': case 'd': case 'D': @@ -439,55 +465,51 @@ PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs) /* ANSI. since Zend auto allocates space for vars, this is no */ /* problem - cc */ /* - if (flags & SCAN_WIDTH) { - php_error_docref(NULL, E_WARNING, "Field width may not be specified in %c conversion"); + if (hasFieldWidth) { + php_error_docref(NULL, E_WARNING, "Field width may not be specified in %%c conversion"); goto error; } */ break; + /* Range specifier */ case '[': - if (*format == '\0') { - goto badSet; - } - ch = format++; - if (*ch == '^') { - if (*format == '\0') { - goto badSet; + ptr++; + /* Not match flag */ + if (*ptr == '^') { + ptr++; + if (UNEXPECTED(ptr == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated [ format specifier"); + goto error; } - ch = format++; } - if (*ch == ']') { - if (*format == '\0') { - goto badSet; - } - ch = format++; + /* If ] is the first character of the range it means it should be *included* + * in the range and not mark the end of it (as it would be empty otherwise) */ + if (*ptr == ']') { + ptr++; } - while (*ch != ']') { - if (*format == '\0') { - goto badSet; + while (*ptr != ']') { + if (UNEXPECTED(ptr == end_ptr)) { + zend_argument_value_error(format_arg_num, "unterminated [ format specifier"); + goto error; } - ch = format++; + ptr++; } break; -badSet: - zend_value_error("Unmatched [ in format string"); - goto error; - default: { - zend_value_error("Bad scan conversion character \"%c\"", *ch); + default: + zend_argument_value_error(format_arg_num, "unknown format specifier \"%c\"", *ptr); goto error; - } } - if (!(flags & SCAN_SUPPRESS)) { + if (isCurrentSpecifierBound) { if (objIndex >= nspace) { /* * Expand the nassign buffer. If we are using XPG specifiers, * make sure that we grow to a large enough size. xpgSize is * guaranteed to be at least one larger than objIndex. */ - value = nspace; + uint32_t value = nspace; if (xpgSize) { nspace = xpgSize; } else { @@ -495,69 +517,79 @@ PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs) } if (nassign == staticAssign) { nassign = (void *)safe_emalloc(nspace, sizeof(int), 0); - for (i = 0; i < STATIC_LIST_SIZE; ++i) { + for (uint32_t i = 0; i < STATIC_LIST_SIZE; ++i) { nassign[i] = staticAssign[i]; } } else { nassign = (void *)erealloc((void *)nassign, nspace * sizeof(int)); } - for (i = value; i < nspace; i++) { + for (uint32_t i = value; i < nspace; i++) { nassign[i] = 0; } } nassign[objIndex]++; objIndex++; } - } /* while (*format != '\0') */ + } /* * Verify that all of the variable were assigned exactly once. */ - if (numVars == 0) { + if (!bindToVariables) { if (xpgSize) { numVars = xpgSize; } else { numVars = objIndex; } } - if (totalSubs) { - *totalSubs = numVars; - } - for (i = 0; i < numVars; i++) { + + *totalSubs = numVars; + + for (uint32_t i = 0; i < numVars; i++) { if (nassign[i] > 1) { - zend_value_error("%s", "Variable is assigned by multiple \"%n$\" conversion specifiers"); + if (bindToVariables) { + /* +1 as arguments are 1-indexed not 0-indexed */ + zend_argument_value_error(i + 1 + format_arg_num, "is assigned by multiple \"%%n$\" conversion specifiers"); + } else { + zend_argument_value_error(format_arg_num, "argument %" PRIu32 " is assigned by multiple \"%%n$\" conversion specifiers", i+1); + } goto error; } else if (!xpgSize && (nassign[i] == 0)) { /* * If the space is empty, and xpgSize is 0 (means XPG wasn't * used, and/or numVars != 0), then too many vars were given */ - zend_value_error("Variable is not assigned by any conversion specifiers"); + if (bindToVariables) { + /* +1 as arguments are 1-indexed not 0-indexed */ + zend_argument_value_error(i + 1 + format_arg_num, "is not assigned by any conversion specifiers"); + } else { + zend_argument_value_error(format_arg_num, "argument %" PRIu32 " is not assigned by any conversion specifiers", i+1); + } goto error; } } if (nassign != staticAssign) { - efree((char *)nassign); - } - return SCAN_SUCCESS; - -badIndex: - if (gotXpg) { - zend_value_error("%s", "\"%n$\" argument index out of range"); - } else { - zend_value_error("Different numbers of variable names and field specifiers"); + efree(nassign); } + return true; error: if (nassign != staticAssign) { - efree((char *)nassign); + efree(nassign); } - return SCAN_ERROR_INVALID_FORMAT; + return false; #undef STATIC_LIST_SIZE } /* }}} */ +enum php_scan_op { + SCAN_STRING, + SCAN_INTEGER, + SCAN_FLOAT, + SCAN_RANGE +}; + /* {{{ php_sscanf_internal * This is the internal function which does processing on behalf of * both sscanf() and fscanf() @@ -567,54 +599,44 @@ PHPAPI int ValidateFormat(char *format, int numVars, int *totalSubs) * format format string * argCount total number of elements in the args array * args arguments passed in from user function (f|s)scanf - * varStart offset (in args) of 1st variable passed in to (f|s)scanf * return_value set with the results of the scan */ -PHPAPI int php_sscanf_internal( char *string, char *format, - int argCount, zval *args, - int varStart, zval *return_value) +PHPAPI int php_sscanf_internal(const char *string, size_t string_len, const zend_string *zstr_format, uint32_t format_arg_num, + uint32_t argCount, zval *args, + zval *return_value) { - int numVars, nconversions, totalVars = -1; - int i, result; - zend_long value; - int objIndex; - char *end, *baseString; + int numVars, nconversions; + int result; + zend_ulong objIndex; + const char *baseString; zval *current; - char op = 0; int base = 0; - int underflow = 0; - size_t width; int_string_formater fn = NULL; - char *ch, sch; - int flags; - char buf[64]; /* Temporary buffer to hold scanned number - * strings before they are passed to strtoul() */ - - /* do some sanity checking */ - if ((varStart > argCount) || (varStart < 0)){ - varStart = SCAN_MAX_ARGS + 1; - } - numVars = argCount - varStart; + + numVars = argCount; if (numVars < 0) { numVars = 0; } + bool assignToVariables = numVars; + /* * Check for errors in the format string. */ - if (ValidateFormat(format, numVars, &totalVars) != SCAN_SUCCESS) { - scan_set_error_return( numVars, return_value ); + uint32_t totalVars = 0; + /* Throws when format is invalid */ + if (!isFormatStringValid(zstr_format, format_arg_num, numVars, &totalVars)) { return SCAN_ERROR_INVALID_FORMAT; } - objIndex = numVars ? varStart : 0; + objIndex = 0; /* * If any variables are passed, make sure they are all passed by reference */ - if (numVars) { - for (i = varStart;i < argCount;i++){ + if (assignToVariables) { + for (uint32_t i = 0; i < argCount; i++){ ZEND_ASSERT(Z_ISREF(args[i]) && "Parameter must be passed by reference"); } } @@ -623,20 +645,19 @@ PHPAPI int php_sscanf_internal( char *string, char *format, * Allocate space for the result objects. Only happens when no variables * are specified */ - if (!numVars) { + if (!assignToVariables) { zval tmp; /* allocate an array for return */ array_init(return_value); - for (i = 0; i < totalVars; i++) { + for (uint32_t i = 0; i < totalVars; i++) { ZVAL_NULL(&tmp); if (add_next_index_zval(return_value, &tmp) == FAILURE) { scan_set_error_return(0, return_value); return FAILURE; } } - varStart = 0; /* Array index starts from 0 */ } baseString = string; @@ -649,86 +670,90 @@ PHPAPI int php_sscanf_internal( char *string, char *format, nconversions = 0; /* note ! - we need to limit the loop for objIndex to keep it in bounds */ - while (*format != '\0') { - ch = format++; - flags = 0; - - /* - * If we see whitespace in the format, skip whitespace in the string. - */ - if ( isspace( (int)*ch ) ) { - sch = *string; - while ( isspace( (int)sch ) ) { - if (*string == '\0') { - goto done; + bool is_fully_consumed = true; + const char *end_string_ptr = string + string_len; + const char *end_format_ptr = ZSTR_VAL(zstr_format) + ZSTR_LEN(zstr_format); + for (const char *format = ZSTR_VAL(zstr_format); format < end_format_ptr; format++) { + bool isCurrentSpecifierBound = true; + zend_ulong width = 0; + /* Whitespace in format => gobble up all whitespace in the string */ + if (isspace(*format)) { + while (isspace(*string)) { + if (string == end_string_ptr) { + goto new_done; } string++; - sch = *string; } continue; - } - - if (*ch != '%') { -literal: - if (*string == '\0') { - underflow = 1; - goto done; + } else if (*format != '%') { +new_literal: + if (string == end_string_ptr) { + is_fully_consumed = false; + goto new_done; } - sch = *string; - string++; - if (*ch != sch) { - goto done; + /* String doesn't match format */ + if (*string != *format) { + goto new_done; } + string++; continue; + } else { + ZEND_ASSERT(*format == '%'); + format++; } - ch = format++; - if (*ch == '%') { - goto literal; + /* %% sequence wants to check for a single % in the string */ + if (*format == '%') { + goto new_literal; + } else if (*format == '*') { + /* Consumed specifier but not assigned to variable */ + isCurrentSpecifierBound = false; + format++; } - /* - * Check for assignment suppression ('*') or an XPG3-style - * assignment ('%n$'). - */ - if (*ch == '*') { - flags |= SCAN_SUPPRESS; - ch = format++; - } else if ( isdigit(UCHAR(*ch))) { - value = ZEND_STRTOUL(format-1, &end, 10); - if (*end == '$') { - format = end+1; - ch = format++; - objIndex = varStart + value - 1; - } - } + if (isdigit(*format)) { + /* We might either have an XPG3-style %n$ specification, + * or we are parsing the _maximum field width_ of the specifier. + * + * Note: there must not be a mixture of XPG3 specs and non-XPG3 specs + * in the same format string. + */ - /* - * Parse any width specifier. - */ - if ( isdigit(UCHAR(*ch))) { - width = ZEND_STRTOUL(format-1, &format, 10); - ch = format++; - } else { - width = 0; + char *width_end = NULL; + width = ZEND_STRTOUL(format, &width_end, 10); + format = width_end; + + if (*format == '$') { + /* We indeed have an XPG3 style spec */ + format++; + zend_ulong argument_index = width; + width = 0; + objIndex = argument_index - 1; + + /* Check if we have a width argument with the XPG3 specifier */ + if (!isdigit(*format)) { + goto length_modifier; + } + /* Grab the width to be able to continue */ + width = ZEND_STRTOUL(format, &width_end, 10); + format = width_end; + } } - /* - * Ignore size specifier. - */ - if ((*ch == 'l') || (*ch == 'L') || (*ch == 'h')) { - ch = format++; +length_modifier: + /* Ignore length modifier */ + if (*format == 'l' || *format == 'L' || *format == 'h') { + format++; } - /* - * Handle the various field types. - */ - switch (*ch) { - case 'n': - if (!(flags & SCAN_SUPPRESS)) { - if (numVars && objIndex >= argCount) { - break; - } else if (numVars) { + bool read_unsigned_integer = false; + bool preserve_whitespace = false; + enum php_scan_op op; + switch (*format) { + case 'n': { + // TODO: Warn if this situation arises in format string? + if (isCurrentSpecifierBound) { + if (assignToVariables) { current = args + objIndex++; ZEND_TRY_ASSIGN_REF_LONG(current, (zend_long) (string - baseString)); } else { @@ -737,33 +762,34 @@ PHPAPI int php_sscanf_internal( char *string, char *format, } nconversions++; continue; + } case 'd': case 'D': - op = 'i'; + op = SCAN_INTEGER; base = 10; fn = (int_string_formater)ZEND_STRTOL_PTR; break; case 'i': - op = 'i'; + op = SCAN_INTEGER; base = 0; fn = (int_string_formater)ZEND_STRTOL_PTR; break; case 'o': - op = 'i'; + op = SCAN_INTEGER; base = 8; fn = (int_string_formater)ZEND_STRTOL_PTR; break; case 'x': case 'X': - op = 'i'; + op = SCAN_INTEGER; base = 16; fn = (int_string_formater)ZEND_STRTOL_PTR; break; case 'u': - op = 'i'; + op = SCAN_INTEGER; base = 10; - flags |= SCAN_UNSIGNED; + read_unsigned_integer = true; fn = (int_string_formater)ZEND_STRTOUL_PTR; break; @@ -771,16 +797,16 @@ PHPAPI int php_sscanf_internal( char *string, char *format, case 'e': case 'E': case 'g': - op = 'f'; + op = SCAN_FLOAT; break; case 's': - op = 's'; + op = SCAN_STRING; break; case 'c': - op = 's'; - flags |= SCAN_NOSKIP; + op = SCAN_STRING; + preserve_whitespace = true; /*-cc-*/ if (0 == width) { width = 1; @@ -788,267 +814,125 @@ PHPAPI int php_sscanf_internal( char *string, char *format, /*-cc-*/ break; case '[': - op = '['; - flags |= SCAN_NOSKIP; + op = SCAN_RANGE; + preserve_whitespace = true; break; - } /* switch */ - - /* - * At this point, we will need additional characters from the - * string to proceed. - */ - if (*string == '\0') { - underflow = 1; - goto done; } - /* - * Skip any leading whitespace at the beginning of a field unless - * the format suppresses this behavior. - */ - if (!(flags & SCAN_NOSKIP)) { - while (*string != '\0') { - sch = *string; - if (! isspace((int)sch) ) { - break; - } + /* Unless the specifier preserves whitespace, ignore whitespace in string */ + if (!preserve_whitespace) { + while (string != end_string_ptr && isspace(*string)) { string++; } - if (*string == '\0') { - underflow = 1; - goto done; - } } - /* - * Perform the requested scanning operation. - */ + /* Check that we are not at the end of the string, as we need to consume bytes to satisfy the specifier + * Note: this cannot be checked before due to the %n specifier */ + if (string == end_string_ptr) { + is_fully_consumed = false; + goto new_done; + } + ZEND_ASSERT(string != end_string_ptr); + switch (op) { - case 'c': - case 's': - /* - * Scan a string up to width characters or whitespace. - */ + /* Scan a string up to width characters or whitespace. */ + case SCAN_STRING: { if (width == 0) { - width = (size_t) ~0; + /* We should be using uz/zu but does not exist in C yet + * https://thephd.dev/_vendor/future_cxx/papers/C%20-%20Literal%20Suffixes%20for%20size_t.html */ + width = ~0u; } - end = string; - while (*end != '\0') { - sch = *end; - if ( isspace( (int)sch ) ) { + const char *start = string; + while (string != end_string_ptr) { + /* Consider nul byte as whitespace here */ + if (isspace(*string) || *string == '\0' || width-- == 0) { break; } - end++; - if (--width == 0) { - break; - } + string++; } - if (!(flags & SCAN_SUPPRESS)) { - if (numVars && objIndex >= argCount) { - break; - } else if (numVars) { + if (isCurrentSpecifierBound) { + if (assignToVariables) { current = args + objIndex++; - ZEND_TRY_ASSIGN_REF_STRINGL(current, string, end - string); + ZEND_TRY_ASSIGN_REF_STRINGL(current, start, string-start); } else { - add_index_stringl(return_value, objIndex++, string, end-string); + add_index_stringl(return_value, objIndex++, start, string-start); } } - string = end; break; + } - case '[': { - CharSet cset; - + case SCAN_RANGE: { if (width == 0) { - width = (size_t) ~0; + /* We should be using uz/zu but does not exist in C yet + * https://thephd.dev/_vendor/future_cxx/papers/C%20-%20Literal%20Suffixes%20for%20size_t.html */ + width = ~0u; } - end = string; + format++; + CharSet cset; + const char *start = string; format = BuildCharSet(&cset, format); - while (*end != '\0') { - sch = *end; - if (!CharInSet(&cset, (int)sch)) { - break; - } - end++; - if (--width == 0) { + while (string != end_string_ptr) { + if (!CharInSet(&cset, *string) || width-- == 0) { break; } + string++; } ReleaseCharSet(&cset); - if (string == end) { - /* - * Nothing matched the range, stop processing - */ - goto done; + /* Nothing matched the range, stop processing */ + if (UNEXPECTED(string == start)) { + //is_fully_consumed = false; + goto new_done; } - if (!(flags & SCAN_SUPPRESS)) { - if (numVars && objIndex >= argCount) { - break; - } else if (numVars) { + if (isCurrentSpecifierBound) { + if (assignToVariables) { current = args + objIndex++; - ZEND_TRY_ASSIGN_REF_STRINGL(current, string, end - string); + ZEND_TRY_ASSIGN_REF_STRINGL(current, start, string-start); } else { - add_index_stringl(return_value, objIndex++, string, end-string); + add_index_stringl(return_value, objIndex++, start, string-start); } } - string = end; break; } -/* - case 'c': - / Scan a single character./ - sch = *string; - string++; - if (!(flags & SCAN_SUPPRESS)) { - if (numVars) { - char __buf[2]; - __buf[0] = sch; - __buf[1] = '\0'; - current = args[objIndex++]; - zval_ptr_dtor_nogc(*current); - ZVAL_STRINGL( *current, __buf, 1); - } else { - add_index_stringl(return_value, objIndex++, &sch, 1); - } - } - break; -*/ - case 'i': - /* - * Scan an unsigned or signed integer. - */ - /*-cc-*/ - buf[0] = '\0'; - /*-cc-*/ - if ((width == 0) || (width > sizeof(buf) - 1)) { - width = sizeof(buf) - 1; + case SCAN_INTEGER: { + ZEND_ASSERT(fn != NULL && "must have a valid strto{int} function"); + bool release_buffer = false; + char *buf = (char*)string; + if (width != 0) { + width = MIN(end_string_ptr-string, width); + buf = estrndup(string, width); + release_buffer = true; } - - flags |= SCAN_SIGNOK | SCAN_NODIGITS | SCAN_NOZERO; - for (end = buf; width > 0; width--) { - switch (*string) { - /* - * The 0 digit has special meaning at the beginning of - * a number. If we are unsure of the base, it - * indicates that we are in base 8 or base 16 (if it is - * followed by an 'x'). - */ - case '0': - /*-cc-*/ - if (base == 16) { - flags |= SCAN_XOK; - } - /*-cc-*/ - if (base == 0) { - base = 8; - flags |= SCAN_XOK; - } - if (flags & SCAN_NOZERO) { - flags &= ~(SCAN_SIGNOK | SCAN_NODIGITS | SCAN_NOZERO); - } else { - flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); - } - goto addToInt; - - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': - if (base == 0) { - base = 10; - } - flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); - goto addToInt; - - case '8': case '9': - if (base == 0) { - base = 10; - } - if (base <= 8) { - break; - } - flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); - goto addToInt; - - case 'A': case 'B': case 'C': - case 'D': case 'E': case 'F': - case 'a': case 'b': case 'c': - case 'd': case 'e': case 'f': - if (base <= 10) { - break; - } - flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); - goto addToInt; - - case '+': case '-': - if (flags & SCAN_SIGNOK) { - flags &= ~SCAN_SIGNOK; - goto addToInt; - } - break; - - case 'x': case 'X': - if ((flags & SCAN_XOK) && (end == buf+1)) { - base = 16; - flags &= ~SCAN_XOK; - goto addToInt; - } - break; - } - - /* - * We got an illegal character so we are done accumulating. - */ - break; - -addToInt: - /* - * Add the character to the temporary buffer. - */ - *end++ = *string++; - if (*string == '\0') { - break; - } + char *int_end = NULL; + zend_long value = (*fn)(buf, &int_end, base); + ptrdiff_t l = int_end - buf; + if (release_buffer) { + efree(buf); } - - /* - * Check to see if we need to back up because we only got a - * sign or a trailing x after a 0. - */ - if (flags & SCAN_NODIGITS) { - if (*string == '\0') { - underflow = 1; - } - goto done; - } else if (end[-1] == 'x' || end[-1] == 'X') { - end--; - string--; + /* Did not parse an integer */ + if (l == 0) { + //is_fully_consumed = false; + goto new_done; } - + string += l; /* - * Scan the value from the temporary buffer. If we are - * returning a large unsigned value, we have to convert it back + * If we are returning a large unsigned value, we have to convert it back * to a string since PHP only supports signed values. - */ - if (!(flags & SCAN_SUPPRESS)) { - *end = '\0'; - value = (zend_long) (*fn)(buf, NULL, base); - if ((flags & SCAN_UNSIGNED) && (value < 0)) { - snprintf(buf, sizeof(buf), ZEND_ULONG_FMT, value); /* INTL: ISO digit */ - if (numVars && objIndex >= argCount) { - break; - } else if (numVars) { - /* change passed value type to string */ + */ + if (isCurrentSpecifierBound) { + if (read_unsigned_integer && UNEXPECTED(value < 0)) { + zend_string *uint_str = strpprintf(0, ZEND_ULONG_FMT, value); + if (assignToVariables) { current = args + objIndex++; - ZEND_TRY_ASSIGN_REF_STRING(current, buf); + ZEND_TRY_ASSIGN_REF_STR(current, uint_str); } else { - add_index_string(return_value, objIndex++, buf); + add_index_str(return_value, objIndex++, uint_str); } + // TODO Need to free? } else { - if (numVars && objIndex >= argCount) { - break; - } else if (numVars) { + if (assignToVariables) { current = args + objIndex++; ZEND_TRY_ASSIGN_REF_LONG(current, value); } else { @@ -1057,102 +941,31 @@ PHPAPI int php_sscanf_internal( char *string, char *format, } } break; + } - case 'f': - /* - * Scan a floating point number - */ - buf[0] = '\0'; /* call me pedantic */ - if ((width == 0) || (width > sizeof(buf) - 1)) { - width = sizeof(buf) - 1; + case SCAN_FLOAT: { + bool release_buffer = false; + char *buf = (char*)string; + if (width != 0) { + width = MIN(end_string_ptr-string, width); + buf = estrndup(string, width); + release_buffer = true; } - flags |= SCAN_SIGNOK | SCAN_NODIGITS | SCAN_PTOK | SCAN_EXPOK; - for (end = buf; width > 0; width--) { - switch (*string) { - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - case '8': case '9': - flags &= ~(SCAN_SIGNOK | SCAN_NODIGITS); - goto addToFloat; - case '+': - case '-': - if (flags & SCAN_SIGNOK) { - flags &= ~SCAN_SIGNOK; - goto addToFloat; - } - break; - case '.': - if (flags & SCAN_PTOK) { - flags &= ~(SCAN_SIGNOK | SCAN_PTOK); - goto addToFloat; - } - break; - case 'e': - case 'E': - /* - * An exponent is not allowed until there has - * been at least one digit. - */ - if ((flags & (SCAN_NODIGITS | SCAN_EXPOK)) == SCAN_EXPOK) { - flags = (flags & ~(SCAN_EXPOK|SCAN_PTOK)) - | SCAN_SIGNOK | SCAN_NODIGITS; - goto addToFloat; - } - break; - } - - /* - * We got an illegal character so we are done accumulating. - */ - break; - -addToFloat: - /* - * Add the character to the temporary buffer. - */ - *end++ = *string++; - if (*string == '\0') { - break; - } + const char *float_end = NULL; + double dvalue = zend_strtod(buf, &float_end); + ptrdiff_t l = float_end - buf; + if (release_buffer) { + efree(buf); } - - /* - * Check to see if we need to back up because we saw a - * trailing 'e' or sign. - */ - if (flags & SCAN_NODIGITS) { - if (flags & SCAN_EXPOK) { - /* - * There were no digits at all so scanning has - * failed and we are done. - */ - if (*string == '\0') { - underflow = 1; - } - goto done; - } - - /* - * We got a bad exponent ('e' and maybe a sign). - */ - end--; - string--; - if (*end != 'e' && *end != 'E') { - end--; - string--; - } + /* Did not parse a float */ + if (l == 0) { + //is_fully_consumed = false; + goto new_done; } + string += l; - /* - * Scan the value from the temporary buffer. - */ - if (!(flags & SCAN_SUPPRESS)) { - double dvalue; - *end = '\0'; - dvalue = zend_strtod(buf, NULL); - if (numVars && objIndex >= argCount) { - break; - } else if (numVars) { + if (isCurrentSpecifierBound) { + if (assignToVariables) { current = args + objIndex++; ZEND_TRY_ASSIGN_REF_DOUBLE(current, dvalue); } else { @@ -1160,17 +973,18 @@ PHPAPI int php_sscanf_internal( char *string, char *format, } } break; - } /* switch (op) */ + } + } nconversions++; - } /* while (*format != '\0') */ + } +new_done: -done: result = SCAN_SUCCESS; - if (underflow && (0==nconversions)) { - scan_set_error_return( numVars, return_value ); + if (!is_fully_consumed && 0 == nconversions) { + scan_set_error_return( assignToVariables, return_value ); result = SCAN_ERROR_EOF; - } else if (numVars) { + } else if (assignToVariables) { zval_ptr_dtor(return_value ); ZVAL_LONG(return_value, nconversions); } else if (nconversions < totalVars) { @@ -1181,9 +995,9 @@ PHPAPI int php_sscanf_internal( char *string, char *format, /* }}} */ /* the compiler choked when i tried to make this a macro */ -static inline void scan_set_error_return(int numVars, zval *return_value) /* {{{ */ +static inline void scan_set_error_return(bool assignToVariables, zval *return_value) /* {{{ */ { - if (numVars) { + if (assignToVariables) { ZVAL_LONG(return_value, SCAN_ERROR_EOF); /* EOF marker */ } else { /* convert_to_null calls destructor */ diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h index d2ef2fc0f2e84..869e6e94fd4f3 100644 --- a/ext/standard/scanf.h +++ b/ext/standard/scanf.h @@ -23,20 +23,18 @@ /* upper limit to keep resources in check and */ /* minimize the possibility of exploits */ -#define SCAN_SUCCESS SUCCESS +#define SCAN_SUCCESS 0 #define SCAN_ERROR_EOF -1 /* indicates premature termination of scan */ /* can be caused by bad parameters or format*/ /* string. */ #define SCAN_ERROR_INVALID_FORMAT (SCAN_ERROR_EOF - 1) -#define SCAN_ERROR_WRONG_PARAM_COUNT (SCAN_ERROR_INVALID_FORMAT - 1) /* * The following are here solely for the benefit of the scanf type functions * e.g. fscanf */ -PHPAPI int ValidateFormat(char *format, int numVars, int *totalVars); -PHPAPI int php_sscanf_internal(char *string,char *format,int argCount,zval *args, - int varStart, zval *return_value); +PHPAPI int php_sscanf_internal(const char *string, size_t string_len, const zend_string *format, uint32_t format_arg_num, uint32_t argCount, zval *args, + zval *return_value); #endif /* SCANF_H */ diff --git a/ext/standard/string.c b/ext/standard/string.c index 0b7d5be1a2576..1ad9bc588831e 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -5860,22 +5860,19 @@ PHP_FUNCTION(str_pad) PHP_FUNCTION(sscanf) { zval *args = NULL; - char *str, *format; - size_t str_len, format_len; - int result, num_args = 0; + char *str; + size_t str_len; + zend_string *format; + uint32_t num_args = 0; ZEND_PARSE_PARAMETERS_START(2, -1) Z_PARAM_STRING(str, str_len) - Z_PARAM_STRING(format, format_len) + Z_PARAM_STR(format) Z_PARAM_VARIADIC('*', args, num_args) ZEND_PARSE_PARAMETERS_END(); - result = php_sscanf_internal(str, format, num_args, args, 0, return_value); + php_sscanf_internal(str, str_len, format, 2, num_args, args, return_value); - if (SCAN_ERROR_WRONG_PARAM_COUNT == result) { - zend_wrong_param_count(); - RETURN_THROWS(); - } } /* }}} */ diff --git a/ext/standard/tests/file/fscanf.phpt b/ext/standard/tests/file/fscanf/fscanf.phpt similarity index 83% rename from ext/standard/tests/file/fscanf.phpt rename to ext/standard/tests/file/fscanf/fscanf.phpt index 4acadc6169b0d..4614339e2c87f 100644 --- a/ext/standard/tests/file/fscanf.phpt +++ b/ext/standard/tests/file/fscanf/fscanf.phpt @@ -80,15 +80,15 @@ int(0) NULL int(1) string(4) "data" -Variable is not assigned by any conversion specifiers +fscanf(): Argument #4 is not assigned by any conversion specifiers string(4) "data" NULL -Variable is not assigned by any conversion specifiers +fscanf(): Argument #3 is not assigned by any conversion specifiers array(0) { } array(0) { } -Bad scan conversion character "." +fscanf(): Argument #2 ($format) unknown format specifier "." array(0) { } array(0) { @@ -96,5 +96,5 @@ array(0) { bool(false) array(0) { } -Different numbers of variable names and field specifiers +fscanf(): Argument #2 ($format) Different numbers of variable names and field specifiers Done diff --git a/ext/standard/tests/file/fscanf_error.phpt b/ext/standard/tests/file/fscanf/fscanf_error.phpt similarity index 82% rename from ext/standard/tests/file/fscanf_error.phpt rename to ext/standard/tests/file/fscanf/fscanf_error.phpt index da586555be06c..a35884894c68b 100644 --- a/ext/standard/tests/file/fscanf_error.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_error.phpt @@ -58,12 +58,12 @@ unlink($filename); --EXPECT-- *** Testing fscanf() for error conditions *** fscanf(): supplied resource is not a valid File-Handle resource -Different numbers of variable names and field specifiers +fscanf(): Argument #2 ($format) Different numbers of variable names and field specifiers array(0) { } -Bad scan conversion character " -Bad scan conversion character " -Bad scan conversion character "." -Bad scan conversion character "m" +fscanf(): Argument #2 ($format) unterminated format specifier +fscanf(): Argument #2 ($format) unterminated format specifier +fscanf(): Argument #2 ($format) unknown format specifier "." +fscanf(): Argument #2 ($format) unknown format specifier "m" *** Done *** diff --git a/ext/standard/tests/file/fscanf_variation1.phpt b/ext/standard/tests/file/fscanf/fscanf_variation1.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation1.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation1.phpt diff --git a/ext/standard/tests/file/fscanf_variation11.phpt b/ext/standard/tests/file/fscanf/fscanf_variation12.phpt similarity index 58% rename from ext/standard/tests/file/fscanf_variation11.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation12.phpt index 40560cfb39d91..4fb845845b309 100644 --- a/ext/standard/tests/file/fscanf_variation11.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation12.phpt @@ -1,48 +1,40 @@ --TEST-- -Test fscanf() function: usage variations - float formats with arrays +Test fscanf() function: usage variations - float formats with strings --FILE-- "One", "two" => 2) -); +// array of strings +$strings = [ + '', + '0', + '1', + "\01", + '\01', + 'string', + 'true', + 'false', + 'null' +]; -$float_formats = array( "%f", - "%hf", "%lf", "%Lf", - " %f", "%f ", "% f", - "\t%f", "\n%f", "%4f", - "%30f", "%[0-9]", "%*f" - ); +$float_formats = array( "%f", "%hf", "%lf", "%Lf", " %f", "%f ", "\t%f", "\n%f", "%4f", "%30f", "%[0-9]", "%*f"); $counter = 1; // writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); +foreach($strings as $string) { + @fprintf($file_handle, $string); @fprintf($file_handle, "\n"); } // closing the file @@ -75,36 +67,21 @@ echo "\n*** Done ***"; --CLEAN-- --EXPECT-- -*** Test fscanf(): different float format types with arrays *** +*** Test fscanf(): different float format types with strings *** -- iteration 1 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(1) } array(1) { [0]=> @@ -133,29 +110,14 @@ array(1) { bool(false) -- iteration 2 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(0) } array(1) { [0]=> - NULL + float(1) } array(1) { [0]=> @@ -184,29 +146,14 @@ array(1) { bool(false) -- iteration 3 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(1) } array(1) { [0]=> @@ -235,29 +182,14 @@ array(1) { bool(false) -- iteration 4 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(1) } array(1) { [0]=> @@ -286,29 +218,14 @@ array(1) { bool(false) -- iteration 5 -- +NULL array(1) { [0]=> - NULL + float(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(1) } array(1) { [0]=> @@ -337,29 +254,14 @@ array(1) { bool(false) -- iteration 6 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(0) } array(1) { [0]=> - NULL + float(1) } array(1) { [0]=> @@ -388,44 +290,14 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} +NULL array(1) { [0]=> - NULL + float(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(1) } array(1) { [0]=> @@ -453,30 +325,15 @@ array(1) { } bool(false) --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 8 -- +NULL array(1) { [0]=> - NULL + float(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(1) } array(1) { [0]=> @@ -504,30 +361,15 @@ array(1) { } bool(false) --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 9 -- +NULL array(1) { [0]=> - NULL + float(0) } array(1) { [0]=> - NULL + float(1) } array(1) { [0]=> @@ -555,30 +397,15 @@ array(1) { } bool(false) --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 10 -- +NULL array(1) { [0]=> - NULL + float(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(1) } array(1) { [0]=> @@ -606,30 +433,18 @@ array(1) { } bool(false) --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 11 -- array(1) { [0]=> NULL } array(1) { [0]=> - NULL + string(1) "0" } array(1) { [0]=> - NULL + string(1) "1" } array(1) { [0]=> @@ -657,15 +472,8 @@ array(1) { } bool(false) --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} +-- iteration 12 -- +NULL array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation14.phpt b/ext/standard/tests/file/fscanf/fscanf_variation14.phpt similarity index 80% rename from ext/standard/tests/file/fscanf_variation14.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation14.phpt index 97a07a98f2e19..8c2a6ceeb5494 100644 --- a/ext/standard/tests/file/fscanf_variation14.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation14.phpt @@ -27,19 +27,10 @@ $heredoc_numeric_string = << - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -144,7 +121,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -165,7 +145,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -182,22 +165,10 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 2 -- NULL NULL -NULL -NULL -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -219,7 +190,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -240,7 +214,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -257,22 +234,10 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 3 -- NULL NULL -NULL -NULL -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -294,7 +259,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -315,7 +283,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -332,22 +303,10 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 4 -- NULL NULL -NULL -NULL -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -369,7 +328,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -390,7 +352,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -407,22 +372,10 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 5 -- NULL NULL -NULL -NULL -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -444,7 +397,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -465,7 +421,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -482,22 +441,10 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 6 -- NULL NULL -NULL -NULL -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -519,7 +466,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -540,7 +490,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -557,53 +510,14 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -NULL -NULL NULL NULL array(1) { [0]=> string(6) "string" } -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(4) "NULL" @@ -621,7 +535,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -642,7 +559,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -659,26 +579,14 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) --- iteration 9 -- -NULL -NULL +-- iteration 8 -- NULL NULL array(1) { [0]=> string(6) "string" } -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(4) "NULL" @@ -696,7 +604,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -717,7 +628,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -734,26 +648,14 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) --- iteration 10 -- -NULL -NULL +-- iteration 9 -- NULL NULL array(1) { [0]=> string(4) "stri" } -array(1) { - [0]=> - string(4) "stri" -} array(1) { [0]=> string(4) "NULL" @@ -771,7 +673,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -792,7 +697,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(4) "@#$#" +} array(1) { [0]=> string(4) "This" @@ -809,26 +717,14 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) --- iteration 11 -- -NULL -NULL +-- iteration 10 -- NULL NULL array(1) { [0]=> string(6) "string" } -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(4) "NULL" @@ -846,7 +742,10 @@ array(1) { string(4) "true" } NULL -NULL +array(1) { + [0]=> + string(0) "" +} array(1) { [0]=> string(2) "\0" @@ -867,7 +766,10 @@ array(1) { [0]=> string(3) "055" } -NULL +array(1) { + [0]=> + string(18) "@#$#$%%$^^$%^%^$^&" +} array(1) { [0]=> string(4) "This" @@ -884,22 +786,8 @@ array(1) { [0]=> string(4) "4849" } -NULL -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 11 -- array(1) { [0]=> NULL @@ -912,10 +800,6 @@ array(1) { [0]=> string(6) "string" } -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(4) "NULL" @@ -936,7 +820,10 @@ array(1) { [0]=> NULL } -NULL +array(1) { + [0]=> + NULL +} array(1) { [0]=> NULL @@ -977,19 +864,8 @@ array(1) { [0]=> string(4) "4849" } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(4) "NULL" -} -bool(false) --- iteration 13 -- -NULL -NULL +-- iteration 12 -- NULL NULL array(0) { @@ -1002,10 +878,9 @@ array(0) { } array(0) { } +NULL array(0) { } -NULL -NULL array(0) { } array(0) { @@ -1016,7 +891,6 @@ array(0) { } array(0) { } -NULL array(0) { } array(0) { @@ -1025,9 +899,7 @@ array(0) { } array(0) { } -NULL array(0) { } -bool(false) *** Done *** diff --git a/ext/standard/tests/file/fscanf_variation15.phpt b/ext/standard/tests/file/fscanf/fscanf_variation15.phpt similarity index 94% rename from ext/standard/tests/file/fscanf_variation15.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation15.phpt index b35bb1bebe253..d5f561033af82 100644 --- a/ext/standard/tests/file/fscanf_variation15.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation15.phpt @@ -37,7 +37,7 @@ $float_values = array ( $string_formats = array( "%s", "%hs", "%ls", "%Ls", - " %s", "%s ", "% s", + " %s", "%s ", "\t%s", "\n%s", "%4s", "%30s", "%[a-zA-Z0-9]", "%*s"); @@ -463,24 +463,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> string(11) "-2147483649" @@ -543,7 +525,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> string(11) "-2147483649" @@ -606,7 +588,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> string(4) "-214" @@ -669,7 +651,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> string(11) "-2147483649" @@ -732,7 +714,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -795,7 +777,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation18.phpt b/ext/standard/tests/file/fscanf/fscanf_variation18.phpt similarity index 94% rename from ext/standard/tests/file/fscanf_variation18.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation18.phpt index eef94173c5838..7e78aa83de461 100644 --- a/ext/standard/tests/file/fscanf_variation18.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation18.phpt @@ -40,7 +40,7 @@ $integer_values = array ( $string_formats = array( "%s", "%hs", "%ls", "%Ls", - " %s", "%s ", "% s", + " %s", "%s ", "\t%s", "\n%s", "%4s", "%30s", "%[a-zA-Z0-9]", "%*s" ); @@ -539,27 +539,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> string(1) "0" @@ -634,7 +613,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> string(1) "0" @@ -709,7 +688,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> string(1) "0" @@ -784,7 +763,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> string(1) "0" @@ -859,7 +838,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "0" @@ -934,7 +913,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation2.phpt b/ext/standard/tests/file/fscanf/fscanf_variation2.phpt similarity index 92% rename from ext/standard/tests/file/fscanf_variation2.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation2.phpt index f2c5593c3ee6a..b00064675aca2 100644 --- a/ext/standard/tests/file/fscanf_variation2.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation2.phpt @@ -32,12 +32,12 @@ $valid_ints = array( 0x7fffffff, // max positive integer as hexadecimal 0x7FFFFFFF, // max positive integer as hexadecimal 0123, // integer as octal - 01, // should be quivalent to octal 1 + 01, // should be equivalent to octal 1 -020000000000, // max negative integer as octal 017777777777 // max positive integer as octal ); // various integer formats -$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "% d", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d"); +$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d"); $counter = 1; @@ -533,27 +533,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> int(0) @@ -628,7 +607,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(0) @@ -703,7 +682,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> int(0) @@ -778,7 +757,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(0) @@ -853,7 +832,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "0" @@ -928,7 +907,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation20.phpt b/ext/standard/tests/file/fscanf/fscanf_variation20.phpt similarity index 93% rename from ext/standard/tests/file/fscanf_variation20.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation20.phpt index 70b13dd55c906..69d9f3a374cba 100644 --- a/ext/standard/tests/file/fscanf_variation20.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation20.phpt @@ -39,7 +39,7 @@ $valid_ints = array( // various char formats $char_formats = array( "%c", "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", + " %c", "%c ", "\t%c", "\n%c", "%4c", "%30c", "%[a-bA-B@#$&]", "%*c"); @@ -537,27 +537,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> string(1) "0" @@ -632,7 +611,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> string(1) "0" @@ -707,7 +686,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> string(1) "0" @@ -782,7 +761,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> string(1) "0" @@ -857,7 +836,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -932,7 +911,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation21.phpt b/ext/standard/tests/file/fscanf/fscanf_variation21.phpt similarity index 93% rename from ext/standard/tests/file/fscanf_variation21.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation21.phpt index 86968ddd1177e..3f318e318ee14 100644 --- a/ext/standard/tests/file/fscanf_variation21.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation21.phpt @@ -37,7 +37,7 @@ $float_values = array ( $char_formats = array( "%c", "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", + " %c", "%c ", "\t%c", "\n%c", "%4c", "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); @@ -463,24 +463,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> string(1) "-" @@ -543,7 +525,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> string(1) "-" @@ -606,7 +588,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> string(4) "-214" @@ -669,7 +651,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> string(11) "-2147483649" @@ -732,7 +714,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -795,7 +777,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation24.phpt b/ext/standard/tests/file/fscanf/fscanf_variation24.phpt similarity index 56% rename from ext/standard/tests/file/fscanf_variation24.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation24.phpt index 4c46cf58dad11..481946ed0d6e6 100644 --- a/ext/standard/tests/file/fscanf_variation24.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation24.phpt @@ -16,30 +16,21 @@ if($file_handle == false) exit("Error:failed to open file $filename"); // array of strings -$strings = array ( - "", +$strings = [ '', - "0", '0', - "1", '1', - "\x01", - '\x01', "\01", '\01', 'string', - "string", - "true", - "FALSE", + 'true', 'false', - 'TRUE', - "NULL", 'null' -); +]; $char_formats = array( "%c", "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", + " %c", "%c ", "\t%c", "\n%c", "%4c", "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); @@ -91,14 +82,6 @@ array(1) { [0]=> string(0) "" } -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "0" -} array(1) { [0]=> string(1) "0" @@ -107,10 +90,6 @@ array(1) { [0]=> string(1) "1" } -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "" @@ -119,18 +98,6 @@ array(1) { [0]=> string(1) "\" } -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "s" @@ -139,22 +106,10 @@ array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" @@ -166,14 +121,6 @@ array(1) { [0]=> string(0) "" } -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "0" -} array(1) { [0]=> string(1) "0" @@ -182,18 +129,6 @@ array(1) { [0]=> string(1) "1" } -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} array(1) { [0]=> string(1) "" @@ -206,30 +141,14 @@ array(1) { [0]=> string(1) "s" } -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" @@ -241,14 +160,6 @@ array(1) { [0]=> string(0) "" } -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "0" -} array(1) { [0]=> string(1) "0" @@ -257,18 +168,6 @@ array(1) { [0]=> string(1) "1" } -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} array(1) { [0]=> string(1) "" @@ -281,30 +180,14 @@ array(1) { [0]=> string(1) "s" } -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" @@ -316,14 +199,6 @@ array(1) { [0]=> string(0) "" } -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "0" -} array(1) { [0]=> string(1) "0" @@ -332,18 +207,6 @@ array(1) { [0]=> string(1) "1" } -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} array(1) { [0]=> string(1) "" @@ -356,30 +219,14 @@ array(1) { [0]=> string(1) "s" } -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" @@ -388,11 +235,6 @@ bool(false) -- iteration 5 -- NULL -NULL -array(1) { - [0]=> - string(1) "0" -} array(1) { [0]=> string(1) "0" @@ -401,10 +243,6 @@ array(1) { [0]=> string(1) "1" } -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "" @@ -413,18 +251,6 @@ array(1) { [0]=> string(1) "\" } -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "s" @@ -433,22 +259,10 @@ array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" @@ -460,22 +274,10 @@ array(1) { [0]=> string(0) "" } -array(1) { - [0]=> - string(0) "" -} array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -488,18 +290,6 @@ array(1) { [0]=> string(1) "\" } -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "s" @@ -508,22 +298,10 @@ array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" @@ -531,53 +309,15 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -NULL NULL array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} array(1) { [0]=> string(1) "1" } -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} array(1) { [0]=> string(1) "" @@ -590,51 +330,26 @@ array(1) { [0]=> string(1) "s" } -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" } bool(false) --- iteration 9 -- -NULL +-- iteration 8 -- NULL array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -647,18 +362,6 @@ array(1) { [0]=> string(1) "\" } -array(1) { - [0]=> - string(1) "" -} -array(1) { - [0]=> - string(1) "\" -} -array(1) { - [0]=> - string(1) "s" -} array(1) { [0]=> string(1) "s" @@ -667,33 +370,17 @@ array(1) { [0]=> string(1) "t" } -array(1) { - [0]=> - string(1) "F" -} array(1) { [0]=> string(1) "f" } -array(1) { - [0]=> - string(1) "T" -} -array(1) { - [0]=> - string(1) "N" -} array(1) { [0]=> string(1) "n" } bool(false) --- iteration 10 -- -array(1) { - [0]=> - string(0) "" -} +-- iteration 9 -- array(1) { [0]=> string(0) "" @@ -702,14 +389,6 @@ array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -718,14 +397,6 @@ array(1) { [0]=> string(1) "" } -array(1) { - [0]=> - string(4) "\x01" -} -array(1) { - [0]=> - string(1) "" -} array(1) { [0]=> string(3) "\01" @@ -734,41 +405,21 @@ array(1) { [0]=> string(4) "stri" } -array(1) { - [0]=> - string(4) "stri" -} array(1) { [0]=> string(4) "true" } -array(1) { - [0]=> - string(4) "FALS" -} array(1) { [0]=> string(4) "fals" } -array(1) { - [0]=> - string(4) "TRUE" -} -array(1) { - [0]=> - string(4) "NULL" -} array(1) { [0]=> string(4) "null" } bool(false) --- iteration 11 -- -array(1) { - [0]=> - string(0) "" -} +-- iteration 10 -- array(1) { [0]=> string(0) "" @@ -777,14 +428,6 @@ array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -793,14 +436,6 @@ array(1) { [0]=> string(1) "" } -array(1) { - [0]=> - string(4) "\x01" -} -array(1) { - [0]=> - string(1) "" -} array(1) { [0]=> string(3) "\01" @@ -809,41 +444,21 @@ array(1) { [0]=> string(6) "string" } -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(4) "true" } -array(1) { - [0]=> - string(5) "FALSE" -} array(1) { [0]=> string(5) "false" } -array(1) { - [0]=> - string(4) "TRUE" -} -array(1) { - [0]=> - string(4) "NULL" -} array(1) { [0]=> string(4) "null" } bool(false) --- iteration 12 -- -array(1) { - [0]=> - NULL -} +-- iteration 11 -- array(1) { [0]=> NULL @@ -852,14 +467,6 @@ array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -872,18 +479,6 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(6) "string" -} array(1) { [0]=> string(6) "string" @@ -892,47 +487,17 @@ array(1) { [0]=> string(4) "true" } -array(1) { - [0]=> - string(5) "FALSE" -} array(1) { [0]=> string(5) "false" } -array(1) { - [0]=> - string(4) "TRUE" -} -array(1) { - [0]=> - string(4) "NULL" -} array(1) { [0]=> string(4) "null" } bool(false) --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation26.phpt b/ext/standard/tests/file/fscanf/fscanf_variation26.phpt similarity index 94% rename from ext/standard/tests/file/fscanf_variation26.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation26.phpt index 19db8f45abfdd..d023daf507a34 100644 --- a/ext/standard/tests/file/fscanf_variation26.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation26.phpt @@ -20,7 +20,7 @@ $char_types = array( 'a', "a", 67, -67, 99 ); $char_formats = array( "%c", "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", + " %c", "%c ", "\t%c", "\n%c", "%4c", "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); @@ -206,14 +206,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> string(1) "a" @@ -236,7 +228,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> string(1) "a" @@ -259,7 +251,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> string(1) "a" @@ -282,7 +274,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> string(1) "a" @@ -305,7 +297,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "a" @@ -328,7 +320,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation27.phpt b/ext/standard/tests/file/fscanf/fscanf_variation27.phpt similarity index 93% rename from ext/standard/tests/file/fscanf_variation27.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation27.phpt index a9560e042505c..0b1854c758dec 100644 --- a/ext/standard/tests/file/fscanf_variation27.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation27.phpt @@ -39,7 +39,7 @@ $valid_ints = array( // various octal formats $octal_formats = array( "%o", "%ho", "%lo", "%Lo", - " %o", "%o ", "% o", + " %o", "%o ", "\t%o", "\n%o", "%4o", "%30o", "%[0-7]", "%*o" ); @@ -538,27 +538,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> int(0) @@ -633,7 +612,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(0) @@ -708,7 +687,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> int(0) @@ -783,7 +762,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(0) @@ -858,7 +837,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "0" @@ -933,7 +912,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation28.phpt b/ext/standard/tests/file/fscanf/fscanf_variation28.phpt similarity index 93% rename from ext/standard/tests/file/fscanf_variation28.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation28.phpt index 18c9726f85362..0444b4b6dd404 100644 --- a/ext/standard/tests/file/fscanf_variation28.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation28.phpt @@ -37,7 +37,7 @@ $float_values = array ( $octal_formats = array( "%o", "%ho", "%lo", "%Lo", - " %o", "%o ", "% o", + " %o", "%o ", "\t%o", "\n%o", "%4o", "%30o", "%[0-7]", "%*o" ); @@ -464,24 +464,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> int(-9020) @@ -544,7 +526,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(-9020) @@ -607,7 +589,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> int(-140) @@ -670,7 +652,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(-9020) @@ -733,7 +715,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -796,7 +778,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation3.phpt b/ext/standard/tests/file/fscanf/fscanf_variation3.phpt similarity index 93% rename from ext/standard/tests/file/fscanf_variation3.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation3.phpt index ae197b6f96fce..90afccb9ac2c6 100644 --- a/ext/standard/tests/file/fscanf_variation3.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation3.phpt @@ -41,7 +41,7 @@ $float_values = array ( 10.5e+5 ); -$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "% d", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d"); +$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d"); $counter = 1; @@ -465,24 +465,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> int(-2147483648) @@ -545,7 +527,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(-2147483648) @@ -608,7 +590,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> int(-214) @@ -671,7 +653,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(-2147483648) @@ -734,7 +716,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -797,7 +779,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation30.phpt b/ext/standard/tests/file/fscanf/fscanf_variation31.phpt similarity index 58% rename from ext/standard/tests/file/fscanf_variation30.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation31.phpt index 9afde0f093aca..8325a29c2a06a 100644 --- a/ext/standard/tests/file/fscanf_variation30.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation31.phpt @@ -1,48 +1,40 @@ --TEST-- -Test fscanf() function: usage variations - octal formats with arrays +Test fscanf() function: usage variations - octal formats with strings --FILE-- "One", "two" => 2) -); +// array of strings +$strings = [ + '', + '0', + '1', + "\01", + '\01', + 'string', + 'true', + 'false', + 'null' +]; -$octal_formats = array ( "%o", - "%ho", "%lo", "%Lo", - " %o", "%o ", "% o", - "\t%o", "\n%o", "%4o", - "%30o", "%[0-7]", "%*o" - ); +$octal_formats = array( "%o", "%ho", "%lo", "%Lo", " %o", "%o ", "\t%o", "\n%o", "%4o", "%30o", "%[0-9]", "%*o"); $counter = 1; // writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); +foreach($strings as $string) { + @fprintf($file_handle, $string); @fprintf($file_handle, "\n"); } // closing the file @@ -75,36 +67,21 @@ echo "\n*** Done ***"; --CLEAN-- --EXPECT-- -*** Test fscanf(): different octal format types with arrays *** +*** Test fscanf(): different octal format types with strings *** -- iteration 1 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -133,29 +110,14 @@ array(1) { bool(false) -- iteration 2 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(0) } array(1) { [0]=> - NULL + int(1) } array(1) { [0]=> @@ -184,29 +146,14 @@ array(1) { bool(false) -- iteration 3 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -235,29 +182,14 @@ array(1) { bool(false) -- iteration 4 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -286,29 +218,14 @@ array(1) { bool(false) -- iteration 5 -- +NULL array(1) { [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -337,29 +254,14 @@ array(1) { bool(false) -- iteration 6 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(0) } array(1) { [0]=> - NULL + int(1) } array(1) { [0]=> @@ -388,44 +290,14 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} +NULL array(1) { [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -453,30 +325,15 @@ array(1) { } bool(false) --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 8 -- +NULL array(1) { [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -504,30 +361,15 @@ array(1) { } bool(false) --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 9 -- +NULL array(1) { [0]=> - NULL + int(0) } array(1) { [0]=> - NULL + int(1) } array(1) { [0]=> @@ -555,30 +397,15 @@ array(1) { } bool(false) --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 10 -- +NULL array(1) { [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -606,30 +433,18 @@ array(1) { } bool(false) --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 11 -- array(1) { [0]=> NULL } array(1) { [0]=> - NULL + string(1) "0" } array(1) { [0]=> - NULL + string(1) "1" } array(1) { [0]=> @@ -657,15 +472,8 @@ array(1) { } bool(false) --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} +-- iteration 12 -- +NULL array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation33.phpt b/ext/standard/tests/file/fscanf/fscanf_variation33.phpt similarity index 93% rename from ext/standard/tests/file/fscanf_variation33.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation33.phpt index c008c759c9b39..76c26c22c5b6c 100644 --- a/ext/standard/tests/file/fscanf_variation33.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation33.phpt @@ -45,7 +45,7 @@ $valid_ints = array( // various hexa formats $hexa_formats = array( "%x", "%xx", "%lx", "%Lx", - " %x", "%x ", "% x", + " %x", "%x ", "\t%x", "\n%x", "%4x", "%30x", "%[0-9A-Fa-f]", "%*x" ); @@ -544,27 +544,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> int(0) @@ -639,7 +618,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(0) @@ -714,7 +693,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> int(0) @@ -789,7 +768,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(0) @@ -864,7 +843,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "0" @@ -939,7 +918,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation34.phpt b/ext/standard/tests/file/fscanf/fscanf_variation34.phpt similarity index 93% rename from ext/standard/tests/file/fscanf_variation34.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation34.phpt index 2dad3ace145fa..02f014656192b 100644 --- a/ext/standard/tests/file/fscanf_variation34.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation34.phpt @@ -43,7 +43,7 @@ $float_values = array ( $hexa_formats = array( "%x", "%hx", "%lx", "%Lx", - " %x", "%x ", "% x", + " %x", "%x ", "\t%x", "\n%x", "%4x", "%30x", "%[0-9A-Za-z]", "%*x"); @@ -469,24 +469,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> int(-2147483648) @@ -549,7 +531,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(-2147483648) @@ -612,7 +594,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> int(-532) @@ -675,7 +657,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(-2147483648) @@ -738,7 +720,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -801,7 +783,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation37.phpt b/ext/standard/tests/file/fscanf/fscanf_variation37.phpt similarity index 57% rename from ext/standard/tests/file/fscanf_variation37.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation37.phpt index d597ebe307c67..6774f34f45c07 100644 --- a/ext/standard/tests/file/fscanf_variation37.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation37.phpt @@ -16,28 +16,19 @@ if($file_handle == false) exit("Error:failed to open file $filename"); // array of strings -$strings = array ( - "", +$strings = [ '', - "0", '0', - "1", '1', - "\x01", - '\x01', "\01", '\01', 'string', - "string", - "true", - "FALSE", + 'true', 'false', - 'TRUE', - "NULL", 'null' -); +]; -$hexa_formats = array( "%x", "%hx", "%lx", "%Lx", " %x", "%x ", "% x", "\t%x", "\n%x", "%4x", "%30x", "%[0-9]", "%*x"); +$hexa_formats = array( "%x", "%hx", "%lx", "%Lx", " %x", "%x ", "\t%x", "\n%x", "%4x", "%30x", "%[0-9]", "%*x"); $counter = 1; @@ -84,11 +75,6 @@ unlink($filename); -- iteration 1 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -97,14 +83,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -121,18 +99,6 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - int(250) -} array(1) { [0]=> int(250) @@ -141,23 +107,10 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) -- iteration 2 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -166,22 +119,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -202,18 +139,6 @@ array(1) { [0]=> int(250) } -array(1) { - [0]=> - int(250) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -222,11 +147,6 @@ bool(false) -- iteration 3 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -235,22 +155,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -271,18 +175,6 @@ array(1) { [0]=> int(250) } -array(1) { - [0]=> - int(250) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -291,11 +183,6 @@ bool(false) -- iteration 4 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -304,14 +191,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -328,18 +207,6 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - int(250) -} array(1) { [0]=> int(250) @@ -348,23 +215,10 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) -- iteration 5 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -373,22 +227,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -409,18 +247,6 @@ array(1) { [0]=> int(250) } -array(1) { - [0]=> - int(250) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -429,11 +255,6 @@ bool(false) -- iteration 6 -- NULL -NULL -array(1) { - [0]=> - int(0) -} array(1) { [0]=> int(0) @@ -442,22 +263,6 @@ array(1) { [0]=> int(1) } -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -478,18 +283,6 @@ array(1) { [0]=> int(250) } -array(1) { - [0]=> - int(250) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} array(1) { [0]=> NULL @@ -497,41 +290,11 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -NULL NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -552,22 +315,6 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - int(250) -} array(1) { [0]=> int(250) @@ -576,31 +323,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 9 -- -NULL +-- iteration 8 -- NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -621,22 +351,6 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - int(250) -} array(1) { [0]=> int(250) @@ -645,31 +359,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 10 -- -NULL +-- iteration 9 -- NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -690,22 +387,6 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - int(250) -} array(1) { [0]=> int(250) @@ -714,31 +395,14 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 11 -- -NULL +-- iteration 10 -- NULL array(1) { [0]=> int(0) } -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} array(1) { [0]=> int(1) @@ -759,22 +423,6 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - int(250) -} array(1) { [0]=> int(250) @@ -783,21 +431,9 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 12 -- -array(1) { - [0]=> - NULL -} +-- iteration 11 -- array(1) { [0]=> NULL @@ -806,14 +442,6 @@ array(1) { [0]=> string(1) "0" } -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} array(1) { [0]=> string(1) "1" @@ -842,34 +470,9 @@ array(1) { [0]=> NULL } -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} bool(false) --- iteration 13 -- -NULL +-- iteration 12 -- NULL array(0) { } @@ -887,22 +490,6 @@ array(0) { } array(0) { } -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} bool(false) *** Done *** diff --git a/ext/standard/tests/file/fscanf_variation39.phpt b/ext/standard/tests/file/fscanf/fscanf_variation39.phpt similarity index 93% rename from ext/standard/tests/file/fscanf_variation39.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation39.phpt index f04d3b7e3165c..90ca81abd4a8d 100644 --- a/ext/standard/tests/file/fscanf_variation39.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation39.phpt @@ -43,7 +43,7 @@ $valid_ints = array( 017777777777 // max positive integer as octal ); // various unsigned int formats -$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "% u", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u"); +$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u"); $counter = 1; @@ -539,27 +539,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> int(0) @@ -634,7 +613,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(0) @@ -709,7 +688,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> int(0) @@ -784,7 +763,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(0) @@ -859,7 +838,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "0" @@ -934,7 +913,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation40.phpt b/ext/standard/tests/file/fscanf/fscanf_variation40.phpt similarity index 93% rename from ext/standard/tests/file/fscanf_variation40.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation40.phpt index 4b12a8cf0a1e9..9d49d899ba171 100644 --- a/ext/standard/tests/file/fscanf_variation40.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation40.phpt @@ -41,7 +41,7 @@ $float_values = array ( 10.5e+5 ); -$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "% u", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u"); +$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u"); $counter = 1; @@ -465,24 +465,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> int(2147483647) @@ -545,7 +527,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> int(2147483647) @@ -608,7 +590,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> string(10) "4294967082" @@ -671,7 +653,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> int(2147483647) @@ -734,7 +716,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -797,7 +779,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation42.phpt b/ext/standard/tests/file/fscanf/fscanf_variation43.phpt similarity index 61% rename from ext/standard/tests/file/fscanf_variation42.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation43.phpt index 90436ff124900..d5ec43ef63d40 100644 --- a/ext/standard/tests/file/fscanf_variation42.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation43.phpt @@ -1,43 +1,40 @@ --TEST-- -Test fscanf() function: usage variations - unsigned formats with arrays +Test fscanf() function: usage variations - unsigned formats with strings --FILE-- "One", "two" => 2) -); +// array of strings +$strings = [ + '', + '0', + '1', + "\01", + '\01', + 'string', + 'true', + 'false', + 'null' +]; -$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "% u", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u"); +$unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u"); $counter = 1; // writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); +foreach($strings as $string) { + @fprintf($file_handle, $string); @fprintf($file_handle, "\n"); } // closing the file @@ -70,36 +67,21 @@ echo "\n*** Done ***"; --CLEAN-- --EXPECT-- -*** Test fscanf(): different unsigned format types with arrays *** +*** Test fscanf(): different unsigned format types with strings *** -- iteration 1 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -128,29 +110,14 @@ array(1) { bool(false) -- iteration 2 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(0) } array(1) { [0]=> - NULL + int(1) } array(1) { [0]=> @@ -179,29 +146,14 @@ array(1) { bool(false) -- iteration 3 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -230,29 +182,14 @@ array(1) { bool(false) -- iteration 4 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -281,29 +218,14 @@ array(1) { bool(false) -- iteration 5 -- +NULL array(1) { [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -332,29 +254,14 @@ array(1) { bool(false) -- iteration 6 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(0) } array(1) { [0]=> - NULL + int(1) } array(1) { [0]=> @@ -383,44 +290,14 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} +NULL array(1) { [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -448,30 +325,15 @@ array(1) { } bool(false) --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 8 -- +NULL array(1) { [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -499,30 +361,15 @@ array(1) { } bool(false) --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 9 -- +NULL array(1) { [0]=> - NULL + int(0) } array(1) { [0]=> - NULL + int(1) } array(1) { [0]=> @@ -550,30 +397,15 @@ array(1) { } bool(false) --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 10 -- +NULL array(1) { [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -601,30 +433,18 @@ array(1) { } bool(false) --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 11 -- array(1) { [0]=> NULL } array(1) { [0]=> - NULL + string(1) "0" } array(1) { [0]=> - NULL + string(1) "1" } array(1) { [0]=> @@ -652,15 +472,8 @@ array(1) { } bool(false) --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} +-- iteration 12 -- +NULL array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation45.phpt b/ext/standard/tests/file/fscanf/fscanf_variation45.phpt similarity index 93% rename from ext/standard/tests/file/fscanf_variation45.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation45.phpt index b694da0e555c6..a85bf76b72d97 100644 --- a/ext/standard/tests/file/fscanf_variation45.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation45.phpt @@ -37,7 +37,7 @@ $valid_ints = array( 017777777777 // max positive integer as octal ); // various scientific formats -$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "% e", "\t%e", "\n%e", "%4e", "%30e", "%[0-1]", "%*e"); +$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "\t%e", "\n%e", "%4e", "%30e", "%[0-1]", "%*e"); $counter = 1; @@ -533,27 +533,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> float(0) @@ -628,7 +607,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> float(0) @@ -703,7 +682,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> float(0) @@ -778,7 +757,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> float(0) @@ -853,7 +832,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "0" @@ -928,7 +907,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation46.phpt b/ext/standard/tests/file/fscanf/fscanf_variation46.phpt similarity index 93% rename from ext/standard/tests/file/fscanf_variation46.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation46.phpt index bc96af6dbe37d..edaf912e0a7d9 100644 --- a/ext/standard/tests/file/fscanf_variation46.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation46.phpt @@ -35,7 +35,7 @@ $float_values = array ( 10.5e+5 ); -$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "% e", "\t%e", "\n%e", "%4e", "%30e", "%[0-9]", "%*e"); +$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "\t%e", "\n%e", "%4e", "%30e", "%[0-9]", "%*e"); $counter = 1; @@ -459,24 +459,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> float(-2147483649) @@ -539,7 +521,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> float(-2147483649) @@ -602,7 +584,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> float(-214) @@ -665,7 +647,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> float(-2147483649) @@ -728,7 +710,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -791,7 +773,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation48.phpt b/ext/standard/tests/file/fscanf/fscanf_variation49.phpt similarity index 61% rename from ext/standard/tests/file/fscanf_variation48.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation49.phpt index aa717bd83e0de..d7f465c1c7c45 100644 --- a/ext/standard/tests/file/fscanf_variation48.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation49.phpt @@ -1,43 +1,40 @@ --TEST-- -Test fscanf() function: usage variations - scientific formats with arrays +Test fscanf() function: usage variations - scientific formats with strings --FILE-- "One", "two" => 2) -); +// array of strings +$strings = [ + '', + '0', + '1', + "\01", + '\01', + 'string', + 'true', + 'false', + 'null' +]; -$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "% e", "\t%e", "\n%e", "%4e", "%30e", "%[0-9]", "%*e"); +$scientific_formats = array( "%e", "%he", "%le", "%Le", " %e", "%e ", "\t%e", "\n%e", "%4e", "%30e", "%[0-9]", "%*e"); $counter = 1; // writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); +foreach($strings as $string) { + @fprintf($file_handle, $string); @fprintf($file_handle, "\n"); } // closing the file @@ -70,36 +67,21 @@ echo "\n*** Done ***"; --CLEAN-- --EXPECT-- -*** Test fscanf(): different scientific format types with arrays *** +*** Test fscanf(): different scientific format types with strings *** -- iteration 1 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(1) } array(1) { [0]=> @@ -128,29 +110,14 @@ array(1) { bool(false) -- iteration 2 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(0) } array(1) { [0]=> - NULL + float(1) } array(1) { [0]=> @@ -179,29 +146,14 @@ array(1) { bool(false) -- iteration 3 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(1) } array(1) { [0]=> @@ -230,29 +182,14 @@ array(1) { bool(false) -- iteration 4 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(1) } array(1) { [0]=> @@ -281,29 +218,14 @@ array(1) { bool(false) -- iteration 5 -- +NULL array(1) { [0]=> - NULL + float(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(1) } array(1) { [0]=> @@ -332,29 +254,14 @@ array(1) { bool(false) -- iteration 6 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(0) } array(1) { [0]=> - NULL + float(1) } array(1) { [0]=> @@ -383,44 +290,14 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} +NULL array(1) { [0]=> - NULL + float(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(1) } array(1) { [0]=> @@ -448,30 +325,15 @@ array(1) { } bool(false) --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 8 -- +NULL array(1) { [0]=> - NULL + float(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(1) } array(1) { [0]=> @@ -499,30 +361,15 @@ array(1) { } bool(false) --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 9 -- +NULL array(1) { [0]=> - NULL + float(0) } array(1) { [0]=> - NULL + float(1) } array(1) { [0]=> @@ -550,30 +397,15 @@ array(1) { } bool(false) --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 10 -- +NULL array(1) { [0]=> - NULL + float(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL + float(1) } array(1) { [0]=> @@ -601,30 +433,18 @@ array(1) { } bool(false) --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 11 -- array(1) { [0]=> NULL } array(1) { [0]=> - NULL + string(1) "0" } array(1) { [0]=> - NULL + string(1) "1" } array(1) { [0]=> @@ -652,15 +472,8 @@ array(1) { } bool(false) --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} +-- iteration 12 -- +NULL array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation51.phpt b/ext/standard/tests/file/fscanf/fscanf_variation51.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation51.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation51.phpt diff --git a/ext/standard/tests/file/fscanf_variation52.phpt b/ext/standard/tests/file/fscanf/fscanf_variation52.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation52.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation52.phpt diff --git a/ext/standard/tests/file/fscanf_variation53.phpt b/ext/standard/tests/file/fscanf/fscanf_variation53.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation53.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation53.phpt diff --git a/ext/standard/tests/file/fscanf_variation55.phpt b/ext/standard/tests/file/fscanf/fscanf_variation55.phpt similarity index 100% rename from ext/standard/tests/file/fscanf_variation55.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation55.phpt diff --git a/ext/standard/tests/file/fscanf_variation5.phpt b/ext/standard/tests/file/fscanf/fscanf_variation6.phpt similarity index 61% rename from ext/standard/tests/file/fscanf_variation5.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation6.phpt index 7ccdbf6402e49..8f19341cfb72b 100644 --- a/ext/standard/tests/file/fscanf_variation5.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation6.phpt @@ -1,43 +1,40 @@ --TEST-- -Test fscanf() function: usage variations - integer formats with arrays +Test fscanf() function: usage variations - integer formats with strings --FILE-- "One", "two" => 2) -); +// array of strings +$strings = [ + '', + '0', + '1', + "\01", + '\01', + 'string', + 'true', + 'false', + 'null' +]; -$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "% d", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d"); +$int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d"); $counter = 1; // writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); +foreach($strings as $string) { + @fprintf($file_handle, $string); @fprintf($file_handle, "\n"); } // closing the file @@ -70,36 +67,21 @@ echo "\n*** Done ***"; --CLEAN-- --EXPECT-- -*** Test fscanf(): different integer format types with arrays *** +*** Test fscanf(): different integer format types with strings *** -- iteration 1 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -128,29 +110,14 @@ array(1) { bool(false) -- iteration 2 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(0) } array(1) { [0]=> - NULL + int(1) } array(1) { [0]=> @@ -179,29 +146,14 @@ array(1) { bool(false) -- iteration 3 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -230,29 +182,14 @@ array(1) { bool(false) -- iteration 4 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -281,29 +218,14 @@ array(1) { bool(false) -- iteration 5 -- +NULL array(1) { [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -332,29 +254,14 @@ array(1) { bool(false) -- iteration 6 -- +NULL array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(0) } array(1) { [0]=> - NULL + int(1) } array(1) { [0]=> @@ -383,44 +290,14 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} +NULL array(1) { [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -448,30 +325,15 @@ array(1) { } bool(false) --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 8 -- +NULL array(1) { [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -499,30 +361,15 @@ array(1) { } bool(false) --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 9 -- +NULL array(1) { [0]=> - NULL + int(0) } array(1) { [0]=> - NULL + int(1) } array(1) { [0]=> @@ -550,30 +397,15 @@ array(1) { } bool(false) --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 10 -- +NULL array(1) { [0]=> - NULL + int(0) } array(1) { [0]=> - NULL -} -array(1) { - [0]=> - NULL + int(1) } array(1) { [0]=> @@ -601,30 +433,18 @@ array(1) { } bool(false) --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} +-- iteration 11 -- array(1) { [0]=> NULL } array(1) { [0]=> - NULL + string(1) "0" } array(1) { [0]=> - NULL + string(1) "1" } array(1) { [0]=> @@ -652,15 +472,8 @@ array(1) { } bool(false) --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} +-- iteration 12 -- +NULL array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation8.phpt b/ext/standard/tests/file/fscanf/fscanf_variation8.phpt similarity index 93% rename from ext/standard/tests/file/fscanf_variation8.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation8.phpt index 2851d7c027736..0a01fd93ee5c2 100644 --- a/ext/standard/tests/file/fscanf_variation8.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation8.phpt @@ -52,7 +52,7 @@ $valid_floats = array( // various float formats $float_formats = array( "%f", "%hf", "%lf", "%Lf", - " %f", "%f ", "% f", + " %f", "%f ", "\t%f", "\n%f", "%4f", "%30f", "%[0-9]", "%*f", ); @@ -839,39 +839,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> float(-2147483649) @@ -994,7 +961,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> float(-2147483649) @@ -1117,7 +1084,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> float(-214) @@ -1240,7 +1207,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> float(-2147483649) @@ -1363,7 +1330,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> NULL @@ -1486,7 +1453,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation9.phpt b/ext/standard/tests/file/fscanf/fscanf_variation9.phpt similarity index 93% rename from ext/standard/tests/file/fscanf_variation9.phpt rename to ext/standard/tests/file/fscanf/fscanf_variation9.phpt index 8b88a036f3baf..1d6bb22045ce0 100644 --- a/ext/standard/tests/file/fscanf_variation9.phpt +++ b/ext/standard/tests/file/fscanf/fscanf_variation9.phpt @@ -44,7 +44,7 @@ $integer_values = array ( 017777777777 // max positive integer as octal ); -$float_formats = array( "%f", "%hf", "%lf", "%Lf", " %f", "%f ", "% f", "\t%f", "\n%f", "%4f", "%30f", "%[0-9]", "%*f"); +$float_formats = array( "%f", "%hf", "%lf", "%Lf", " %f", "%f ", "\t%f", "\n%f", "%4f", "%30f", "%[0-9]", "%*f"); $counter = 1; @@ -540,27 +540,6 @@ array(1) { bool(false) -- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- array(1) { [0]=> float(0) @@ -635,7 +614,7 @@ array(1) { } bool(false) --- iteration 9 -- +-- iteration 8 -- array(1) { [0]=> float(0) @@ -710,7 +689,7 @@ array(1) { } bool(false) --- iteration 10 -- +-- iteration 9 -- array(1) { [0]=> float(0) @@ -785,7 +764,7 @@ array(1) { } bool(false) --- iteration 11 -- +-- iteration 10 -- array(1) { [0]=> float(0) @@ -860,7 +839,7 @@ array(1) { } bool(false) --- iteration 12 -- +-- iteration 11 -- array(1) { [0]=> string(1) "0" @@ -935,7 +914,7 @@ array(1) { } bool(false) --- iteration 13 -- +-- iteration 12 -- array(0) { } array(0) { diff --git a/ext/standard/tests/file/fscanf_variation10.phpt b/ext/standard/tests/file/fscanf_variation10.phpt deleted file mode 100644 index 1de7d25ffd90f..0000000000000 --- a/ext/standard/tests/file/fscanf_variation10.phpt +++ /dev/null @@ -1,216 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - float formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different float format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation12.phpt b/ext/standard/tests/file/fscanf_variation12.phpt deleted file mode 100644 index 0969d05febced..0000000000000 --- a/ext/standard/tests/file/fscanf_variation12.phpt +++ /dev/null @@ -1,908 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - float formats with strings ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different float format types with strings *** - --- iteration 1 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -NULL -NULL -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation13.phpt b/ext/standard/tests/file/fscanf_variation13.phpt deleted file mode 100644 index 73806dc6e488b..0000000000000 --- a/ext/standard/tests/file/fscanf_variation13.phpt +++ /dev/null @@ -1,236 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - float formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different float format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -NULL -array(0) { -} -NULL -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation16.phpt b/ext/standard/tests/file/fscanf_variation16.phpt deleted file mode 100644 index 199db82a026e8..0000000000000 --- a/ext/standard/tests/file/fscanf_variation16.phpt +++ /dev/null @@ -1,215 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - string formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different string format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - string(4) "Reso" -} -array(1) { - [0]=> - string(4) "Reso" -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation17.phpt b/ext/standard/tests/file/fscanf_variation17.phpt deleted file mode 100644 index 64080a1a83b95..0000000000000 --- a/ext/standard/tests/file/fscanf_variation17.phpt +++ /dev/null @@ -1,686 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - string formats with arrays ---FILE-- - "One", "two" => 2) -); - -$string_formats = array( "%s", - "%hs", "%ls", "%Ls", - " %s", "%s ", "% s", - "\t%s", "\n%s", "%4s", - "%30s", "%[a-zA-Z0-9]", "%*s"); - -$counter = 1; - -// writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); - @fprintf($file_handle, "\n"); -} -// closing the file -fclose($file_handle); - -// opening the file for reading -$file_handle = fopen($filename, "r"); -if($file_handle == false) { - exit("Error:failed to open file $filename"); -} - -$counter = 1; -// reading the values from file using different string formats -foreach($string_formats as $string_format) { - // rewind the file so that for every foreach iteration the file pointer starts from bof - rewind($file_handle); - echo "\n-- iteration $counter --\n"; - while( !feof($file_handle) ) { - try { - var_dump(fscanf($file_handle,$string_format)); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different string format types with arrays *** - --- iteration 1 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation19.phpt b/ext/standard/tests/file/fscanf_variation19.phpt deleted file mode 100644 index f5bc3f19e386c..0000000000000 --- a/ext/standard/tests/file/fscanf_variation19.phpt +++ /dev/null @@ -1,240 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - string formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different string format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -NULL -array(0) { -} -NULL -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation22.phpt b/ext/standard/tests/file/fscanf_variation22.phpt deleted file mode 100644 index 87a5fe21bc27a..0000000000000 --- a/ext/standard/tests/file/fscanf_variation22.phpt +++ /dev/null @@ -1,215 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - char formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different char format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - string(1) "R" -} -array(1) { - [0]=> - string(1) "R" -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - string(4) "Reso" -} -array(1) { - [0]=> - string(4) "Reso" -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(8) "Resource" -} -array(1) { - [0]=> - string(8) "Resource" -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation23.phpt b/ext/standard/tests/file/fscanf_variation23.phpt deleted file mode 100644 index f7bb4ee552011..0000000000000 --- a/ext/standard/tests/file/fscanf_variation23.phpt +++ /dev/null @@ -1,686 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - char formats with arrays ---FILE-- - "One", "two" => 2) -); - -$char_formats = array( "%c", - "%hc", "%lc", "%Lc", - " %c", "%c ", "% c", - "\t%c", "\n%c", "%4c", - "%30c", "%[a-zA-Z@#$&0-9]", "%*c"); - -$counter = 1; - -// writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); - @fprintf($file_handle, "\n"); -} -// closing the file -fclose($file_handle); - -// opening the file for reading -$file_handle = fopen($filename, "r"); -if($file_handle == false) { - exit("Error:failed to open file $filename"); -} - -$counter = 1; -// reading the values from file using different char formats -foreach($char_formats as $char_format) { - // rewind the file so that for every foreach iteration the file pointer starts from bof - rewind($file_handle); - echo "\n-- iteration $counter --\n"; - while( !feof($file_handle) ) { - try { - var_dump(fscanf($file_handle,$char_format)); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different char format types with arrays *** - --- iteration 1 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -array(1) { - [0]=> - string(1) "A" -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -array(1) { - [0]=> - string(4) "Arra" -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -array(1) { - [0]=> - string(5) "Array" -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation25.phpt b/ext/standard/tests/file/fscanf_variation25.phpt deleted file mode 100644 index dc9d9936022fb..0000000000000 --- a/ext/standard/tests/file/fscanf_variation25.phpt +++ /dev/null @@ -1,284 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - char formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different char format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - string(1) "1" -} -NULL -array(1) { - [0]=> - string(1) "1" -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(0) "" -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation29.phpt b/ext/standard/tests/file/fscanf_variation29.phpt deleted file mode 100644 index a35d782fcd456..0000000000000 --- a/ext/standard/tests/file/fscanf_variation29.phpt +++ /dev/null @@ -1,216 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - octal formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different octal format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation31.phpt b/ext/standard/tests/file/fscanf_variation31.phpt deleted file mode 100644 index a9e2c8b26865a..0000000000000 --- a/ext/standard/tests/file/fscanf_variation31.phpt +++ /dev/null @@ -1,908 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - octal formats with strings ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different octal format types with strings *** - --- iteration 1 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -NULL -NULL -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation32.phpt b/ext/standard/tests/file/fscanf_variation32.phpt deleted file mode 100644 index df393f9d83980..0000000000000 --- a/ext/standard/tests/file/fscanf_variation32.phpt +++ /dev/null @@ -1,241 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - octal formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different octal format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -NULL -array(0) { -} -NULL -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation35.phpt b/ext/standard/tests/file/fscanf_variation35.phpt deleted file mode 100644 index 61b939d32122d..0000000000000 --- a/ext/standard/tests/file/fscanf_variation35.phpt +++ /dev/null @@ -1,211 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - hexa formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different hexa format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation36.phpt b/ext/standard/tests/file/fscanf_variation36.phpt deleted file mode 100644 index 61571f6c6cb04..0000000000000 --- a/ext/standard/tests/file/fscanf_variation36.phpt +++ /dev/null @@ -1,682 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - hexa formats with arrays ---FILE-- - "One", "two" => 2) -); - -$hexa_formats = array( "%x", "%hx", "%lx", "%Lx", " %x", "%x ", "% x", "\t%x", "\n%x", "%4x", "%30x", "%[0-9]", "%*x"); - -$counter = 1; - -// writing to the file -foreach($array_types as $value) { - @fprintf($file_handle, "%s", $value); - @fprintf($file_handle, "\n"); -} -// closing the file -fclose($file_handle); - -// opening the file for reading -$file_handle = fopen($filename, "r"); -if($file_handle == false) { - exit("Error:failed to open file $filename"); -} - -$counter = 1; -// reading the values from file using different hexa formats -foreach($hexa_formats as $hexa_format) { - // rewind the file so that for every foreach iteration the file pointer starts from bof - rewind($file_handle); - echo "\n-- iteration $counter --\n"; - while( !feof($file_handle) ) { - try { - var_dump(fscanf($file_handle,$hexa_format)); - } catch (ValueError $exception) { - echo $exception->getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different hexa format types with arrays *** - --- iteration 1 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -array(1) { - [0]=> - int(10) -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation38.phpt b/ext/standard/tests/file/fscanf_variation38.phpt deleted file mode 100644 index 236d547f6b786..0000000000000 --- a/ext/standard/tests/file/fscanf_variation38.phpt +++ /dev/null @@ -1,236 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - hexa formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different hexa format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -NULL -array(0) { -} -NULL -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation4.phpt b/ext/standard/tests/file/fscanf_variation4.phpt deleted file mode 100644 index 45a3b5702b1f6..0000000000000 --- a/ext/standard/tests/file/fscanf_variation4.phpt +++ /dev/null @@ -1,212 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - integer formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different integer format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation41.phpt b/ext/standard/tests/file/fscanf_variation41.phpt deleted file mode 100644 index 4c993bbeec5a9..0000000000000 --- a/ext/standard/tests/file/fscanf_variation41.phpt +++ /dev/null @@ -1,211 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - unsigned formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different unsigned format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation43.phpt b/ext/standard/tests/file/fscanf_variation43.phpt deleted file mode 100644 index 72afbba0c3868..0000000000000 --- a/ext/standard/tests/file/fscanf_variation43.phpt +++ /dev/null @@ -1,908 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - unsigned formats with strings ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different unsigned format types with strings *** - --- iteration 1 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -NULL -NULL -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation44.phpt b/ext/standard/tests/file/fscanf_variation44.phpt deleted file mode 100644 index 3dfd5d6d7bdaf..0000000000000 --- a/ext/standard/tests/file/fscanf_variation44.phpt +++ /dev/null @@ -1,236 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - unsigned formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different unsigned format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -NULL -array(0) { -} -NULL -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation47.phpt b/ext/standard/tests/file/fscanf_variation47.phpt deleted file mode 100644 index 04b92b7e9f786..0000000000000 --- a/ext/standard/tests/file/fscanf_variation47.phpt +++ /dev/null @@ -1,211 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - scientific formats with resource ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -// closing the resources -fclose($fp); -closedir($dfp); - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different scientific format types with resource *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation49.phpt b/ext/standard/tests/file/fscanf_variation49.phpt deleted file mode 100644 index 43505fc249178..0000000000000 --- a/ext/standard/tests/file/fscanf_variation49.phpt +++ /dev/null @@ -1,908 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - scientific formats with strings ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different scientific format types with strings *** - --- iteration 1 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -NULL -NULL -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(0) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - float(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -NULL -NULL -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation50.phpt b/ext/standard/tests/file/fscanf_variation50.phpt deleted file mode 100644 index 1e6ecb865e940..0000000000000 --- a/ext/standard/tests/file/fscanf_variation50.phpt +++ /dev/null @@ -1,236 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - scientific formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different scientific format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - float(1) -} -NULL -array(1) { - [0]=> - float(1) -} -NULL -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -NULL -array(0) { -} -NULL -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation54.phpt b/ext/standard/tests/file/fscanf_variation54.phpt deleted file mode 100644 index b13a4ee1b83d2..0000000000000 --- a/ext/standard/tests/file/fscanf_variation54.phpt +++ /dev/null @@ -1,95 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - objects ---FILE-- - ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): to read objects from a file *** - --- iteration 1 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(6) "Object" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation6.phpt b/ext/standard/tests/file/fscanf_variation6.phpt deleted file mode 100644 index 577477e5de604..0000000000000 --- a/ext/standard/tests/file/fscanf_variation6.phpt +++ /dev/null @@ -1,908 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - integer formats with strings ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different integer format types with strings *** - --- iteration 1 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 2 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 3 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 4 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 5 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 6 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 9 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 10 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 11 -- -NULL -NULL -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(0) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - int(1) -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "0" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -NULL -NULL -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -array(0) { -} -bool(false) - -*** Done *** diff --git a/ext/standard/tests/file/fscanf_variation7.phpt b/ext/standard/tests/file/fscanf_variation7.phpt deleted file mode 100644 index 42e2455eea801..0000000000000 --- a/ext/standard/tests/file/fscanf_variation7.phpt +++ /dev/null @@ -1,236 +0,0 @@ ---TEST-- -Test fscanf() function: usage variations - integer formats with boolean ---FILE-- -getMessage() . "\n"; - } - } - $counter++; -} - -echo "\n*** Done ***"; -?> ---CLEAN-- - ---EXPECT-- -*** Test fscanf(): different integer format types with boolean data *** - --- iteration 1 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 2 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 3 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 4 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 5 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 6 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 7 -- -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -Bad scan conversion character " " -bool(false) - --- iteration 8 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 9 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 10 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 11 -- -array(1) { - [0]=> - int(1) -} -NULL -array(1) { - [0]=> - int(1) -} -NULL -bool(false) - --- iteration 12 -- -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -array(1) { - [0]=> - string(1) "1" -} -array(1) { - [0]=> - NULL -} -bool(false) - --- iteration 13 -- -array(0) { -} -NULL -array(0) { -} -NULL -bool(false) - -*** Done *** diff --git a/ext/standard/tests/strings/gh15552.phpt b/ext/standard/tests/strings/gh15552.phpt deleted file mode 100644 index 60804e025d862..0000000000000 --- a/ext/standard/tests/strings/gh15552.phpt +++ /dev/null @@ -1,9 +0,0 @@ ---TEST-- -Bug GH-15552 (Signed integer overflow in ext/standard/scanf.c) ---FILE-- - ---EXPECTF-- -Fatal error: Uncaught ValueError: "%n$" argument index out of range in %s:%d -Stack trace:%A diff --git a/ext/standard/tests/strings/bug21730.phpt b/ext/standard/tests/strings/scanf/bug21730.phpt similarity index 100% rename from ext/standard/tests/strings/bug21730.phpt rename to ext/standard/tests/strings/scanf/bug21730.phpt diff --git a/ext/standard/tests/strings/bug27295.phpt b/ext/standard/tests/strings/scanf/bug27295.phpt similarity index 100% rename from ext/standard/tests/strings/bug27295.phpt rename to ext/standard/tests/strings/scanf/bug27295.phpt diff --git a/ext/standard/tests/strings/bug38322.phpt b/ext/standard/tests/strings/scanf/bug38322.phpt similarity index 100% rename from ext/standard/tests/strings/bug38322.phpt rename to ext/standard/tests/strings/scanf/bug38322.phpt diff --git a/ext/standard/tests/strings/bug42107.phpt b/ext/standard/tests/strings/scanf/bug42107.phpt similarity index 100% rename from ext/standard/tests/strings/bug42107.phpt rename to ext/standard/tests/strings/scanf/bug42107.phpt diff --git a/ext/standard/tests/strings/bug47322.phpt b/ext/standard/tests/strings/scanf/bug47322.phpt similarity index 100% rename from ext/standard/tests/strings/bug47322.phpt rename to ext/standard/tests/strings/scanf/bug47322.phpt diff --git a/ext/standard/tests/strings/bug47842.phpt b/ext/standard/tests/strings/scanf/bug47842.phpt similarity index 96% rename from ext/standard/tests/strings/bug47842.phpt rename to ext/standard/tests/strings/scanf/bug47842.phpt index 1c8da881e7ced..b8826d89c6bb7 100644 --- a/ext/standard/tests/strings/bug47842.phpt +++ b/ext/standard/tests/strings/scanf/bug47842.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #47842 sscanf() does not support 64-bit values +Bug #47842 sscanf() does not support 64-bit values --SKIPIF-- getMessage(), PHP_EOL; +} +?> +--EXPECT-- +ValueError: sscanf(): Argument #2 ($format) argument index %2147483648$ is out of range diff --git a/ext/standard/tests/strings/sscanf_basic1.phpt b/ext/standard/tests/strings/scanf/sscanf_basic1.phpt similarity index 100% rename from ext/standard/tests/strings/sscanf_basic1.phpt rename to ext/standard/tests/strings/scanf/sscanf_basic1.phpt diff --git a/ext/standard/tests/strings/sscanf_basic2.phpt b/ext/standard/tests/strings/scanf/sscanf_basic2.phpt similarity index 100% rename from ext/standard/tests/strings/sscanf_basic2.phpt rename to ext/standard/tests/strings/scanf/sscanf_basic2.phpt diff --git a/ext/standard/tests/strings/sscanf_basic3.phpt b/ext/standard/tests/strings/scanf/sscanf_basic3.phpt similarity index 100% rename from ext/standard/tests/strings/sscanf_basic3.phpt rename to ext/standard/tests/strings/scanf/sscanf_basic3.phpt diff --git a/ext/standard/tests/strings/sscanf_basic4.phpt b/ext/standard/tests/strings/scanf/sscanf_basic4.phpt similarity index 100% rename from ext/standard/tests/strings/sscanf_basic4.phpt rename to ext/standard/tests/strings/scanf/sscanf_basic4.phpt diff --git a/ext/standard/tests/strings/sscanf_basic5.phpt b/ext/standard/tests/strings/scanf/sscanf_basic5.phpt similarity index 100% rename from ext/standard/tests/strings/sscanf_basic5.phpt rename to ext/standard/tests/strings/scanf/sscanf_basic5.phpt diff --git a/ext/standard/tests/strings/sscanf_basic6.phpt b/ext/standard/tests/strings/scanf/sscanf_basic6.phpt similarity index 100% rename from ext/standard/tests/strings/sscanf_basic6.phpt rename to ext/standard/tests/strings/scanf/sscanf_basic6.phpt diff --git a/ext/standard/tests/strings/sscanf_basic7.phpt b/ext/standard/tests/strings/scanf/sscanf_basic7.phpt similarity index 100% rename from ext/standard/tests/strings/sscanf_basic7.phpt rename to ext/standard/tests/strings/scanf/sscanf_basic7.phpt diff --git a/ext/standard/tests/strings/sscanf_basic8.phpt b/ext/standard/tests/strings/scanf/sscanf_basic8.phpt similarity index 100% rename from ext/standard/tests/strings/sscanf_basic8.phpt rename to ext/standard/tests/strings/scanf/sscanf_basic8.phpt diff --git a/ext/standard/tests/strings/scanf/sscanf_binary_strings.phpt b/ext/standard/tests/strings/scanf/sscanf_binary_strings.phpt new file mode 100644 index 0000000000000..4e34707adbc83 --- /dev/null +++ b/ext/standard/tests/strings/scanf/sscanf_binary_strings.phpt @@ -0,0 +1,32 @@ +--TEST-- +sscanf(): with strings containing null bytes +--FILE-- +getMessage(), PHP_EOL; +} +try { + var_dump(sscanf($str, $format, $a, $b, $c)); + var_dump($a, $b, $c); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} +?> +--EXPECT-- +array(3) { + [0]=> + string(5) "Hello" + [1]=> + string(9) "wonderful" + [2]=> + string(6) "World!" +} +int(3) +string(5) "Hello" +string(9) "wonderful" +string(6) "World!" diff --git a/ext/standard/tests/strings/sscanf_error.phpt b/ext/standard/tests/strings/scanf/sscanf_error.phpt similarity index 88% rename from ext/standard/tests/strings/sscanf_error.phpt rename to ext/standard/tests/strings/scanf/sscanf_error.phpt index e04b5e2cbb625..bc118ff65c98c 100644 --- a/ext/standard/tests/strings/sscanf_error.phpt +++ b/ext/standard/tests/strings/scanf/sscanf_error.phpt @@ -20,4 +20,4 @@ try { *** Testing sscanf() : error conditions *** -- Testing sscanf() function with more than expected no. of arguments -- -Variable is not assigned by any conversion specifiers +sscanf(): Argument #5 is not assigned by any conversion specifiers diff --git a/ext/standard/tests/strings/scanf/sscanf_format_string_XPG_assignments.phpt b/ext/standard/tests/strings/scanf/sscanf_format_string_XPG_assignments.phpt new file mode 100644 index 0000000000000..fe3096a72932b --- /dev/null +++ b/ext/standard/tests/strings/scanf/sscanf_format_string_XPG_assignments.phpt @@ -0,0 +1,47 @@ +--TEST-- +sscanf(): format string XPG argument tests +--FILE-- +getMessage(), PHP_EOL; + } + try { + var_dump(sscanf($str, $format, $a, $b, $c)); + var_dump($a, $b, $c); + $a = $b = $c = null; + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} +?> +--EXPECT-- +Using format string '%1$s %2$s %1$s': +ValueError: sscanf(): Argument #2 ($format) argument 1 is assigned by multiple "%n$" conversion specifiers +ValueError: sscanf(): Argument #3 is assigned by multiple "%n$" conversion specifiers +Using format string '%1$s %*s %3$s': +array(3) { + [0]=> + string(5) "Hello" + [1]=> + NULL + [2]=> + NULL +} +ValueError: sscanf(): Argument #4 is not assigned by any conversion specifiers +Using format string '%s %*s %3$s': +ValueError: sscanf(): Argument #2 ($format) cannot mix "%" and "%n$" conversion specifiers +ValueError: sscanf(): Argument #2 ($format) cannot mix "%" and "%n$" conversion specifiers diff --git a/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_rangespecifier.phpt b/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_rangespecifier.phpt new file mode 100644 index 0000000000000..27cc4f844263f --- /dev/null +++ b/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_rangespecifier.phpt @@ -0,0 +1,45 @@ +--TEST-- +sscanf(): unterminated range [] specifier +--FILE-- + [$str, $str . $pattern], + $r, + ) + ); + } + return $r; +} + +$modifiers = [ + '^', + ']', +]; + +$formats = combinatorial_concat('%[', $modifiers); + +$str = "Hello World"; + +foreach ($formats as $format) { + echo "Using format string '$format':\n"; + try { + sscanf($str, $format); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} +?> +--EXPECT-- +Using format string '%[': +ValueError: sscanf(): Argument #2 ($format) unterminated [ format specifier +Using format string '%[]': +ValueError: sscanf(): Argument #2 ($format) unterminated [ format specifier +Using format string '%[^': +ValueError: sscanf(): Argument #2 ($format) unterminated [ format specifier +Using format string '%[^]': +ValueError: sscanf(): Argument #2 ($format) unterminated [ format specifier diff --git a/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_specifier.phpt b/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_specifier.phpt new file mode 100644 index 0000000000000..ea2011288cbee --- /dev/null +++ b/ext/standard/tests/strings/scanf/sscanf_format_string_unterminated_specifier.phpt @@ -0,0 +1,71 @@ +--TEST-- +sscanf(): format string which is unterminated +--FILE-- + [$str, $str . $pattern], + $r, + ) + ); + } + return $r; +} + +$modifiers = [ + '*', + '1$', // XPG + '2', // Width + 'L', // Size +]; + +$formats = combinatorial_concat('%', $modifiers); + +$str = "Hello World"; + +foreach ($formats as $format) { + echo "Using format string '$format':\n"; + try { + sscanf($str, $format); + } catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; + } +} +?> +--EXPECT-- +Using format string '%': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier +Using format string '%L': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier +Using format string '%2': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier +Using format string '%2L': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier +Using format string '%1$': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier +Using format string '%1$L': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier +Using format string '%1$2': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier +Using format string '%1$2L': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier +Using format string '%*': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier +Using format string '%*L': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier +Using format string '%*2': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier +Using format string '%*2L': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier +Using format string '%*1$': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier +Using format string '%*1$L': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier +Using format string '%*1$2': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier +Using format string '%*1$2L': +ValueError: sscanf(): Argument #2 ($format) unterminated format specifier diff --git a/ext/standard/tests/strings/scanf/sscanf_range_specifier_edge_cases.phpt b/ext/standard/tests/strings/scanf/sscanf_range_specifier_edge_cases.phpt new file mode 100644 index 0000000000000..8105dfaefa8b3 --- /dev/null +++ b/ext/standard/tests/strings/scanf/sscanf_range_specifier_edge_cases.phpt @@ -0,0 +1,28 @@ +--TEST-- +sscanf(): test %[] specifier with edge cases +--FILE-- +getMessage(), PHP_EOL; +} +try { + sscanf('-in-', '%[-i-n]', $out); + var_dump($out); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} +try { + sscanf('-[in]-', '%[][-i-n]', $out); + var_dump($out); +} catch (Throwable $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} +?> +--EXPECT-- +string(7) "[hello]" +string(4) "-in-" +string(4) "-in-" diff --git a/ext/standard/tests/strings/scanf/sscanf_range_specifier_ints.phpt b/ext/standard/tests/strings/scanf/sscanf_range_specifier_ints.phpt new file mode 100644 index 0000000000000..f073616ea24dc --- /dev/null +++ b/ext/standard/tests/strings/scanf/sscanf_range_specifier_ints.phpt @@ -0,0 +1,53 @@ +--TEST-- +sscanf(): test %[] specifier with numbers +--FILE-- + +--EXPECT-- +Using format string '%[240531]': +string(12) "001122334455" +Using format string '%[0-5]': +string(12) "001122334455" +Using format string '%[5-0]': +string(12) "001122334455" +Using format string '%[^9687]': +string(12) "001122334455" +Using format string '%[^6-9]': +string(12) "001122334455" +Using format string '%[^9-6]': +string(12) "001122334455" +Using format string '%4[240531]': +string(4) "0011" +Using format string '%4[0-5]': +string(4) "0011" +Using format string '%4[5-0]': +string(4) "0011" +Using format string '%4[^9687]': +string(4) "0011" +Using format string '%4[^6-9]': +string(4) "0011" +Using format string '%4[^9-6]': +string(4) "0011" diff --git a/ext/standard/tests/strings/scanf/sscanf_range_specifier_strings.phpt b/ext/standard/tests/strings/scanf/sscanf_range_specifier_strings.phpt new file mode 100644 index 0000000000000..760725cc93342 --- /dev/null +++ b/ext/standard/tests/strings/scanf/sscanf_range_specifier_strings.phpt @@ -0,0 +1,50 @@ +--TEST-- +sscanf(): test %[] specifier with strings +--FILE-- + +--EXPECT-- +Using format string '%[aefgbcd]': +string(7) "abcdefg" +Using format string '%[a-g]': +string(7) "abcdefg" +Using format string '%[g-a]': +string(7) "abcdefg" +Using format string '%[^uvwstxyz]': +string(18) "abcdefghijklmnopqr" +Using format string '%[^s-z]': +string(18) "abcdefghijklmnopqr" +Using format string '%[^z-s]': +string(18) "abcdefghijklmnopqr" +Using format string '%4[aefgbcd]': +string(4) "abcd" +Using format string '%4[g-a]': +string(4) "abcd" +Using format string '%4[^uvwstxyz]': +string(4) "abcd" +Using format string '%4[^s-z]': +string(4) "abcd" +Using format string '%4[^z-s]': +string(4) "abcd"