Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Aug 10, 2023

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

Refs:

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

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants