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)
----------------------------------------------------------------------
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nlz created an issue. See original summary.

Nils Loewen’s picture

This 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.

Nils Loewen’s picture

Status: Active » Needs review
ciss’s picture

Title: PHP Compatibility changes » PHP 7 compatibility
Category: Support request » Feature request
Status: Needs review » Reviewed & tested by the community

Moving 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.

tyler.frankenstein’s picture

Status: Reviewed & tested by the community » Fixed

Thank 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.