Repository navigation
N°10246 - Fix LDAP server URI configuration - #1102
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the LDAP configuration-writing changes.
No open issues 🎉
What changed in this PR
Fixes LDAP configuration writing when a server entry lacks a URI, allowing the installer to construct it from that server’s host and port.
Changes:
- Corrects the
array_key_exists()argument order to avoid a PHP 8TypeError. - Reads host and port from the current server entry instead of an undefined variable.
- Clears the lingering reference after the
foreachloop.
| File | Description |
|---|---|
datamodels/2.x/authent-ldap/module.authent-ldap.php |
Fixes missing-URI handling and cleans up the loop reference before saving configuration. |
Review effort: Balanced
[Low impact] The PR appears safe to merge.
|
|
Note: Mind to prefix the PR title with the ticket reference and to keep it when doing the "squash & merge", otherwise the information won't be synced with our iTop. |
|
Indeed @Molkobain, we noticed that the squash and merge default name won't be the PR current name but the initial PR name*. That explains why some community PRs I merge with default proposition didn't have the number included in the commit message. Good to know for next times! Thanks for the notice.
|
|
That happens when there’s only 1 commit. As far as I know the template can be configured |
Template of the default squash commit message? |

Base information
Symptom (bug) / Objective (enhancement)
When the LDAP
serverssetting contains at least one server without auri, writing the configuration can fail. On PHP 8, this can raise aTypeErrorbecausearray_key_exists()is called with its arguments in the wrong order. The intended behavior is to build the missing URI from that server’s host and port.Reproduction procedure (bug)
authent-ldapmodule with a non-emptyserverssetting containing a server without auri.AuthentLDAPInstaller::BeforeWritingConfig(e.g. by upgrading to iTop 3.3.0)Cause (bug)
In
datamodels/2.x/authent-ldap/module.authent-ldap.php, the arguments toarray_key_exists()were reversed. The code also readhostandportfrom the undefined$aServerParamsvariable instead of the current$aServerentry.Proposed solution (bug and enhancement)
Corrected the
array_key_exists()argument order and use$aServerto read the host and port when constructing a missing URI. Addedunset($aServer)after the by-referenceforeachto break its lingering reference.Checklist before requesting a review