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/bug39863.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/bug39863.phpt')
-rw-r--r-- | ext/standard/tests/file/bug39863.phpt | 4 |
1 files changed, 2 insertions, 2 deletions
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 |