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

  1. Run any LDAP authentication test with PHP 8.4+
  2. 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

  • Review and commit patch

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.

Issue fork ldap-3573379

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bsztreha created an issue. See original summary.

bsztreha’s picture

The 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!

bluegeek9 made their first commit to this issue’s fork.

bluegeek9’s picture

Assigned: bsztreha » Unassigned
Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.