.. _passing-null-is-deprecated,-instead-the-last-opened-directory-stream-should-be-provided:
Passing null is deprecated, instead the last opened directory stream should be provided
---------------------------------------------------------------------------------------
.. meta::
:description:
Passing null is deprecated, instead the last opened directory stream should be provided: When calling ``dir()`` twice, it was possible to use ``null`` the second time to open the same directory.
:og:image: https://php-errors.readthedocs.io/en/latest/_static/logo.png
:og:type: article
:og:title: Passing null is deprecated, instead the last opened directory stream should be provided
:og:description: When calling ``dir()`` twice, it was possible to use ``null`` the second time to open the same directory
:og:url: https://php-errors.readthedocs.io/en/latest/messages/passing-null-is-deprecated%2C-instead-the-last-opened-directory-stream-should-be-provided.html
:og:locale: en
:twitter:card: summary_large_image
:twitter:site: @exakat
:twitter:title: Passing null is deprecated, instead the last opened directory stream should be provided
:twitter:description: Passing null is deprecated, instead the last opened directory stream should be provided: When calling ``dir()`` twice, it was possible to use ``null`` the second time to open the same directory
:twitter:creator: @exakat
:twitter:image:src: https://php-errors.readthedocs.io/en/latest/_static/logo.png
.. raw:: html
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
_______
.. code-block:: php
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 ` `_.