@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix PHP 8.3 "Usage of ldap_connect with two arguments is deprecated" exception

Summary:
Per https://www.php.net/manual/en/function.ldap-connect.php the signature `$conn = @ldap_connect($host, $this->port);` is deprecated since PHP 8.3.
Thus pass a full LDAP URI as the only parameter.

```
ERROR 8192: Usage of ldap_connect with two arguments is deprecated at [/var/www/html/phorge/phorge/src/applications/auth/adapter/PhutilLDAPAuthAdapter.php:308]
```

Closes T15724

Test Plan: Set up LDAP as auth provider, try to log in.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15724

Differential Revision: https://we.phorge.it/D25792

+7 -2
+7 -2
src/applications/auth/adapter/PhutilLDAPAuthAdapter.php
··· 305 305 'port' => $this->port, 306 306 )); 307 307 308 - $conn = @ldap_connect($host, $this->port); 308 + if ($this->ldapStartTLS) { 309 + $ldap_server_uri = 'ldaps://'.$host.':'.$this->port; 310 + } else { 311 + $ldap_server_uri = 'ldap://'.$host.':'.$this->port; 312 + } 313 + $conn = @ldap_connect($ldap_server_uri); 309 314 310 315 $profiler->endServiceCall( 311 316 $call_id, ··· 315 320 316 321 if (!$conn) { 317 322 throw new Exception( 318 - pht('Unable to connect to LDAP server (%s:%d).', $host, $port)); 323 + pht('Unable to connect to LDAP server (%s).', $ldap_server_uri)); 319 324 } 320 325 321 326 $options = array(