]> granicus.if.org Git - php/commitdiff
Make null byte error a ValueError
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 8 Sep 2020 10:12:26 +0000 (12:12 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 8 Sep 2020 13:23:23 +0000 (15:23 +0200)
Currently we treat paths with null bytes as a TypeError, which is
incorrect, and rather inconsistent, as we treat empty paths as
ValueError. We do this because the error is generated by zpp and
it's easier to always throw TypeError there.

This changes the zpp implementation to throw a TypeError only if
the type is actually wrong and throw ValueError for null bytes.
The error message is also split accordingly, to be more precise.

Closes GH-6094.

59 files changed:
Zend/zend_API.c
Zend/zend_API.h
ext/curl/interface.c
ext/curl/tests/bug68089.phpt
ext/exif/exif.c
ext/exif/tests/filename_empty.phpt
ext/fileinfo/tests/finfo_open_001.phpt
ext/gd/tests/imagegd2_nullbyte_injection.phpt
ext/gd/tests/imagegd_nullbyte_injection.phpt
ext/gd/tests/imagexbm_nullbyte_injection.phpt
ext/hash/hash.c
ext/hash/tests/hash_hmac_file_error.phpt
ext/phar/tests/badparameters.phpt
ext/phar/tests/bug64931/bug64931.phpt
ext/phar/tests/create_path_error.phpt
ext/phar/tests/fgc_edgecases.phpt
ext/phar/tests/fopen_edgecases2.phpt
ext/phar/tests/opendir_edgecases.phpt
ext/phar/tests/phar_extract.phpt
ext/phar/tests/phar_unlinkarchive.phpt
ext/phar/tests/pharfileinfo_construct.phpt
ext/spl/tests/bug54291.phpt
ext/spl/tests/bug77431.phpt
ext/spl/tests/bug78863.phpt
ext/standard/exec.c
ext/standard/image.c
ext/standard/tests/file/bug39863.phpt
ext/standard/tests/file/disk_free_space_variation.phpt
ext/standard/tests/file/disk_total_space_variation.phpt
ext/standard/tests/file/file_get_contents_variation8-win32.phpt
ext/standard/tests/file/file_get_contents_variation8.phpt
ext/standard/tests/file/file_put_contents_variation8-win32.phpt
ext/standard/tests/file/file_put_contents_variation8.phpt
ext/standard/tests/file/filegroup_variation3.phpt
ext/standard/tests/file/fileinode_variation3.phpt
ext/standard/tests/file/fileowner_variation3.phpt
ext/standard/tests/file/fileperms_variation3.phpt
ext/standard/tests/file/fnmatch_variation.phpt
ext/standard/tests/file/glob_variation-win32-mb.phpt
ext/standard/tests/file/glob_variation-win32.phpt
ext/standard/tests/file/glob_variation.phpt
ext/standard/tests/file/is_dir_variation4.phpt
ext/standard/tests/file/is_executable_variation1.phpt
ext/standard/tests/file/is_file_variation4.phpt
ext/standard/tests/file/is_readable_variation1.phpt
ext/standard/tests/file/is_writable_variation1.phpt
ext/standard/tests/file/mkdir_rmdir_variation2.phpt
ext/standard/tests/file/readfile_variation10-win32.phpt
ext/standard/tests/file/readfile_variation10.phpt
ext/standard/tests/file/stream_rfc2397_006.phpt
ext/standard/tests/file/tempnam_variation3-win32.phpt
ext/standard/tests/file/tempnam_variation3.phpt
ext/standard/tests/file/tempnam_variation7-win32.phpt
ext/standard/tests/file/tempnam_variation7.phpt
ext/standard/tests/file/windows_links/bug78862.phpt
ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt
ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt
ext/standard/tests/image/bug79877.phpt
ext/standard/tests/misc/exec_basic1.phpt

index cc31a81a1ca5837edde0dda0d25b0cb130c7f087..a8aedeb9643bb5512adecc664b7b3c4f40eb9b0e 100644 (file)
@@ -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));
index 336060e5765bde2c1a150fb3becae2c28cbb17cd..9bb8957e8e0ce0ac97ee660ebe8cd9ae87626ab8 100644 (file)
@@ -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") \
index 09e02b3ba527c2cf7e9df85f6bfff2e77243302d..150f98d46fe81f6aa5ac338c880421734d14deb1 100644 (file)
@@ -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;
        }
 
index 96405f9134e1732f43ae222ed307f931690e6678..a4a39ec6f5ad1377ee3e6ab584d29545e75a5c75 100644 (file)
@@ -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
index b47dea61096fca7d37ef48c2d21782e3c1f3e2cf..59a3ab74d518f80954b2ed877407f68d0790ba2b 100644 (file)
@@ -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();
                }
 
index 7896c87fbb497b2a15f3fba00ce3647bdb00a3fd..b2f58ae3c5ea47744dd468ddba3cd7bd39378946 100644 (file)
@@ -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
index 70998971424171538f71a8df03e21546d024177a..1b1a1a690018fa89dd3d8b7231cb203d39c22165 100644 (file)
@@ -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)
 
index eda6cfed426fc2220054786a70920cf77bba601c..38065dab0ab01ed1e16e468ff44c53824cc79096 100644 (file)
@@ -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
index d10e7dc31b7bebb2c7e647db30eef9611e1e613f..4a77b15ee0dfba24bd4c33c4d5c30d6f1fcc404e 100644 (file)
@@ -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
index 91f757614e05aaa40489e29be37ba6a3253311b0..8bd90b0d85b2c4c4ff84215ba882080bd164be03 100644 (file)
@@ -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
index 64be043362ea6373f2e64151de28ba68ec65bd51..4e3820f35e6b4692ea8e4ab711a447fb012679c0 100644 (file)
@@ -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));
index 6e45aaef28cf00fbc44323c05e1a72186532f42d..7cbc34769120214082793fb702603627ff833159 100644 (file)
@@ -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
index 47c5d9edfb15337ba661a386be509172c2cca8f8..e06472233cb4081a6bd796e83bbf52f940db6e78 100644 (file)
@@ -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
index 2b4b17051ea2809ce8d700d4696e346db44c7945..6d29b301aafa77ece6d0cb6265b42bd65d7d4e74 100644 (file)
@@ -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
index ce0b8a59a2f3c32caa98b0c63085bf09155be1fd..a3da9c276c13cd785031b1df29bf6dbf30a13140 100644 (file)
@@ -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
index 38ff03cce8b0e1a0ce889d75869c36e32ae209ca..a30ca7df193da9e90654b285fa33da2c1fd6b9a3 100644 (file)
@@ -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__));
index ec3176fbc29e815f4b8305600ed724ef2b293a8e..4be382bf9826ef6dceb3b16443f471ed8431671e 100644 (file)
@@ -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
 
index b9409608059f77b0a482aad344fca021fac5c681..53250740a05e4170949583f17fa2b06cf04f57db 100644 (file)
@@ -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
index 65a96b0aab05ec449811818817d0342875ae9a42..0a8431d044446ec9c939ba872d1cf8862e5f5c13 100644 (file)
@@ -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
index 5dc55ce487265551b3575b8fc1e93f217b5d8fe2..a900c1db3fbb55c2fed29907b0a27f32d1d2e502 100644 (file)
@@ -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()
index 5f222644232571f823e4ee96bb1a27e6dcef8f65..e853162faf64e44d8177193a954d113ffa1c4f11 100644 (file)
@@ -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)
index c65c085cddb057f8de5121863532b708b2a8c037..964cc866afde812933038ba6fd6648bd84e02b78 100644 (file)
@@ -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}
index 75d5c2d600da44c0f6211b3970292e501a70cdfe..75ae1d14d03f3f9f392505e2d2c4cbd8bdfd9bdd 100644 (file)
@@ -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}
index ad18f49689fee0859cfb314527404b5cb09d0b66..524711fc641a44c66bf0ace3d0829676381d2039 100644 (file)
@@ -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}
index 0be8df28e82f806a68f1d5300e1e8c1f4458cef0..00f5d5f9ff18fe7ceec7c04fe7665147dbfecd4d 100644 (file)
@@ -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();
        }
 
index 7b52ad9719177fc25d5cd27557daaf37264cb85a..f34f14a7aa57caacb5666d3728828e902c71ef80 100644 (file)
@@ -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();
        }
 
index 982367cccb459bdf7fe1766ab2add47b04affc68..c69cb6d0a65c24135adaa3826b4d8e0032358510 100644 (file)
@@ -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
index b68bd34211dd2d9ec6545684dbe9f744ac329b85..aaeae022af4be2fe5468db4d838021e07572fddc 100644 (file)
@@ -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 ---
index a7578c486e0d9df011cf7105968b8e220042ee6b..25d7e5a1c7df9746069738a87cb39cf1feec950b 100644 (file)
@@ -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)
 
index aa57689ad7e1ac751e2f5444fb0149e76bd6a0b4..2c7033be6d3a94b87bfc9403b9f232d5cd9ef2ef 100644 (file)
@@ -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 --
 
index 5c466f1b206cd986d11065e8e1fc4b58ed3fa227..126f7b9fd751027ae85a856981b920d5a661d5a0 100644 (file)
@@ -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
index 1ba4d9e98fd874c3206facf0750e0345f9dfa7bf..e3cd4609d42df8cefeff3ac64b407c1e1c012053 100644 (file)
@@ -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 --
 
index 70e8ef48e5b4903c8e476db42ec6aeb0761a5f18..f5b956faee3ff1279f7124e6ac56c0be7c5135a6 100644 (file)
@@ -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
index 47f519275e58807aef978b080279ff2d94399a19..d18da058555ec98d96991a3363e495116b552e82 100644 (file)
@@ -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 ***
index cf85f6160bb48a6b4afdbc108e008388c291551c..1158308687a15495f9207235c6a8aa2122cedd0d 100644 (file)
@@ -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 ***
index df392f8f369f54cfec97f9b4acabc233f73f92e6..a61b0ab0a341743938b3bcadc396030c54afd5b2 100644 (file)
@@ -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 ***
index 9a4f40b269a9bc62661027b3afadc74a443e1378..ada750bbab49792c9a9f2cb919b0c2956e3f0fb7 100644 (file)
@@ -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 ***
index 4ca81ed94fd0ed2d68b6d402ff17b6b565e8f128..2d6a08e72fc89eb181658533510da417219bbc41 100644 (file)
@@ -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)
 
index 77e176d6b9fcb5dcb9e62630359240471231ab3e..f34563db4b68540a08d3e8f0ebfe2bda6fe4f69f 100644 (file)
@@ -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) {
 }
index ad93ad7dac80d74fcc43c7cb4b31b71b5d8f26e5..74a1c3e5c7e420aca7d63fdef07e4547963a89d7 100644 (file)
@@ -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) {
 }
index 0950c31aab5430c6ff6df23dcfb9998f406223a0..4fc1c240b4d40378d148532550aa2000fcad85f4 100644 (file)
@@ -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) {
 }
index 1c219d51c252f9f70618e25dd563a8041503204f..8a1563992f23cba65f8866854f5965708a0d6eec 100644 (file)
@@ -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 ***
index f88133e5917947d8bc88964693da1714280f61aa..de08c1d9170c5f1b42da295b892be4c28de8212d 100644 (file)
@@ -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 --
index 85bc4252c1607fdb255f8409bdac8b365fe334f2..f6921d1d87262a90b4fbc3413db822074ee9a824 100644 (file)
@@ -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 ***
index e4347b04a8fa3b93b100f2b706d63596abd5ef66..d46e5fa5ca8505b5af4ea2199640d87ae1588d35 100644 (file)
@@ -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 --
index f781f871ff45e6f17c2c7f6a491e930beb9b50e2..9361ec947c194f7ec7ed288b98d1751dabb3111c 100644 (file)
@@ -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)
index 667a00187e4582024064009ecd04e0d286562a0a..a9e386b0b030f7445a36484b47f0675f558948fa 100644 (file)
@@ -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)
index 05753f93a2df30bc8677802027d95387c2783974..add9afd58ded2771d0c4371434fe946a44b4d220 100644 (file)
@@ -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 --
 
index 06e010fed07923caf79d5c81706bc722c903d16f..99cb0b2d6b9236dd9ec9ff440ce6a98e1867b026 100644 (file)
Binary files a/ext/standard/tests/file/readfile_variation10.phpt and b/ext/standard/tests/file/readfile_variation10.phpt differ
index 7805db41de2dfc9f1c591b78a271194f97162418..649c94d6da65835b0db9bb4392e483595ab81f63 100644 (file)
@@ -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)
index e5bf76484b0757856d625c4b5acdc1f675a3a5b8..f47bb610c6cd6aded2d5048a7b9ce50f72d57025 100644 (file)
@@ -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 --
index b3e237afecbcc8b4826f4aa7e51b328606f194e3..baf0a5a868555c992a4e69d45b3290e44b2a54cb 100644 (file)
@@ -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
index 5beaa6d095b4eab9d134b3c9b93036b9cd747c35..38644b3c6cc6fd48cb481fa64b02994733c15d82 100644 (file)
@@ -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
index e8d2811e0aaca185fd6e45e7d65633ec639e887c..dbe80d5ebb67c1fc268eaf162b4df7fd28a792c0 100644 (file)
@@ -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
index ce4da1fc8c2ceea2191cb27f84af14b2c09d8b10..c696773be4260128394492d1169138e00208a05f 100644 (file)
@@ -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}
index ac85410593b31ca9f000b2cbb63c5f9709b0994e..335bd0c7929a7cd4186d54651615029cef84eb49 100644 (file)
@@ -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}
index acb337f55629bbfb9d4f41b35443260e66cd3cfc..dcc4f7b96fd82fe89857bda999ad731c00960503 100644 (file)
@@ -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}
index d7d771b2f2922d39e37e6a9e06f99a2d07a16e3d..fa68fc963a75a407acc9678a8227deaba5468470 100644 (file)
@@ -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
index 61e057b728b3c9cccfaf4bd1c9f47f7d7c4e743c..e08d6a938991b25668ed83904fe6cdd5c33ca598 100644 (file)
@@ -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;
 }
 ?>