Problem/Motivation
PHP 8.4 deprecates implicitly nullable parameters. When a parameter has a typed declaration (e.g., string) but has NULL as its default value, PHP 8.4 emits a deprecation warning:
Deprecated: Implicitly marking parameter $conversion as nullable is deprecated,
the explicit nullable type must be used instead
Debug Report
- Run any LDAP authentication test with PHP 8.4+
- Observe deprecation warnings in the output
Affected files:
ldap_servers/src/Helper/ConversionHelper.php line 92:
public static function convertAttribute(string $value, string $conversion = NULL): string {
ldap_servers/tests/modules/ldap_servers_dummy/src/FakeLdap.php line 50:
public function bind(string $dn = NULL, string $password = NULL): void {
Proposed resolution
Add explicit nullable type declarations (?string) to affected parameters:
// ConversionHelper.php
public static function convertAttribute(string $value, ?string $conversion = NULL): string {
// FakeLdap.php
public function bind(?string $dn = NULL, ?string $password = NULL): void {
Remaining tasks
User interface changes
None.
API changes
None - this is a backwards-compatible fix. The ?string nullable type accepts the same values as before (string or null).
Data model changes
None.
Comments
Comment #3
bsztreha commentedThe CI is failing because it's running on PHP 8.5.3 with Drupal main-dev (D12).
This patch targets PHP 8.4 compatibility. The module itself may need additional
work for PHP 8.5/D12 compatibility, which is outside the scope of this MR.
Could a maintainer adjust the CI to test on a supported Drupal/PHP version?
Thank you!