diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-08 12:12:26 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-08 15:23:23 +0200 |
commit | 7e339a335e87d9c8d0b6994039220890284df63e (patch) | |
tree | 4f4445f74094e6c614e1f536024be68f20518d37 /ext/standard/tests/file/tempnam_variation7-win32.phpt | |
parent | 2386f655d8181456c66241fd8ceb008bd995a31c (diff) | |
download | php-git-7e339a335e87d9c8d0b6994039220890284df63e.tar.gz |
Make null byte error a ValueError
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.
Diffstat (limited to 'ext/standard/tests/file/tempnam_variation7-win32.phpt')
-rw-r--r-- | ext/standard/tests/file/tempnam_variation7-win32.phpt | 6 |
1 files changed, 3 insertions, 3 deletions
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 |