Page MenuHomePhabricator

PHP 7 compatibility: Fix variable interpolation in DataOutputFormatter.php
Closed, ResolvedPublic

Description

For clarity and less unexpected behavior between PHP5 and PHP7, break

mediawiki-extensions/Echo/includes/DataOutputFormatter.php's line
$formatter = new self::$formatters[$format]( $user, $lang );

into two explicit lines, due to

referenceold meaningnew meaning in PHP7
Foo::$bar['baz']()Foo::{$bar['baz']}()(Foo::$bar)['baz']()

Event Timeline

Aklapper created this task.Dec 31 2016, 5:32 PM
Restricted Application added a project: Collaboration-Team-Triage. · View Herald TranscriptDec 31 2016, 5:32 PM
Restricted Application added a subscriber: TerraCodes. · View Herald Transcript

Imported this task into GCI.
I'd appreciate if noone outside of GCI worked on this task for the next two weeks. :)

Aklapper moved this task from Unsorted to PHP 7 on the [DO NOT USE] NewPHP board.Dec 31 2016, 7:17 PM

Change 330142 had a related patch set uploaded (by Georggi199):
Fixed variable interpolation in DataOutputFormatter.php

https://gerrit.wikimedia.org/r/330142

Reedy added a subscriber: Reedy.Jan 3 2017, 3:37 PM

I just CR+2'd that patch... Should they have been fixing both?

Change 330142 merged by jenkins-bot:
Fixed variable interpolation in DataOutputFormatter.php

https://gerrit.wikimedia.org/r/330142

Florian added a subscriber: Florian.Jan 3 2017, 3:44 PM

@Reedy: What do you mean with "both"?

Reedy added a comment.Jan 3 2017, 3:45 PM

@Reedy: What do you mean with "both"?

From the description

into two explicit lines, due to

From (one implicit line):

$formatter = new self::$formatters[$format]( $user, $lang );

to (two explicit lines):

$class = self::$formatters[$format];
$formatter = new $class( $user, $lang );

?? :D

Reedy closed this task as Resolved.Jan 3 2017, 4:46 PM
Reedy assigned this task to Georggi1999.