Needs work
Project:
Redis
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Aug 2026 at 21:23 UTC
Updated:
2 Oct 2026 at 10:20 UTC
Jump to comment: Most recent
Upgrading to PHP 8.4 and am running code scans to verify compatibility. There is a warning:
FILE: /var/www/html/web/modules/contrib/redis/src/Client/Predis.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
62 | 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 "$options" was used, and possibly changed (by reference), on line 52.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Run phpcs with 8.4 standard compatibility.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
berdirThat is not the same, the code there is explicitly to support options as an array and separate parameters, because that is how the underlying library works.
Comment #4
leandro713 commentedI had a look at Berdir's feedback. I think this can be fixed with a small
change by capturing the original arguments before $options is processed,
while keeping support for both array options and separate parameters.
I'm going to prepare a small follow-up change based on that approach.
Comment #5
leandro713 commentedI updathed the change so that
func_get_args()iscalled before
$optionsis processed.This keeps the original argument list intact, including any additional
parameters passed after
$options, while preservin the existing arraynormalization logic.
The previous
func_get_args()call inside the else branch is no longerneeded, because the arguments are now captured once at the beginning of the
method. Removing it does not change the behaviour, it only avoids reading the
arguments after
$optionsmay have been processed.Comment #6
leandro713 commentedComment #7
berdirThis report is clearly bogus, it just doesn't understand it well enough. options is never changed and definitely not when func_get_args() is called. I'm sure it's only minor overhead but it's still overhead to call it first and then replace it again. Id' rather either ignore this report or silence it.
Comment #8
leandro713 commentedThanks, that makes sense.
I was treating the PHPCompatibility warning itself as something worth
avoiding, rather than suggesting that $options is actually modified at
runtime.
If this is a false positive and changing the argument handling would only
add unnecessary complexity, then silencing this specific report seems like
the better approach.
I'll look into whether we can suppress just this PHPCompatibility warning
without changing the current behaviour.