Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Aug 14, 2024

OptionalToRequiredFunctionParameters: add missing false positive test case

PHP 8.4 | OptionalToRequiredFunctionParameters: account for deprecation of overloaded pg_*() signatures (RFC)

  • PgSQL:
    . Calling pg_fetch_result() with 2 arguments is deprecated. Use the
    3-parameter signature with a null $row parameter instead.
    . Calling pg_field_prtlen() with 2 arguments is deprecated. Use the
    3-parameter signature with a null $row parameter instead.
    . Calling pg_field_is_null() with 2 arguments is deprecated. Use the
    3-parameter signature with a null $row parameter instead.

Note: when named parameters are used, the sniff will use the correct parameter name in the deprecation warning.
When positional parameters are used, the sniff will flag $field as missing, even though in reality (due to the secondary signature), the $row parameter is missing.

This could possible be clarified by adding an "alternative" key to the array and using the value of that in the error message, but that's for later.

Refs:

Related to #1589

jrfnl added 2 commits August 14, 2024 15:44
…on of overloaded pg_*() signatures (RFC)

> - PgSQL:
>  . Calling pg_fetch_result() with 2 arguments is deprecated. Use the
>    3-parameter signature with a null $row parameter instead.
>  . Calling pg_field_prtlen() with 2 arguments is deprecated. Use the
>    3-parameter signature with a null $row parameter instead.
>  . Calling pg_field_is_null() with 2 arguments is deprecated. Use the
>    3-parameter signature with a null $row parameter instead.

Note: when named parameters are used, the sniff will use the correct parameter name in the deprecation warning.
When positional parameters are used, the sniff will flag `$field` as missing, even though in reality (due to the secondary signature), the `$row` parameter is missing.

This could possible be clarified by adding an "alternative" key to the array and using the value of that in the error message, but that's for later.

Refs:
* https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#pg_fetch_result_pg_field_prtlen_and_pg_field_is_null
* php/php-src 12728
* php/php-src@beaf1e8
* https://www.php.net/pg_fetch_result
* https://www.php.net/pg_field_prtlen
* https://www.php.net/pg_field_is_null

Related to 1589
@jrfnl jrfnl added Type: enhancement PR: quick merge PR only contains relatively simple changes PR: ready for review labels Aug 14, 2024
@jrfnl jrfnl added this to the 10.0.0 milestone Aug 14, 2024
@jrfnl jrfnl requested a review from wimg August 14, 2024 14:19
@wimg wimg merged commit ec4ee4f into develop Aug 31, 2024
@wimg wimg deleted the php-8.4/optionaltorequiredparam-pgsql-overloaded-sig branch August 31, 2024 21:03
@github-actions github-actions bot removed PR: quick merge PR only contains relatively simple changes PR: ready for review labels Aug 31, 2024
@jrfnl jrfnl added the PHP: 8.4 label Nov 4, 2025
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