-
Notifications
You must be signed in to change notification settings - Fork 752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP 8.1: fix deprecation warnings / http_build_query() #920
PHP 8.1: fix deprecation warnings / http_build_query() #920
Conversation
@jrfnl Could you maybe rebase this PR to trigger a new CI run? It seems that the tests are stuck. Would be great to have this merged :) |
@ruudk The branch is already at current |
Ah, instead of rebasing you can also edit your last commit and force push it, to trigger a new run. The UI doesn't mention "Waiting for approval to run workflow" so it's not an approval thing. |
This fixes an issue with a call to the PHP native `http_build_query()` function, the second parameter of which is the _optional_ `$numeric_prefix` parameter which expects a `string`. A parameter being optional, however, does not automatically make it nullable. As of PHP 8.1, passing `null` to a non-nullable PHP native function will generate a deprecation notice. In this case, this function call yielded a `http_build_query(): Passing null to parameter composer#2 ($numeric_prefix) of type string is deprecated` notice. Changing the `null` to an empty string fixes this without BC-break. Fixes nearly all deprecation warnings found when running the tests. Refs: * https://www.php.net/manual/en/function.http-build-query.php * https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg
1fa0d27
to
2b38cfd
Compare
Actually it does and the previous push doesn't show in the "Actions" list at all as having been approved/attempted to run before. Either way, pushed again, so let's wait for the maintainers to start looking at all six of my PRs. |
Weird, now I see the |
Codecov Report
@@ Coverage Diff @@
## master #920 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 180 180
===========================================
Files 20 20
Lines 464 464
===========================================
Hits 464 464
|
Thanks, @jrfnl! |
Hello, Could you release a new version with this patch please? It triggers deprecation notice on another projet. Thanks |
It seems a release is really neaded to use this fix: no |
This fixes an issue with a call to the PHP native
http_build_query()
function, the second parameter of which is the optional$numeric_prefix
parameter which expects astring
.A parameter being optional, however, does not automatically make it nullable.
As of PHP 8.1, passing
null
to a non-nullable PHP native function will generate a deprecation notice.In this case, this function call yielded a
http_build_query(): Passing null to parameter composer#2 ($numeric_prefix) of type string is deprecated
notice.Changing the
null
to an empty string fixes this without BC-break.Fixes nearly all deprecation warnings found when running the tests.
Refs: