Page MenuHomePhabricator

PHP 8 Compatibility
Open, LowPublic

Description

PHP 8 was released on November 26, 2020 and Arcanist and Phabricator have at least a few compatibility issues, although the changes in PHP 8 and the required adjustments seem likely to be minor.

At time of writing, customers haven't begun upgrading to PHP 8 yet, so fixing these issues isn't a priority. It took about a year before customers began deploying PHP 7 and only a few hours to fix the bulk of the issues; the process for PHP 8 may be similar.

Previously, see T12101 for PHP 7 compatibility.

Event Timeline

epriestley triaged this task as Low priority.EditedSun, Jan 10, 10:23 PM
epriestley created this task.

In D21496, declaring a method private final (which is redundant, as a private method may never be overridden) causes an issue in PHP8.

  • A new linter should be introduced to detect this so new instances are not introduced. Similar linters currently exist for abstract final and final in a final class, but private final slipped through.
  • After the linter is available, a similar change should be applied to the Phabricator repository (D21496 covers Arcanist).

With the four revisions I've just added, arc lint works with PHP 8 when run inside the arcanist repo, and arc unit --everything has no regressions compared with PHP 7.4 (both do have a few failures but they're the same and relate to pyflakes/jshint/hg, and look environment-specific so nothing to do with PHP 8).

So I don't forget:

  • From D21501, a linter rule for blocks that catch Exception but do not catch Throwable is likely desirable.
  • From D21500, xsprintf() has an unusual $callback(...) invocation, where call_user_func[_array]() is usually used. This does not work with C::m (a static method callback specified as a string) in older PHP. It does work with array('C', 'm') since PHP 5.4. Some kind of pointer to the explanation (that this is to simplify reference parameter behavior) would be nice.