Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix GH-17280: ldap_search() fails when $attributes array has holes #17284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
nielsdos merged 3 commits into php:master from nielsdos:fix-GH-17280
Dec 27, 2024

Conversation

Copy link
Member

@nielsdos nielsdos commented Dec 27, 2024

We relax the constraint that the array must be a list. What really matters is that it only has numeric keys. As shown in the example code, it's really easy to accidentally create a non-list array, so it makes sense to relax the constraint.
There are 3 cases left where the array is checked to be a list, in php_ldap_do_search, but I believe this makes sense to keep because the indices of those arrays have a meaning because they should match between different arrays. In that case it will prevent programmer errors.

We relax the constraint that the array must be a list. What really
matters is that it only has numeric keys. As shown in the example code,
it's really easy to accidentally create a non-list array, so it makes
sense to relax the constraint.
There are 3 cases left where the array is checked to be a list,
in php_ldap_do_search, but I believe this makes sense to keep because
the indices of those arrays have a meaning because they should match
between different arrays. In that case it will prevent programmer
errors.
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be backported to 8.4 (or 8.2 as this is what the bug report claims is also affected?)

Copy link
Member Author

Backported to 8.3 probably. Note that 8.2 is already closed for a while for bugfixes.
But it was easier to work on the changes for master first rather than working on 8.3 and then going upwards.

Girgias reacted with thumbs up emoji

@nielsdos nielsdos merged commit f90323c into php:master Dec 27, 2024
10 checks passed
nielsdos added a commit to nielsdos/php-src that referenced this pull request Dec 27, 2024
nielsdos added a commit to nielsdos/php-src that referenced this pull request Dec 27, 2024
Copy link

dregad commented Dec 27, 2024

Many thanks for fixing it so quickly 🚀

I can live without a back port to 8.2, the workaround is simple enough. And I need to be compatible with 7.4 anyway...

nielsdos reacted with thumbs up emoji

nielsdos added a commit that referenced this pull request Dec 29, 2024
charmitro pushed a commit to wasix-org/php that referenced this pull request Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@Girgias Girgias Girgias approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

ldap_search() fails when $attributes array has holes

AltStyle によって変換されたページ (->オリジナル) /