pathinfo() Validates Its Flags Argument¶
pathinfo() accepts a second argument made of PATHINFO_* constants. Until PHP 8.6, any other value was silently accepted, and the whole set of parts was returned. In PHP 8.6, an invalid value throws a ValueError.
PHP code¶
<?php
var_dump(pathinfo('/foo/bar.txt', 999));
?>
Before¶
string(4) /foo
After¶
pathinfo(): Argument #2 ($flags) must be one of the PATHINFO_* constants
PHP version change¶
This behavior changed in 8.6