Problem/Motivation

The readdir(), rewinddir(), and closedir() functions accept null as the value for the $dir_handle, in which case it will used the previously opened directory stream opened with opendir().

Steps to reproduce

- https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_null_to_...
- https://github.com/php/php-src/commit/dc0962c2439d6140c918f132e2a24129c0...

git grep 'readdir()'

Proposed resolution

use variable to pass directory handle

Remaining tasks

- MR
- wait for beta
- review/commit

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3540646

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

andypost created an issue. See original summary.

andypost’s picture

Issue summary: View changes
Status: Active » Needs review

Looks the only place to fix

penyaskito’s picture

Status: Needs review » Reviewed & tested by the community

This argument is nullable (and exists) since 8.0.0. So based on https://www.drupal.org/docs/getting-started/system-requirements/php-requ..., I think this is good to merge. Existing test coverage should be enough, as @andypost proved this fails on php5. I don't think we have a way (yet) of proving this passes tho.

I'm assuming we want this backported to 11.2.x.

I checked that we don't need this specific fix for 10.5.x, but didn't check if there are any other readdir(), rewinddir(), and closedir() usages in that branch. I don't even know if supporting 10.5.x means we should ensure it works with php85

phenaproxima’s picture

+1 RTBC here.

alexpott’s picture

Version: 11.x-dev » 11.2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 6c0071f6725 to 11.x and de03f6e2853 to 11.2.x. Thanks!

  • alexpott committed de03f6e2 on 11.2.x
    Issue #3540646 by andypost, penyaskito: Fix deprecated readdir() without...

  • alexpott committed 6c0071f6 on 11.x
    Issue #3540646 by andypost, penyaskito: Fix deprecated readdir() without...

andypost’s picture

thank you!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.