No More dir() With Null¶
When calling dir() with null as parameter, it defaulted to open again the last opened directory. Since PHP 8.1, this is not possible anymore.
PHP code¶
<?php
$a = dir('/tmp');
$b = dir(null);
var_dump($b);
?>
Before¶
bool(false)
After¶
PHP Deprecated: dir(): Passing null to parameter #1 ($directory) of type string is deprecated
Deprecated: dir(): Passing null to parameter #1 ($directory) of type string is deprecated
bool(false)
PHP version change¶
This behavior changed in 8.1