Problem/Motivation
https://www.drupal.org/node/2454439#comment-10160036 identified some code that uses variable referencing that is not compatible with PHP 7. The fix is fairly straight forward.
Reference on the PHP7 Change:
https://wiki.php.net/rfc/uniform_variable_syntax
// old meaning // new meaning
$$foo['bar']['baz'] ${$foo['bar']['baz']} ($$foo)['bar']['baz']
$foo->$bar['baz'] $foo->{$bar['baz']} ($foo->$bar)['baz']
$foo->$bar['baz']() $foo->{$bar['baz']}() ($foo->$bar)['baz']()
Foo::$bar['baz']() Foo::{$bar['baz']}() (Foo::$bar)['baz']()Proposed resolution
Just split the code up to make it more clear.
Remaining tasks
Review, commit.
| Comment | File | Size | Author |
|---|---|---|---|
| fix-variable-interpolation.patch | 703 bytes | neclimdul |
Comments
Comment #1
fabianx commentedComment #2
sharique commentedThere might be more files, which needs similar changes.
Comment #3
dawehnerBut fixing it in one place allows us to keep the issue in scope
Comment #4
neclimdulSkimmed the report from the other issue and as far as issues like this one the other entries looked like false positives.
Comment #5
webchickSilly PHP 7.
Committed and pushed to 8.0.x. Thanks!