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.

CommentFileSizeAuthor
fix-variable-interpolation.patch703 bytesneclimdul

Comments

fabianx’s picture

Status: Needs review » Reviewed & tested by the community
sharique’s picture

There might be more files, which needs similar changes.

dawehner’s picture

Issue tags: +Quickfix

There might be more files, which needs similar changes.

But fixing it in one place allows us to keep the issue in scope

neclimdul’s picture

Skimmed the report from the other issue and as far as issues like this one the other entries looked like false positives.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Silly PHP 7.

Committed and pushed to 8.0.x. Thanks!

  • webchick committed bbde5c0 on 8.0.x
    Issue #2542872 by neclimdul: Fix variable interpolation to be PHP 7...

Status: Fixed » Closed (fixed)

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