Fix GH-17280: ldap_search() fails when $attributes array has holes#17284
Merged
ndossche merged 3 commits intophp:masterfrom Dec 27, 2024
Merged
Fix GH-17280: ldap_search() fails when $attributes array has holes#17284ndossche merged 3 commits intophp:masterfrom
ndossche merged 3 commits intophp:masterfrom
Conversation
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.
Girgias
approved these changes
Dec 27, 2024
Member
Girgias
left a comment
There was a problem hiding this comment.
Should be backported to 8.4 (or 8.2 as this is what the bug report claims is also affected?)
Member
Author
|
Backported to 8.3 probably. Note that 8.2 is already closed for a while for bugfixes. |
ndossche
added a commit
to ndossche/php-src
that referenced
this pull request
Dec 27, 2024
…has holes Backport of phpGH-17284 to fix phpGH-17280 on lower branches.
ndossche
added a commit
to ndossche/php-src
that referenced
this pull request
Dec 27, 2024
…has holes Backport of phpGH-17284 to fix phpGH-17280 on lower branches.
|
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... |
ndossche
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
…has holes Backport of phpGH-17284 to fix phpGH-17280 on lower branches. Closes phpGH-17287.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.