Since PHP 7 func_get_args() no longer reports the original value as passed to a parameter, so call it early

Created on 1 March 2024, 9 months ago

The following warnings are present when running PHP compatibility checks on the module.

FILE: ...date_recur_modular/src/Plugin/Field/FieldWidget/DateRecurModularSierraWidget.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------
671 | 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 "$items" was used, and possibly changed (by reference), on line 670.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: ...date_recur_modular/src/Plugin/Field/FieldWidget/DateRecurModularAlphaWidget.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------
348 | 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 "$items" was used, and possibly changed (by reference), on line 347.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: ...date_recur_modular/src/Plugin/Field/FieldWidget/DateRecurModularOscarWidget.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------
434 | 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 "$items" was used, and possibly changed (by reference), on line 433.
-------------------------------------------------------------------------------------------------------------------------------------------------------------

Patch attached which moves func_get_args() to beginning of method call for compatibility with versions of PHP 7.0 and onwards.

🐛 Bug report
Status

Closed: works as designed

Version

3.1

Component

Code

Created by

🇬🇧United Kingdom xiwar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @xiwar
  • 🇬🇧United Kingdom xiwar
  • Status changed to Closed: works as designed 9 months ago
  • 🇦🇺Australia dpi Perth, Australia

    This is real silly.

    A few things.

    • Minimum PHP version this project supported was 7.1, back in 2019.
    • There is no reference-passing for those args.
    • Whatever is creating these rules seems naive.
    • If its not in PHPStan reports, it doesnt exist.
Production build 0.71.5 2024