diff options
59 files changed, 213 insertions, 197 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index cc31a81a1c..a8aedeb964 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -254,6 +254,12 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_error(uint32_t n return; } + if ((expected_type == Z_EXPECTED_PATH || expected_type == Z_EXPECTED_PATH_OR_NULL) + && Z_TYPE_P(arg) == IS_STRING) { + zend_argument_value_error(num, "must not contain any null bytes"); + return; + } + zend_argument_type_error(num, "must be %s, %s given", expected_error[expected_type], zend_zval_type_name(arg)); } /* }}} */ @@ -668,10 +674,12 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec char **p = va_arg(*va, char **); size_t *pl = va_arg(*va, size_t *); if (!zend_parse_arg_path(arg, p, pl, check_null)) { - zend_spprintf(error, 0, "a valid path%s, %s given", - check_null ? " or null" : "", zend_zval_type_name(arg) - ); - return ""; + if (Z_TYPE_P(arg) == IS_STRING) { + zend_spprintf(error, 0, "must not contain any null bytes"); + return ""; + } else { + return check_null ? "?string" : "string"; + } } } break; @@ -680,10 +688,12 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec { zend_string **str = va_arg(*va, zend_string **); if (!zend_parse_arg_path_str(arg, str, check_null)) { - zend_spprintf(error, 0, "a valid path%s, %s given", - check_null ? " or null" : "", zend_zval_type_name(arg) - ); - return ""; + if (Z_TYPE_P(arg) == IS_STRING) { + zend_spprintf(error, 0, "must not contain any null bytes"); + return ""; + } else { + return check_null ? "?string" : "string"; + } } } break; @@ -762,7 +772,7 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec if (!zend_parse_arg_object(arg, p, ce, check_null)) { if (ce) { if (check_null) { - zend_spprintf(error, 0, "of type ?%s, %s given", ZSTR_VAL(ce->name), zend_zval_type_name(arg)); + zend_spprintf(error, 0, "must be of type ?%s, %s given", ZSTR_VAL(ce->name), zend_zval_type_name(arg)); return ""; } else { return ZSTR_VAL(ce->name); @@ -795,14 +805,14 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec } if (ce_base) { if ((!*pce || !instanceof_function(*pce, ce_base))) { - zend_spprintf(error, 0, "a class name derived from %s%s, %s given", + zend_spprintf(error, 0, "must be a class name derived from %s%s, %s given", ZSTR_VAL(ce_base->name), check_null ? " or null" : "", Z_STRVAL_P(arg)); *pce = NULL; return ""; } } if (!*pce) { - zend_spprintf(error, 0, "a valid class name%s, %s given", + zend_spprintf(error, 0, "must be a valid class name%s, %s given", check_null ? " or null" : "", Z_STRVAL_P(arg)); return ""; } @@ -833,7 +843,7 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec } if (is_callable_error) { - zend_spprintf(error, 0, "a valid callback%s, %s", check_null ? " or null" : "", is_callable_error); + zend_spprintf(error, 0, "must be a valid callback%s, %s", check_null ? " or null" : "", is_callable_error); efree(is_callable_error); return ""; } else { @@ -874,7 +884,11 @@ static zend_result zend_parse_arg(uint32_t arg_num, zval *arg, va_list *va, cons } if (!(flags & ZEND_PARSE_PARAMS_QUIET) && (*expected_type || error)) { if (error) { - zend_argument_type_error(arg_num, "must be %s", error); + if (strcmp(error, "must not contain any null bytes") == 0) { + zend_argument_value_error(arg_num, "%s", error); + } else { + zend_argument_type_error(arg_num, "%s", error); + } efree(error); } else { zend_argument_type_error(arg_num, "must be of type %s, %s given", expected_type, zend_zval_type_name(arg)); diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 336060e576..9bb8957e8e 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -1215,8 +1215,8 @@ static zend_always_inline zval *zend_try_array_init(zval *zv) _(Z_EXPECTED_FUNC_OR_NULL, "a valid callback or null") \ _(Z_EXPECTED_RESOURCE, "of type resource") \ _(Z_EXPECTED_RESOURCE_OR_NULL, "of type resource or null") \ - _(Z_EXPECTED_PATH, "a valid path") \ - _(Z_EXPECTED_PATH_OR_NULL, "a valid path or null") \ + _(Z_EXPECTED_PATH, "of type string") \ + _(Z_EXPECTED_PATH_OR_NULL, "of type ?string") \ _(Z_EXPECTED_OBJECT, "of type object") \ _(Z_EXPECTED_OBJECT_OR_NULL, "of type ?object") \ _(Z_EXPECTED_DOUBLE, "of type float") \ diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 09e02b3ba5..150f98d46f 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -102,7 +102,7 @@ static int php_curl_option_str(php_curl *ch, zend_long option, const char *str, CURLcode error = CURLE_OK; if (strlen(str) != len) { - zend_type_error("%s(): cURL option cannot contain any null-bytes", get_active_function_name()); + zend_value_error("%s(): cURL option must not contain any null bytes", get_active_function_name()); return FAILURE; } diff --git a/ext/curl/tests/bug68089.phpt b/ext/curl/tests/bug68089.phpt index 96405f9134..a4a39ec6f5 100644 --- a/ext/curl/tests/bug68089.phpt +++ b/ext/curl/tests/bug68089.phpt @@ -12,12 +12,12 @@ $ch = curl_init(); try { curl_setopt($ch, CURLOPT_URL, $url); -} catch (TypeError $exception) { +} catch (ValueError $exception) { echo $exception->getMessage() . "\n"; } ?> Done --EXPECT-- -curl_setopt(): cURL option cannot contain any null-bytes +curl_setopt(): cURL option must not contain any null bytes Done diff --git a/ext/exif/exif.c b/ext/exif/exif.c index b47dea6109..59a3ab74d5 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -4541,7 +4541,7 @@ PHP_FUNCTION(exif_read_data) } if (CHECK_NULL_PATH(Z_STRVAL_P(stream), Z_STRLEN_P(stream))) { - zend_argument_type_error(1, "cannot contain any null-bytes"); + zend_argument_value_error(1, "must not contain any null bytes"); RETURN_THROWS(); } @@ -4718,7 +4718,7 @@ PHP_FUNCTION(exif_thumbnail) } if (CHECK_NULL_PATH(Z_STRVAL_P(stream), Z_STRLEN_P(stream))) { - zend_argument_type_error(1, "cannot contain any null-bytes"); + zend_argument_value_error(1, "must not contain any null bytes"); RETURN_THROWS(); } diff --git a/ext/exif/tests/filename_empty.phpt b/ext/exif/tests/filename_empty.phpt index 7896c87fbb..b2f58ae3c5 100644 --- a/ext/exif/tests/filename_empty.phpt +++ b/ext/exif/tests/filename_empty.phpt @@ -17,13 +17,13 @@ try { try { exif_read_data("foo\0bar"); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } try { exif_thumbnail("foo\0bar"); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } @@ -31,5 +31,5 @@ try { --EXPECT-- exif_read_data(): Argument #1 ($filename) cannot be empty exif_thumbnail(): Argument #1 ($filename) cannot be empty -exif_read_data(): Argument #1 ($filename) cannot contain any null-bytes -exif_thumbnail(): Argument #1 ($filename) cannot contain any null-bytes +exif_read_data(): Argument #1 ($filename) must not contain any null bytes +exif_thumbnail(): Argument #1 ($filename) must not contain any null bytes diff --git a/ext/fileinfo/tests/finfo_open_001.phpt b/ext/fileinfo/tests/finfo_open_001.phpt index 7099897142..1b1a1a6900 100644 --- a/ext/fileinfo/tests/finfo_open_001.phpt +++ b/ext/fileinfo/tests/finfo_open_001.phpt @@ -7,7 +7,7 @@ finfo_open(): Testing magic_file names try { var_dump(finfo_open(FILEINFO_MIME, "\0")); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } @@ -19,7 +19,7 @@ var_dump(finfo_open(FILEINFO_MIME, '/foo/bar/inexistent')); ?> --EXPECTF-- -finfo_open(): Argument #2 ($arg) must be a valid path, string given +finfo_open(): Argument #2 ($arg) must not contain any null bytes resource(%d) of type (file_info) resource(%d) of type (file_info) diff --git a/ext/gd/tests/imagegd2_nullbyte_injection.phpt b/ext/gd/tests/imagegd2_nullbyte_injection.phpt index eda6cfed42..38065dab0a 100644 --- a/ext/gd/tests/imagegd2_nullbyte_injection.phpt +++ b/ext/gd/tests/imagegd2_nullbyte_injection.phpt @@ -9,9 +9,9 @@ Testing null byte injection in imagegd2 $image = imagecreate(1,1);// 1px image try { imagegd($image, "./foo\0bar"); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } ?> --EXPECT-- -imagegd(): Argument #2 ($to) must be a valid path, string given +imagegd(): Argument #2 ($to) must not contain any null bytes diff --git a/ext/gd/tests/imagegd_nullbyte_injection.phpt b/ext/gd/tests/imagegd_nullbyte_injection.phpt index d10e7dc31b..4a77b15ee0 100644 --- a/ext/gd/tests/imagegd_nullbyte_injection.phpt +++ b/ext/gd/tests/imagegd_nullbyte_injection.phpt @@ -9,9 +9,9 @@ Testing null byte injection in imagegd $image = imagecreate(1,1);// 1px image try { imagegd($image, "./foo\0bar"); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } ?> --EXPECT-- -imagegd(): Argument #2 ($to) must be a valid path, string given +imagegd(): Argument #2 ($to) must not contain any null bytes diff --git a/ext/gd/tests/imagexbm_nullbyte_injection.phpt b/ext/gd/tests/imagexbm_nullbyte_injection.phpt index 91f757614e..8bd90b0d85 100644 --- a/ext/gd/tests/imagexbm_nullbyte_injection.phpt +++ b/ext/gd/tests/imagexbm_nullbyte_injection.phpt @@ -9,9 +9,9 @@ if(!extension_loaded('gd')) die('skip gd extension not available'); $image = imagecreate(1,1);// 1px image try { imagexbm($image, "./foo\0bar"); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } ?> --EXPECT-- -imagexbm(): Argument #2 ($filename) must be a valid path or null, string given +imagexbm(): Argument #2 ($filename) must not contain any null bytes diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 64be043362..4e3820f35e 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -360,7 +360,7 @@ static void php_hash_do_hash( } if (isfilename) { if (CHECK_NULL_PATH(data, data_len)) { - zend_argument_type_error(1, "must be a valid path"); + zend_argument_value_error(1, "must not contain any null bytes"); RETURN_THROWS(); } stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS, NULL, FG(default_context)); @@ -499,7 +499,7 @@ static void php_hash_do_hash_hmac( if (isfilename) { if (CHECK_NULL_PATH(data, data_len)) { - zend_argument_type_error(2, "must be a valid path"); + zend_argument_value_error(2, "must not contain any null bytes"); RETURN_THROWS(); } stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS, NULL, FG(default_context)); diff --git a/ext/hash/tests/hash_hmac_file_error.phpt b/ext/hash/tests/hash_hmac_file_error.phpt index 6e45aaef28..7cbc347691 100644 --- a/ext/hash/tests/hash_hmac_file_error.phpt +++ b/ext/hash/tests/hash_hmac_file_error.phpt @@ -28,7 +28,7 @@ echo "\n-- Testing hash_hmac_file() function with bad path --\n"; try { var_dump(hash_hmac_file('md5', $file.chr(0).$file, $key, TRUE)); } -catch (TypeError $e) { +catch (ValueError $e) { echo $e->getMessage() . "\n"; } @@ -43,4 +43,4 @@ hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algo hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm -- Testing hash_hmac_file() function with bad path -- -hash_hmac_file(): Argument #2 ($data) must be a valid path +hash_hmac_file(): Argument #2 ($data) must not contain any null bytes diff --git a/ext/phar/tests/badparameters.phpt b/ext/phar/tests/badparameters.phpt index 47c5d9edfb..e06472233c 100644 --- a/ext/phar/tests/badparameters.phpt +++ b/ext/phar/tests/badparameters.phpt @@ -229,13 +229,13 @@ try { ?> --EXPECTF-- Phar::mungServer(): Argument #1 ($munglist) must be of type array, string given -Phar::createDefaultStub(): Argument #1 ($index) must be a valid path or null, array given -Phar::loadPhar(): Argument #1 ($filename) must be a valid path, array given +Phar::createDefaultStub(): Argument #1 ($index) must be of type ?string, array given +Phar::loadPhar(): Argument #1 ($filename) must be of type string, array given Phar::canCompress(): Argument #1 ($method) must be of type int, string given -Phar::__construct(): Argument #1 ($filename) must be a valid path, array given +Phar::__construct(): Argument #1 ($filename) must be of type string, array given Phar::convertToExecutable(): Argument #1 ($format) must be of type int, array given Phar::convertToData(): Argument #1 ($format) must be of type int, array given -PharData::delete(): Argument #1 ($entry) must be a valid path, array given +PharData::delete(): Argument #1 ($entry) must be of type string, array given Cannot write out phar archive, phar is read-only Entry oops does not exist and cannot be deleted %sfrontcontroller10.phar @@ -255,13 +255,13 @@ Phar::compressFiles(): Argument #1 ($compression_type) must be of type int, arra Phar is readonly, cannot change compression Phar::copy() expects exactly 2 parameters, 1 given Cannot copy "a" to "b", phar is read-only -Phar::offsetExists(): Argument #1 ($entry) must be a valid path, array given -Phar::offsetGet(): Argument #1 ($entry) must be a valid path, array given +Phar::offsetExists(): Argument #1 ($entry) must be of type string, array given +Phar::offsetGet(): Argument #1 ($entry) must be of type string, array given Phar::offsetSet() expects exactly 2 parameters, 1 given -PharData::offsetUnset(): Argument #1 ($entry) must be a valid path, array given +PharData::offsetUnset(): Argument #1 ($entry) must be of type string, array given Write operations disabled by the php.ini setting phar.readonly -Phar::addEmptyDir(): Argument #1 ($dirname) must be a valid path, array given -Phar::addFile(): Argument #1 ($filename) must be a valid path, array given +Phar::addEmptyDir(): Argument #1 ($dirname) must be of type string, array given +Phar::addFile(): Argument #1 ($filename) must be of type string, array given Phar::addFromString() expects exactly 2 parameters, 1 given Write operations disabled by the php.ini setting phar.readonly Phar::setMetadata() expects exactly 1 parameter, 2 given diff --git a/ext/phar/tests/bug64931/bug64931.phpt b/ext/phar/tests/bug64931/bug64931.phpt index 2b4b17051e..6d29b301aa 100644 --- a/ext/phar/tests/bug64931/bug64931.phpt +++ b/ext/phar/tests/bug64931/bug64931.phpt @@ -38,7 +38,7 @@ try { try { $phar->addFromString(".phar\0", "gotcha"); -} catch (TypeError $e) { +} catch (ValueError $e) { echo "CAUGHT: ". $e->getMessage() ."\n"; } @@ -53,4 +53,4 @@ CAUGHT: Cannot create any files in magic ".phar" directory CAUGHT: Cannot create any files in magic ".phar" directory CAUGHT: Cannot create any files in magic ".phar" directory CAUGHT: Cannot create any files in magic ".phar" directory -CAUGHT: Phar::addFromString(): Argument #1 ($localname) must be a valid path, string given +CAUGHT: Phar::addFromString(): Argument #1 ($localname) must not contain any null bytes diff --git a/ext/phar/tests/create_path_error.phpt b/ext/phar/tests/create_path_error.phpt index ce0b8a59a2..a3da9c276c 100644 --- a/ext/phar/tests/create_path_error.phpt +++ b/ext/phar/tests/create_path_error.phpt @@ -53,7 +53,7 @@ foreach($checks as $check) { $phar[$check] = 'error'; } - catch (TypeError $e) + catch (ValueError $e) { echo 'Exception: ' . $e->getMessage() . "\n"; } @@ -78,4 +78,4 @@ string(5) "query" 11:Error: file_put_contents(phar://%s): Failed to open stream: phar error: invalid path "%s" contains illegal character 12:Error: file_put_contents(phar://%s): Failed to open stream: phar error: invalid path "%s" contains illegal character 13:Error: file_put_contents(phar://%s): Failed to open stream: phar error: invalid path "%s" contains illegal character -Exception: Phar::offsetSet(): Argument #1 ($entry) must be a valid path, string given +Exception: Phar::offsetSet(): Argument #1 ($entry) must not contain any null bytes diff --git a/ext/phar/tests/fgc_edgecases.phpt b/ext/phar/tests/fgc_edgecases.phpt index 38ff03cce8..a30ca7df19 100644 --- a/ext/phar/tests/fgc_edgecases.phpt +++ b/ext/phar/tests/fgc_edgecases.phpt @@ -52,7 +52,7 @@ include $pname . '/foo/hi'; <?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> <?php unlink(__DIR__ . '/fgc_edgecases.txt'); ?> --EXPECTF-- -file_get_contents(): Argument #1 ($filename) must be a valid path, array given +file_get_contents(): Argument #1 ($filename) must be of type string, array given blah <?php echo file_get_contents("foo/" . basename(__FILE__)); diff --git a/ext/phar/tests/fopen_edgecases2.phpt b/ext/phar/tests/fopen_edgecases2.phpt index ec3176fbc2..4be382bf98 100644 --- a/ext/phar/tests/fopen_edgecases2.phpt +++ b/ext/phar/tests/fopen_edgecases2.phpt @@ -37,7 +37,7 @@ include $pname . '/foo/hi'; <?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> <?php unlink(__DIR__ . '/fopen_edgecases2.txt'); ?> --EXPECTF-- -fopen(): Argument #1 ($filename) must be a valid path, array given +fopen(): Argument #1 ($filename) must be of type string, array given blah test diff --git a/ext/phar/tests/opendir_edgecases.phpt b/ext/phar/tests/opendir_edgecases.phpt index b940960805..53250740a0 100644 --- a/ext/phar/tests/opendir_edgecases.phpt +++ b/ext/phar/tests/opendir_edgecases.phpt @@ -55,7 +55,7 @@ include $pname . '/foo'; <?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?> <?php rmdir(__DIR__ . '/opendir_edgecases'); --EXPECTF-- -opendir(): Argument #1 ($path) must be a valid path, array given +opendir(): Argument #1 ($path) must be of type string, array given . .. foo diff --git a/ext/phar/tests/phar_extract.phpt b/ext/phar/tests/phar_extract.phpt index 65a96b0aab..0a8431d044 100644 --- a/ext/phar/tests/phar_extract.phpt +++ b/ext/phar/tests/phar_extract.phpt @@ -142,7 +142,7 @@ string(3) "hi3" string(3) "hi2" bool(false) Phar::extractTo(): Argument #2 ($files) must be of type array|string|null, stdClass given -Phar::extractTo(): Argument #1 ($pathto) must be a valid path, array given +Phar::extractTo(): Argument #1 ($pathto) must be of type string, array given Invalid argument, extraction path must be non-zero length Unable to use path "%soops" for extraction, it is a file, must be a directory Invalid argument, array of filenames to extract contains non-string value diff --git a/ext/phar/tests/phar_unlinkarchive.phpt b/ext/phar/tests/phar_unlinkarchive.phpt index 5dc55ce487..a900c1db3f 100644 --- a/ext/phar/tests/phar_unlinkarchive.phpt +++ b/ext/phar/tests/phar_unlinkarchive.phpt @@ -92,7 +92,7 @@ __HALT_COMPILER(); Unknown phar archive "" Unknown phar archive "%sphar_unlinkarchive.phar" Unknown phar archive "%sphar_unlinkarchive.phar.tar": internal corruption of phar "%sphar_unlinkarchive.phar.tar" (truncated entry) -Phar::unlinkArchive(): Argument #1 ($archive) must be a valid path, array given +Phar::unlinkArchive(): Argument #1 ($archive) must be of type string, array given bool(false) string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>" phar archive "%sphar_unlinkarchive.phar" has open file handles or objects. fclose() all file handles, and unset() all objects prior to calling unlinkArchive() diff --git a/ext/phar/tests/pharfileinfo_construct.phpt b/ext/phar/tests/pharfileinfo_construct.phpt index 5f22264423..e853162faf 100644 --- a/ext/phar/tests/pharfileinfo_construct.phpt +++ b/ext/phar/tests/pharfileinfo_construct.phpt @@ -49,7 +49,7 @@ echo $e->getMessage() . "\n"; <?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?> --EXPECTF-- Cannot open phar file 'phar://%spharfileinfo_construct.phar/oops': internal corruption of phar "%spharfileinfo_construct.phar" (truncated entry) -PharFileInfo::__construct(): Argument #1 ($filename) must be a valid path, array given +PharFileInfo::__construct(): Argument #1 ($filename) must be of type string, array given Cannot access phar file entry '%s' in archive '%s' Cannot call constructor twice '%s' is not a valid phar archive URL (must have at least phar://filename.phar) diff --git a/ext/spl/tests/bug54291.phpt b/ext/spl/tests/bug54291.phpt index c65c085cdd..964cc866af 100644 --- a/ext/spl/tests/bug54291.phpt +++ b/ext/spl/tests/bug54291.phpt @@ -6,7 +6,7 @@ $dir = new DirectoryIterator("\x00/abc"); $dir->isFile(); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: DirectoryIterator::__construct(): Argument #1 ($path) must be a valid path, string given in %s:%d +Fatal error: Uncaught ValueError: DirectoryIterator::__construct(): Argument #1 ($path) must not contain any null bytes in %s:%d Stack trace: #0 %s(%d): DirectoryIterator->__construct('\x00/abc') #1 {main} diff --git a/ext/spl/tests/bug77431.phpt b/ext/spl/tests/bug77431.phpt index 75d5c2d600..75ae1d14d0 100644 --- a/ext/spl/tests/bug77431.phpt +++ b/ext/spl/tests/bug77431.phpt @@ -5,7 +5,7 @@ Bug #77431 (SplFileInfo::__construct() accepts NUL bytes) new SplFileInfo("bad\0good"); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: SplFileInfo::__construct(): Argument #1 ($file_name) must be a valid path, string given in %s:%d +Fatal error: Uncaught ValueError: SplFileInfo::__construct(): Argument #1 ($file_name) must not contain any null bytes in %s:%d Stack trace: #0 %s(%d): SplFileInfo->__construct('bad\x00good') #1 {main} diff --git a/ext/spl/tests/bug78863.phpt b/ext/spl/tests/bug78863.phpt index ad18f49689..524711fc64 100644 --- a/ext/spl/tests/bug78863.phpt +++ b/ext/spl/tests/bug78863.phpt @@ -16,7 +16,7 @@ foreach ($it as $fileinfo) { } ?> --EXPECTF-- -Fatal error: Uncaught TypeError: DirectoryIterator::__construct(): Argument #1 ($path) must be a valid path, string given in %s:%d +Fatal error: Uncaught ValueError: DirectoryIterator::__construct(): Argument #1 ($path) must not contain any null bytes in %s:%d Stack trace: #0 %s(%d): DirectoryIterator->__construct('%s') #1 {main} diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 0be8df28e8..00f5d5f9ff 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -224,7 +224,7 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ RETURN_THROWS(); } if (strlen(cmd) != cmd_len) { - zend_argument_type_error(1, "must not contain any null bytes"); + zend_argument_value_error(1, "must not contain any null bytes"); RETURN_THROWS(); } @@ -480,7 +480,7 @@ PHP_FUNCTION(escapeshellcmd) if (command_len) { if (command_len != strlen(command)) { - zend_argument_type_error(1, "must not contain any null bytes"); + zend_argument_value_error(1, "must not contain any null bytes"); RETURN_THROWS(); } RETVAL_STR(php_escape_shell_cmd(command)); @@ -501,7 +501,7 @@ PHP_FUNCTION(escapeshellarg) ZEND_PARSE_PARAMETERS_END(); if (argument_len != strlen(argument)) { - zend_argument_type_error(1, "must not contain any null bytes"); + zend_argument_value_error(1, "must not contain any null bytes"); RETURN_THROWS(); } @@ -527,7 +527,7 @@ PHP_FUNCTION(shell_exec) RETURN_THROWS(); } if (strlen(command) != command_len) { - zend_argument_type_error(1, "must not contain any null bytes"); + zend_argument_value_error(1, "must not contain any null bytes"); RETURN_THROWS(); } diff --git a/ext/standard/image.c b/ext/standard/image.c index 7b52ad9719..f34f14a7aa 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -1476,7 +1476,7 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) { ZEND_PARSE_PARAMETERS_END(); if (mode == FROM_PATH && CHECK_NULL_PATH(input, input_len)) { - zend_argument_type_error(1, "must not contain any null bytes"); + zend_argument_value_error(1, "must not contain any null bytes"); RETURN_THROWS(); } diff --git a/ext/standard/tests/file/bug39863.phpt b/ext/standard/tests/file/bug39863.phpt index 982367cccb..c69cb6d0a6 100644 --- a/ext/standard/tests/file/bug39863.phpt +++ b/ext/standard/tests/file/bug39863.phpt @@ -9,9 +9,9 @@ $filename = __FILE__ . chr(0). ".ridiculous"; try { var_dump(file_exists($filename)); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } ?> --EXPECT-- -file_exists(): Argument #1 ($filename) must be a valid path, string given +file_exists(): Argument #1 ($filename) must not contain any null bytes diff --git a/ext/standard/tests/file/disk_free_space_variation.phpt b/ext/standard/tests/file/disk_free_space_variation.phpt index b68bd34211..aaeae022af 100644 --- a/ext/standard/tests/file/disk_free_space_variation.phpt +++ b/ext/standard/tests/file/disk_free_space_variation.phpt @@ -43,12 +43,12 @@ foreach($dirs_arr as $dir1) { echo "\n-- Iteration $count --\n"; try { var_dump( disk_free_space( $dir1 ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } try { var_dump( diskfreespace( $dir1 ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $count++; @@ -103,19 +103,19 @@ float(%f) float(%f) -- Iteration 9 -- -disk_free_space(): Argument #1 ($directory) must be a valid path, string given -diskfreespace(): Argument #1 ($directory) must be a valid path, string given +disk_free_space(): Argument #1 ($directory) must not contain any null bytes +diskfreespace(): Argument #1 ($directory) must not contain any null bytes -- Iteration 10 -- -disk_free_space(): Argument #1 ($directory) must be a valid path, string given -diskfreespace(): Argument #1 ($directory) must be a valid path, string given +disk_free_space(): Argument #1 ($directory) must not contain any null bytes +diskfreespace(): Argument #1 ($directory) must not contain any null bytes -- Iteration 11 -- -disk_free_space(): Argument #1 ($directory) must be a valid path, string given -diskfreespace(): Argument #1 ($directory) must be a valid path, string given +disk_free_space(): Argument #1 ($directory) must not contain any null bytes +diskfreespace(): Argument #1 ($directory) must not contain any null bytes -- Iteration 12 -- -disk_free_space(): Argument #1 ($directory) must be a valid path, string given -diskfreespace(): Argument #1 ($directory) must be a valid path, string given +disk_free_space(): Argument #1 ($directory) must not contain any null bytes +diskfreespace(): Argument #1 ($directory) must not contain any null bytes --- Done --- diff --git a/ext/standard/tests/file/disk_total_space_variation.phpt b/ext/standard/tests/file/disk_total_space_variation.phpt index a7578c486e..25d7e5a1c7 100644 --- a/ext/standard/tests/file/disk_total_space_variation.phpt +++ b/ext/standard/tests/file/disk_total_space_variation.phpt @@ -46,7 +46,7 @@ foreach($dirs_arr as $dir1) { echo "\n-- Iteration $count --\n"; try { var_dump( disk_total_space( $dir1 ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $count++; @@ -95,16 +95,16 @@ float(%f) float(%f) -- Iteration 9 -- -disk_total_space(): Argument #1 ($directory) must be a valid path, string given +disk_total_space(): Argument #1 ($directory) must not contain any null bytes -- Iteration 10 -- -disk_total_space(): Argument #1 ($directory) must be a valid path, string given +disk_total_space(): Argument #1 ($directory) must not contain any null bytes -- Iteration 11 -- -disk_total_space(): Argument #1 ($directory) must be a valid path, string given +disk_total_space(): Argument #1 ($directory) must not contain any null bytes -- Iteration 12 -- -disk_total_space(): Argument #1 ($directory) must be a valid path, string given +disk_total_space(): Argument #1 ($directory) must not contain any null bytes *** Testing with Binary Input *** float(%s) diff --git a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt index aa57689ad7..2c7033be6d 100644 --- a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt @@ -70,10 +70,10 @@ Warning: file_get_contents( ): Failed to open stream: Permission denied in %s on bool(false) -- Filename: \0 -- -TypeError: file_get_contents(): Argument #1 ($filename) must be a valid path, string given +ValueError: file_get_contents(): Argument #1 ($filename) must not contain any null bytes -- Filename: array() -- -TypeError: file_get_contents(): Argument #1 ($filename) must be a valid path, array given +TypeError: file_get_contents(): Argument #1 ($filename) must be of type string, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/file_get_contents_variation8.phpt b/ext/standard/tests/file/file_get_contents_variation8.phpt index 5c466f1b20..126f7b9fd7 100644 --- a/ext/standard/tests/file/file_get_contents_variation8.phpt +++ b/ext/standard/tests/file/file_get_contents_variation8.phpt @@ -63,9 +63,9 @@ ValueError: Path cannot be empty Warning: file_get_contents( ): Failed to open stream: No such file or directory in %s on line %d bool(false) -- Iteration 6 -- -TypeError: file_get_contents(): Argument #1 ($filename) must be a valid path, string given +ValueError: file_get_contents(): Argument #1 ($filename) must not contain any null bytes -- Iteration 7 -- -TypeError: file_get_contents(): Argument #1 ($filename) must be a valid path, array given +TypeError: file_get_contents(): Argument #1 ($filename) must be of type string, array given -- Iteration 8 -- Warning: file_get_contents(/no/such/file/dir): Failed to open stream: No such file or directory in %s on line %d diff --git a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt index 1ba4d9e98f..e3cd4609d4 100644 --- a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt @@ -70,10 +70,10 @@ Warning: file_put_contents( ): Failed to open stream: Permission denied in %s on Failed to write data to: " " -- Filename: \0 -- -TypeError: file_put_contents(): Argument #1 ($filename) must be a valid path, string given +ValueError: file_put_contents(): Argument #1 ($filename) must not contain any null bytes -- Filename: array() -- -TypeError: file_put_contents(): Argument #1 ($filename) must be a valid path, array given +TypeError: file_put_contents(): Argument #1 ($filename) must be of type string, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/file_put_contents_variation8.phpt b/ext/standard/tests/file/file_put_contents_variation8.phpt index 70e8ef48e5..f5b956faee 100644 --- a/ext/standard/tests/file/file_put_contents_variation8.phpt +++ b/ext/standard/tests/file/file_put_contents_variation8.phpt @@ -68,9 +68,9 @@ ValueError: Path cannot be empty -- Iteration 5 -- 9 bytes written to: ' ' -- Iteration 6 -- -TypeError: file_put_contents(): Argument #1 ($filename) must be a valid path, string given +ValueError: file_put_contents(): Argument #1 ($filename) must not contain any null bytes -- Iteration 7 -- -TypeError: file_put_contents(): Argument #1 ($filename) must be a valid path, array given +TypeError: file_put_contents(): Argument #1 ($filename) must be of type string, array given -- Iteration 8 -- Warning: file_put_contents(%sdir): Failed to open stream: %s in %s on line %d diff --git a/ext/standard/tests/file/filegroup_variation3.phpt b/ext/standard/tests/file/filegroup_variation3.phpt index 47f519275e..d18da05855 100644 --- a/ext/standard/tests/file/filegroup_variation3.phpt +++ b/ext/standard/tests/file/filegroup_variation3.phpt @@ -38,7 +38,7 @@ foreach($files_arr as $file) { echo "- Iteration $count -\n"; try { var_dump( filegroup( $file_path."/".$file ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } clearstatcache(); @@ -75,8 +75,8 @@ bool(false) Warning: filegroup(): stat failed for %s/filegroup_variation3/filegroup*.tmp in %s on line %d bool(false) - Iteration 7 - -filegroup(): Argument #1 ($filename) must be a valid path, string given +filegroup(): Argument #1 ($filename) must not contain any null bytes - Iteration 8 - -filegroup(): Argument #1 ($filename) must be a valid path, string given +filegroup(): Argument #1 ($filename) must not contain any null bytes *** Done *** diff --git a/ext/standard/tests/file/fileinode_variation3.phpt b/ext/standard/tests/file/fileinode_variation3.phpt index cf85f6160b..1158308687 100644 --- a/ext/standard/tests/file/fileinode_variation3.phpt +++ b/ext/standard/tests/file/fileinode_variation3.phpt @@ -37,7 +37,7 @@ foreach($files_arr as $file) { echo "- Iteration $count -\n"; try { var_dump( fileinode( $file_path."/".$file ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } clearstatcache(); @@ -74,8 +74,8 @@ bool(false) Warning: fileinode(): stat failed for %s/fileinode_variation3/fileinode*.tmp in %s on line %d bool(false) - Iteration 7 - -fileinode(): Argument #1 ($filename) must be a valid path, string given +fileinode(): Argument #1 ($filename) must not contain any null bytes - Iteration 8 - -fileinode(): Argument #1 ($filename) must be a valid path, string given +fileinode(): Argument #1 ($filename) must not contain any null bytes *** Done *** diff --git a/ext/standard/tests/file/fileowner_variation3.phpt b/ext/standard/tests/file/fileowner_variation3.phpt index df392f8f36..a61b0ab0a3 100644 --- a/ext/standard/tests/file/fileowner_variation3.phpt +++ b/ext/standard/tests/file/fileowner_variation3.phpt @@ -38,7 +38,7 @@ foreach($files_arr as $file) { echo "- Iteration $count -\n"; try { var_dump( fileowner( $file_path."/".$file ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } clearstatcache(); @@ -75,8 +75,8 @@ bool(false) Warning: fileowner(): stat failed for %s/fileowner_variation3/fileowner*.tmp in %s on line %d bool(false) - Iteration 7 - -fileowner(): Argument #1 ($filename) must be a valid path, string given +fileowner(): Argument #1 ($filename) must not contain any null bytes - Iteration 8 - -fileowner(): Argument #1 ($filename) must be a valid path, string given +fileowner(): Argument #1 ($filename) must not contain any null bytes *** Done *** diff --git a/ext/standard/tests/file/fileperms_variation3.phpt b/ext/standard/tests/file/fileperms_variation3.phpt index 9a4f40b269..ada750bbab 100644 --- a/ext/standard/tests/file/fileperms_variation3.phpt +++ b/ext/standard/tests/file/fileperms_variation3.phpt @@ -37,7 +37,7 @@ foreach($files_arr as $file) { echo "- Iteration $count -\n"; try { var_dump( fileperms( $file_path."/".$file ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } clearstatcache(); @@ -74,8 +74,8 @@ bool(false) Warning: fileperms(): stat failed for %s/fileperms_variation3/fileperms*.tmp in %s on line %d bool(false) - Iteration 7 - -fileperms(): Argument #1 ($filename) must be a valid path, string given +fileperms(): Argument #1 ($filename) must not contain any null bytes - Iteration 8 - -fileperms(): Argument #1 ($filename) must be a valid path, string given +fileperms(): Argument #1 ($filename) must not contain any null bytes *** Done *** diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt index 4ca81ed94f..2d6a08e72f 100644 --- a/ext/standard/tests/file/fnmatch_variation.phpt +++ b/ext/standard/tests/file/fnmatch_variation.phpt @@ -64,7 +64,7 @@ for( $i = 0; $i<count($pattern_arr); $i++ ) { echo "-- Iteration $i --\n"; try { var_dump( fnmatch($pattern_arr[$i], $file_name) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } } @@ -80,7 +80,7 @@ function match_( $pattern, $string ) { for( $j = 0; $j<count($string); $j++ ) { try { var_dump( fnmatch($pattern[$i], $string[$j]) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } } @@ -187,9 +187,9 @@ bool(false) -- Iteration 22 -- bool(false) -- Iteration 23 -- -fnmatch(): Argument #1 ($pattern) must be a valid path, string given +fnmatch(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 24 -- -fnmatch(): Argument #1 ($pattern) must be a valid path, string given +fnmatch(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 25 -- bool(false) -- Iteration 26 -- @@ -263,44 +263,44 @@ bool(true) --- With Strings --- -- Iteration 0 -- bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(true) -- Iteration 1 -- -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 2 -- bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(true) -- Iteration 3 -- -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 4 -- bool(false) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(true) bool(false) -- Iteration 5 -- bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(true) @@ -401,42 +401,42 @@ bool(true) bool(true) bool(true) bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(false) -- Iteration 1 -- bool(true) bool(true) bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(false) -- Iteration 2 -- bool(true) bool(true) bool(true) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(false) -- Iteration 3 -- -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given -fnmatch(): Argument #1 ($pattern) must be a valid path, string given +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes +fnmatch(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 4 -- bool(false) bool(false) bool(false) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(true) bool(false) -- Iteration 5 -- bool(false) bool(false) bool(false) -fnmatch(): Argument #2 ($filename) must be a valid path, string given +fnmatch(): Argument #2 ($filename) must not contain any null bytes bool(false) bool(true) diff --git a/ext/standard/tests/file/glob_variation-win32-mb.phpt b/ext/standard/tests/file/glob_variation-win32-mb.phpt index 77e176d6b9..f34563db4b 100644 --- a/ext/standard/tests/file/glob_variation-win32-mb.phpt +++ b/ext/standard/tests/file/glob_variation-win32-mb.phpt @@ -49,7 +49,7 @@ foreach($patterns as $pattern) { var_dump( glob($pattern, GLOB_NOCHECK) ); var_dump( glob($pattern, GLOB_NOESCAPE) ); var_dump( glob($pattern, GLOB_ERR) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -75,7 +75,7 @@ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; try { var_dump( glob($pattern, GLOB_ONLYDIR) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -330,7 +330,7 @@ array(0) { } -- Iteration 8 -- -glob(): Argument #1 ($pattern) must be a valid path, string given +glob(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 9 -- array(0) { @@ -433,7 +433,7 @@ array(1) { array(0) { } -- Iteration 8 -- -glob(): Argument #1 ($pattern) must be a valid path, string given +glob(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/glob_variation-win32.phpt b/ext/standard/tests/file/glob_variation-win32.phpt index ad93ad7dac..74a1c3e5c7 100644 --- a/ext/standard/tests/file/glob_variation-win32.phpt +++ b/ext/standard/tests/file/glob_variation-win32.phpt @@ -48,7 +48,7 @@ foreach($patterns as $pattern) { var_dump( glob($pattern, GLOB_NOCHECK) ); var_dump( glob($pattern, GLOB_NOESCAPE) ); var_dump( glob($pattern, GLOB_ERR) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -74,7 +74,7 @@ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; try { var_dump( glob($pattern, GLOB_ONLYDIR) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -329,7 +329,7 @@ array(0) { } -- Iteration 8 -- -glob(): Argument #1 ($pattern) must be a valid path, string given +glob(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 9 -- array(0) { @@ -432,7 +432,7 @@ array(1) { array(0) { } -- Iteration 8 -- -glob(): Argument #1 ($pattern) must be a valid path, string given +glob(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/glob_variation.phpt b/ext/standard/tests/file/glob_variation.phpt index 0950c31aab..4fc1c240b4 100644 --- a/ext/standard/tests/file/glob_variation.phpt +++ b/ext/standard/tests/file/glob_variation.phpt @@ -51,7 +51,7 @@ foreach($patterns as $pattern) { var_dump( glob($pattern, GLOB_NOCHECK) ); var_dump( glob($pattern, GLOB_NOESCAPE) ); var_dump( glob($pattern, GLOB_ERR) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -77,7 +77,7 @@ foreach($patterns as $pattern) { echo "-- Iteration $counter --\n"; try { var_dump( glob($pattern, GLOB_ONLYDIR) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -332,7 +332,7 @@ array(0) { } -- Iteration 8 -- -glob(): Argument #1 ($pattern) must be a valid path, string given +glob(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 9 -- array(0) { @@ -435,7 +435,7 @@ array(1) { array(0) { } -- Iteration 8 -- -glob(): Argument #1 ($pattern) must be a valid path, string given +glob(): Argument #1 ($pattern) must not contain any null bytes -- Iteration 9 -- array(0) { } diff --git a/ext/standard/tests/file/is_dir_variation4.phpt b/ext/standard/tests/file/is_dir_variation4.phpt index 1c219d51c2..8a1563992f 100644 --- a/ext/standard/tests/file/is_dir_variation4.phpt +++ b/ext/standard/tests/file/is_dir_variation4.phpt @@ -35,7 +35,7 @@ foreach($dirs_arr as $dir) { echo "\n-- Iteration $count --\n"; try { var_dump( is_dir($file_path."/".$dir ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $count++; @@ -76,9 +76,9 @@ bool(true) bool(false) -- Iteration 9 -- -is_dir(): Argument #1 ($filename) must be a valid path, string given +is_dir(): Argument #1 ($filename) must not contain any null bytes -- Iteration 10 -- -is_dir(): Argument #1 ($filename) must be a valid path, string given +is_dir(): Argument #1 ($filename) must not contain any null bytes *** Done *** diff --git a/ext/standard/tests/file/is_executable_variation1.phpt b/ext/standard/tests/file/is_executable_variation1.phpt index f88133e591..de08c1d917 100644 --- a/ext/standard/tests/file/is_executable_variation1.phpt +++ b/ext/standard/tests/file/is_executable_variation1.phpt @@ -49,7 +49,7 @@ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; try { var_dump( is_executable($file) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -76,9 +76,9 @@ bool(false) -- Iteration 5 -- bool(false) -- Iteration 6 -- -is_executable(): Argument #1 ($filename) must be a valid path, string given +is_executable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 7 -- -is_executable(): Argument #1 ($filename) must be a valid path, string given +is_executable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 8 -- bool(false) -- Iteration 9 -- diff --git a/ext/standard/tests/file/is_file_variation4.phpt b/ext/standard/tests/file/is_file_variation4.phpt index 85bc4252c1..f6921d1d87 100644 --- a/ext/standard/tests/file/is_file_variation4.phpt +++ b/ext/standard/tests/file/is_file_variation4.phpt @@ -35,7 +35,7 @@ foreach($files_arr as $file) { echo "- Iteration $count -\n"; try { var_dump( is_file( $file_path."/".$file ) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } clearstatcache(); @@ -66,8 +66,8 @@ bool(false) - Iteration 6 - bool(false) - Iteration 7 - -is_file(): Argument #1 ($filename) must be a valid path, string given +is_file(): Argument #1 ($filename) must not contain any null bytes - Iteration 8 - -is_file(): Argument #1 ($filename) must be a valid path, string given +is_file(): Argument #1 ($filename) must not contain any null bytes *** Done *** diff --git a/ext/standard/tests/file/is_readable_variation1.phpt b/ext/standard/tests/file/is_readable_variation1.phpt index e4347b04a8..d46e5fa5ca 100644 --- a/ext/standard/tests/file/is_readable_variation1.phpt +++ b/ext/standard/tests/file/is_readable_variation1.phpt @@ -48,7 +48,7 @@ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; try { var_dump( is_readable($file) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -77,11 +77,11 @@ bool(false) -- Iteration 6 -- bool(false) -- Iteration 7 -- -is_readable(): Argument #1 ($filename) must be a valid path, string given +is_readable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 8 -- -is_readable(): Argument #1 ($filename) must be a valid path, string given +is_readable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 9 -- -is_readable(): Argument #1 ($filename) must be a valid path, string given +is_readable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 10 -- bool(true) -- Iteration 11 -- diff --git a/ext/standard/tests/file/is_writable_variation1.phpt b/ext/standard/tests/file/is_writable_variation1.phpt index f781f871ff..9361ec947c 100644 --- a/ext/standard/tests/file/is_writable_variation1.phpt +++ b/ext/standard/tests/file/is_writable_variation1.phpt @@ -47,12 +47,12 @@ foreach($files_arr as $file) { echo "-- Iteration $counter --\n"; try { var_dump( is_writable($file) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } try { var_dump( is_writeable($file) ); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; } $counter++; @@ -87,14 +87,14 @@ bool(false) bool(false) bool(false) -- Iteration 7 -- -is_writable(): Argument #1 ($filename) must be a valid path, string given -is_writeable(): Argument #1 ($filename) must be a valid path, string given +is_writable(): Argument #1 ($filename) must not contain any null bytes +is_writeable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 8 -- -is_writable(): Argument #1 ($filename) must be a valid path, string given -is_writeable(): Argument #1 ($filename) must be a valid path, string given +is_writable(): Argument #1 ($filename) must not contain any null bytes +is_writeable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 9 -- -is_writable(): Argument #1 ($filename) must be a valid path, string given -is_writeable(): Argument #1 ($filename) must be a valid path, string given +is_writable(): Argument #1 ($filename) must not contain any null bytes +is_writeable(): Argument #1 ($filename) must not contain any null bytes -- Iteration 10 -- bool(true) bool(true) diff --git a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt index 667a00187e..a9e386b0b0 100644 --- a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt +++ b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt @@ -25,12 +25,12 @@ var_dump( rmdir("$file_path/mkdir_variation2/") ); echo "\n*** Testing mkdir() and rmdir() for binary safe functionality ***\n"; try { var_dump( mkdir("$file_path/temp".chr(0)."/") ); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } try { var_dump( rmdir("$file_path/temp".chr(0)."/") ); -} catch (TypeError $e) { +} catch (ValueError $e) { echo $e->getMessage(), "\n"; } @@ -60,8 +60,8 @@ Warning: rmdir(%s/mkdir_variation2/): %s on line %d bool(false) *** Testing mkdir() and rmdir() for binary safe functionality *** -mkdir(): Argument #1 ($pathname) must be a valid path, string given -rmdir(): Argument #1 ($dirname) must be a valid path, string given +mkdir(): Argument #1 ($pathname) must not contain any null bytes +rmdir(): Argument #1 ($dirname) must not contain any null bytes *** Testing mkdir() with miscellaneous input *** bool(true) diff --git a/ext/standard/tests/file/readfile_variation10-win32.phpt b/ext/standard/tests/file/readfile_variation10-win32.phpt index 05753f93a2..add9afd58d 100644 --- a/ext/standard/tests/file/readfile_variation10-win32.phpt +++ b/ext/standard/tests/file/readfile_variation10-win32.phpt @@ -65,10 +65,10 @@ ValueError: Path cannot be empty Warning: readfile( ): Failed to open stream: Permission denied in %s on line %d -- Filename: \0 -- -TypeError: readfile(): Argument #1 ($filename) must be a valid path, string given +ValueError: readfile(): Argument #1 ($filename) must not contain any null bytes -- Filename: array() -- -TypeError: readfile(): Argument #1 ($filename) must be a valid path, array given +TypeError: readfile(): Argument #1 ($filename) must be of type string, array given -- Filename: /no/such/file/dir -- diff --git a/ext/standard/tests/file/readfile_variation10.phpt b/ext/standard/tests/file/readfile_variation10.phpt Binary files differindex 06e010fed0..99cb0b2d6b 100644 --- a/ext/standard/tests/file/readfile_variation10.phpt +++ b/ext/standard/tests/file/readfile_variation10.phpt diff --git a/ext/standard/tests/file/stream_rfc2397_006.phpt b/ext/standard/tests/file/stream_rfc2397_006.phpt index 7805db41de..649c94d6da 100644 --- a/ext/standard/tests/file/stream_rfc2397_006.phpt +++ b/ext/standard/tests/file/stream_rfc2397_006.phpt @@ -16,15 +16,15 @@ foreach($streams as $stream) { try { var_dump(file_get_contents($stream)); - } catch (TypeError $e) { + } catch (ValueError $e) { echo $e->getMessage(), "\n"; } } ?> --EXPECTF-- -file_get_contents(): Argument #1 ($filename) must be a valid path, string given -file_get_contents(): Argument #1 ($filename) must be a valid path, string given +file_get_contents(): Argument #1 ($filename) must not contain any null bytes +file_get_contents(): Argument #1 ($filename) must not contain any null bytes Warning: file_get_contents(data:;base64,#Zm9vYmFyIGZvb2Jhcg==): Failed to open stream: rfc2397: unable to decode in %sstream_rfc2397_006.php on line %d bool(false) diff --git a/ext/standard/tests/file/tempnam_variation3-win32.phpt b/ext/standard/tests/file/tempnam_variation3-win32.phpt index e5bf76484b..f47bb610c6 100644 --- a/ext/standard/tests/file/tempnam_variation3-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt @@ -59,7 +59,7 @@ for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; try { $file_name = tempnam($file_path, $names_arr[$i]); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; continue; } @@ -106,9 +106,9 @@ Notice: tempnam(): file created in the system's temporary directory in %stempnam Failed, not created in the correct directory %s vs %s 0 -- Iteration 6 -- -tempnam(): Argument #2 ($prefix) must be a valid path, string given +tempnam(): Argument #2 ($prefix) must not contain any null bytes -- Iteration 7 -- -tempnam(): Argument #2 ($prefix) must be a valid path, array given +tempnam(): Argument #2 ($prefix) must be of type string, array given -- Iteration 8 -- OK -- Iteration 9 -- diff --git a/ext/standard/tests/file/tempnam_variation3.phpt b/ext/standard/tests/file/tempnam_variation3.phpt index b3e237afec..baf0a5a868 100644 --- a/ext/standard/tests/file/tempnam_variation3.phpt +++ b/ext/standard/tests/file/tempnam_variation3.phpt @@ -37,7 +37,7 @@ for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; try { $file_name = tempnam("$file_path", $names_arr[$i]); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; continue; } @@ -102,9 +102,9 @@ File name is => %s/%s File permissions are => 100600 File created in => directory specified -- Iteration 6 -- -tempnam(): Argument #2 ($prefix) must be a valid path, string given +tempnam(): Argument #2 ($prefix) must not contain any null bytes -- Iteration 7 -- -tempnam(): Argument #2 ($prefix) must be a valid path, array given +tempnam(): Argument #2 ($prefix) must be of type string, array given -- Iteration 8 -- File name is => %s/dir%s File permissions are => 100600 diff --git a/ext/standard/tests/file/tempnam_variation7-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt index 5beaa6d095..38644b3c6c 100644 --- a/ext/standard/tests/file/tempnam_variation7-win32.phpt +++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt @@ -34,7 +34,7 @@ for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; try { $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; continue; } @@ -96,9 +96,9 @@ File name is => %s%et%s File permissions are => 100666 File created in => temp dir -- Iteration 6 -- -tempnam(): Argument #1 ($dir) must be a valid path, string given +tempnam(): Argument #1 ($dir) must not contain any null bytes -- Iteration 7 -- -tempnam(): Argument #1 ($dir) must be a valid path, array given +tempnam(): Argument #1 ($dir) must be of type string, array given -- Iteration 8 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt index e8d2811e0a..dbe80d5ebb 100644 --- a/ext/standard/tests/file/tempnam_variation7.phpt +++ b/ext/standard/tests/file/tempnam_variation7.phpt @@ -35,7 +35,7 @@ for( $i=0; $i<count($names_arr); $i++ ) { echo "-- Iteration $i --\n"; try { $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp"); - } catch (TypeError $e) { + } catch (Error $e) { echo $e->getMessage(), "\n"; continue; } @@ -101,9 +101,9 @@ File name is => %s%etempnam_variation3.tmp%s File permissions are => 100600 File created in => temp dir -- Iteration 6 -- -tempnam(): Argument #1 ($dir) must be a valid path, string given +tempnam(): Argument #1 ($dir) must not contain any null bytes -- Iteration 7 -- -tempnam(): Argument #1 ($dir) must be a valid path, array given +tempnam(): Argument #1 ($dir) must be of type string, array given -- Iteration 8 -- Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d diff --git a/ext/standard/tests/file/windows_links/bug78862.phpt b/ext/standard/tests/file/windows_links/bug78862.phpt index ce4da1fc8c..c696773be4 100644 --- a/ext/standard/tests/file/windows_links/bug78862.phpt +++ b/ext/standard/tests/file/windows_links/bug78862.phpt @@ -7,7 +7,7 @@ var_dump(link(__DIR__ . "/bug78862.target\0more", __DIR__ . "/bug78862.link\0mor var_dump(file_exists(__DIR__ . '/bug78862.link')); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: link(): Argument #1 ($target) must be a valid path, string given in %s:%d +Fatal error: Uncaught ValueError: link(): Argument #1 ($target) must not contain any null bytes in %s:%d Stack trace: #0 %s(%d): link('%s', '%s') #1 {main} diff --git a/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt b/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt index ac85410593..335bd0c792 100644 --- a/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt +++ b/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt @@ -7,7 +7,7 @@ escapeshellarg("hello\0world"); ?> ===DONE=== --EXPECTF-- -Fatal error: Uncaught TypeError: escapeshellarg(): Argument #1 ($arg) must not contain any null bytes in %s:%d +Fatal error: Uncaught ValueError: escapeshellarg(): Argument #1 ($arg) must not contain any null bytes in %s:%d Stack trace: #0 %s(%d): escapeshellarg('hello\x00world') #1 {main} diff --git a/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt b/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt index acb337f556..dcc4f7b96f 100644 --- a/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt +++ b/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt @@ -7,7 +7,7 @@ escapeshellcmd("hello\0world"); ?> ===DONE=== --EXPECTF-- -Fatal error: Uncaught TypeError: escapeshellcmd(): Argument #1 ($command) must not contain any null bytes in %s:%d +Fatal error: Uncaught ValueError: escapeshellcmd(): Argument #1 ($command) must not contain any null bytes in %s:%d Stack trace: #0 %s(%d): escapeshellcmd('hello\x00world') #1 {main} diff --git a/ext/standard/tests/image/bug79877.phpt b/ext/standard/tests/image/bug79877.phpt index d7d771b2f2..fa68fc963a 100644 --- a/ext/standard/tests/image/bug79877.phpt +++ b/ext/standard/tests/image/bug79877.phpt @@ -5,6 +5,8 @@ Bug #79877 (getimagesize function silently truncates after a null byte) var_dump(getimagesize("/tmp/a.png\0xx")); ?> --EXPECTF-- -Fatal error: Uncaught TypeError: getimagesize(): Argument #1 ($image_path) must not contain any null bytes in %s:%d +Fatal error: Uncaught ValueError: getimagesize(): Argument #1 ($image_path) must not contain any null bytes in %s:%d Stack trace: -%a +#0 %s(%d): getimagesize('/tmp/a.png\x00xx') +#1 {main} + thrown in %s on line %d diff --git a/ext/standard/tests/misc/exec_basic1.phpt b/ext/standard/tests/misc/exec_basic1.phpt index 61e057b728..e08d6a9389 100644 --- a/ext/standard/tests/misc/exec_basic1.phpt +++ b/ext/standard/tests/misc/exec_basic1.phpt @@ -10,17 +10,17 @@ exec, system, passthru — Basic command execution functions $cmd = "echo abc\n\0command"; try { var_dump(exec($cmd, $output)); -} catch (\TypeError $e) { +} catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } try { var_dump(system($cmd, $output)); -} catch (\TypeError $e) { +} catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } try { var_dump(passthru($cmd, $output)); -} catch (\TypeError $e) { +} catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } ?> |