mirror of
https://github.com/php/php-src.git
synced 2026-03-26 01:02:25 +01:00
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.
13 lines
355 B
PHP
13 lines
355 B
PHP
--TEST--
|
|
Bug #77431 (SplFileInfo::__construct() accepts NUL bytes)
|
|
--FILE--
|
|
<?php
|
|
new SplFileInfo("bad\0good");
|
|
?>
|
|
--EXPECTF--
|
|
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}
|
|
thrown in %s on line %d
|