[php-src] PR #25347: Fix GH-22108: Accept integral float values when modifying LDAP entries
| From: | Truta446 | Date: | Mon, 09 Nov 2026 17:36:54 +0000 |
| Subject: | [php-src] PR #25347: Fix GH-22108: Accept integral float values when modifying LDAP entries | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40471@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25347
Author: Truta446
Fixes GH-22108
Since 8.5, values passed to
ldap_add(), ldap_mod_replace() and the other
functions built on php_ldap_do_modify() go through
php_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 (1e20 becomes 100000000000000000000),
which also covers the 32-bit case from the issue. -0.0 is 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).