Passing null is deprecated, instead the last opened directory stream should be provided

Description

When calling dir() twice, it was possible to use null the second time to open the same directory. Since PHP 8.1, it is not possible anymore, and the actual name of the directory must be provided.

Example

<?php

dir('/tmp'); // opens /tmp

dir(null); // opens /tmp

?>

Solutions

  • Always use the name of the directory when calling dir().

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See ` <https://php-changed-behaviors.readthedocs.io/en/latest/behavior/.html>`_.