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.
14 lines
406 B
PHP
14 lines
406 B
PHP
--TEST--
|
|
Bug #54291 (Crash iterating DirectoryIterator for dir name starting with \0)
|
|
--FILE--
|
|
<?php
|
|
$dir = new DirectoryIterator("\x00/abc");
|
|
$dir->isFile();
|
|
?>
|
|
--EXPECTF--
|
|
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}
|
|
thrown in %s on line %d
|