From 7e339a335e87d9c8d0b6994039220890284df63e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 8 Sep 2020 12:12:26 +0200 Subject: 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. --- ext/standard/tests/file/filegroup_variation3.phpt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ext/standard/tests/file/filegroup_variation3.phpt') 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 *** -- cgit v1.2.1