PHP8 ldap_connect deprecation
-
Aloha Paul! ??
Hope this finds you well. Thank you so much for your previous help with storing credentials in wp-config.php!
Now I’m testing PHP8, but facing this error: Usage of ldap_connect with two arguments is deprecated. I believe it comes from class-authentication.php:1095
$ldap = ldap_connect( $ldap_host, $ldap_port );
Now quick and dirty fix would be just to remove the port, which will probably work for me at this time, but it’s always better when fix comes from the Developer. Might I suggest something in terms of this?
// If a scheme is in the LDAP host, use full LDAP URI instead of just hostname.
if ( array_key_exists( 'scheme', $parsed_host ) ) {
// If the port isn't in the LDAP URI, use the one in the LDAP port field.
if ( ! array_key_exists( 'port', $parsed_host ) ) {
$parsed_host['port'] = $ldap_port;
}
$ldap_host = Helper::build_url( $parsed_host );
} else {
$ldap_host = 'ldap://' . $ldap_host . ':' . $ldap_port;
}
// Create LDAP connection.
$ldap = ldap_connect( $ldap_host );
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.