php / php/php-src

Regression in 8.5: float values are treated as invalid when updating LDAP values

Open
#22,108 3 comments 0 reactions 1 assignee View on GitHub

@Girgias is already working on this.

Since May 21, 2026.

Bug Extension: ldap Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

The following code:

<?php
ldap_modify($ds, $dn, ['shadowlastchange' => round(time() / (24*3600))]);

Resulted in this output:

LDAP value must be of type string|int|bool, float given (0)

But I expected this output instead:

no output, the operation succeeded before

Problem is caused by php_ldap_try_get_ldap_value_from_zval and used by he following commit: https://github.com/php/php-src/commit/636b6a1a59efe655a17e9a4a2d67865b53babe0c

I can obviously now cast all these kind of timestamp calculations with round(...) to int: (int)round(...), but this is existing code which worked for 10+ years.

So the question is: was that BC breach intended, or does it make sense to handle that cast to int automatically in php_ldap_try_get_ldap_value_from_zval?

Ralf

PHP Version
PHP 8.5.5 (cli) (built: Apr 11 2026 06:53:07) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.5.5, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.5, Copyright (c), by Zend Technologies
Operating System

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.