PHP 8.3 | :sparkles: New `PHPCompatibility.ParameterValues.RemovedLdapConnectSignatures` sniff (RFC) by jrfnl · Pull Request #1620 · PHPCompatibility/PHPCompatibility

@jrfnl

…ignatures` sniff (RFC)

> - LDAP
>   . Calling ldap_connect() with separate hostname and port is deprecated.

Refs:
* https://wiki.php.net/rfc/deprecations_php_8_3#deprecate_calling_ldap_connect_with_2_parameters
* https://github.com/php/php-src/blob/548fc6a8185625bf50c708a9337db01f14860ba1/UPGRADING#L146-L148
* php/php-src 5177
* php/php-src@69a8b63

This adds a new sniff to detect the above.

**Note**:
Normally this kind of change would be handled via the `RemovedFunctionParameters` sniff, but this function has *three* distinct signatures and the signatures are being deprecated in reverse order, i.e. the 2-param signature is being deprecated in PHP 8.3, while the 3+ param signature is being deprecated in PHP 8.4.
For that reason, the `RemovedFunctionParameters` sniff is not suitable to handle this.

Also note that, while the three+ param signature is still supported, passing a separate `$host` and `$port` is also deprecated for that signature. Instead a `$uri` should be passed and `$port` should be set to `null`.
The sniff does take this into account and handles this via a separate error code.

Includes tests and documentation.

Related to 1589

@jrfnl jrfnl mentioned this pull request

Aug 10, 2023

35 tasks

wimg

wimg approved these changes Aug 10, 2023

@wimg wimg deleted the php-8.3/new-removedldapconnectsignatures-sniff branch

August 10, 2023 21:37

This was referenced

Aug 14, 2023

@jrfnl jrfnl mentioned this pull request

Mar 16, 2024