Repository navigation
Conversation
…ries Since 8.5 the values passed to ldap_add(), ldap_mod_replace() and friends go through php_ldap_try_get_ldap_value_from_zval(), which rejects floats. Code that passes round() results or ints that overflowed to float worked before and now throws a TypeError. LDAP has no float syntax, so only accept floats without a fractional part and format them as integers. Other floats still throw.
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.
Fixes GH-22108
Since 8.5, values passed to
ldap_add(),ldap_mod_replace()and the other functions built onphp_ldap_do_modify()go throughphp_ldap_try_get_ldap_value_from_zval(), which has no case for floats. Code like['shadowLastChange' => round(time() / 86400)]worked on 8.4 and now throws a TypeError.As @Girgias suggested on the issue, this accepts floats only when they have no fractional part and formats them as integers ("20400", not "20400.0"). Values that don't fit in a zend_long are printed in full (
1e20becomes100000000000000000000), which also covers the 32-bit case from the issue.-0.0is sent as "0". Fractional, NAN and INF values still throw the same TypeError.The test needs a running server, so it is skipped without one like the other
ldap_mod_*tests. I ran the ldap suite against a local slapd on PHP-8.5 and master (debug + ASan, also with opcache/tracing JIT): the new test fails before the change and passes after it, and nothing else changes (only the two TLS tests fail, because my slapd has no TLS set up).