Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This ticket is meant to ensure module compatibility with PHP version 7.2+.
I have used the phpcs code standard PHPCompatibility to find the following warnings:
FILE: .../services/includes/services.runtime.inc
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
265 | WARNING | Since PHP 7.0, functions inspecting arguments, like
| | func_get_args(), no longer report the original value
| | as passed to a parameter, but will instead provide
| | the current value. The parameter "$module" was used,
| | and possibly changed (by reference), on line
| | 253.
| | (PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection)
----------------------------------------------------------------------
FILE: .../services/servers/rest_server/includes/RESTServer.inc
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
260 | WARNING | Passing the $glue and $pieces parameters in reverse
| | order to join has been deprecated since PHP 7.4;
| | $glue should be the first parameter and $pieces the
| | second
| | (PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder.Deprecated)
----------------------------------------------------------------------
Comment | File | Size | Author |
---|---|---|---|
#2 | 3080485.services.PHP-Compatibility-changes.patch | 1.44 KB | Nils Loewen |
Comments
Comment #2
Nils LoewenThis patch fixes both warnings.
The reasoning to move the `$arts = func_get_arts();` line in services.runtime.inc `services_auth_invoke()` line 265 to the top of the function is so that the original arg values will be stored in $arg. Although I don't think the `$module` var is being changed between being passed in and being passed to `drupal_get_path()`, this change ensures that the arguments are the values originally passed in, which I believe was the original intent.
Comment #3
Nils LoewenComment #4
ciss CreditAttribution: ciss at yousign GmbH commentedMoving func_get_args() to the top is not strictly necessary as all parameters get replaced via array_splice(). It's probably still the safest choice with respect to future changes.
Comment #6
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedThank you both. I've committed and pushed this to 7.x-3.x. If this auto closes in two weeks, I'd like to release a new recommended version with this fix and a few others.