Page MenuHomePhabricator

PHP 8.5: "Phan 5.5.2 crashed when parsing/analyzing 'plugins/RedundantExistenceChecksPlugin/empty-miscnodes/test.php')"
Closed, DeclinedPublic

Description

https://integration.wikimedia.org/ci/job/composer-package-php85/4/console

00:00:11.124 (Phan 5.5.2 crashed when parsing/analyzing 'plugins/RedundantExistenceChecksPlugin/empty-miscnodes/test.php')
00:00:11.124 More details:
00:00:11.124 #2: include() called at [/src/vendor/composer/ClassLoader.php:576] Args: ["/src/vendor/phan/phan/src/Phan/Bootstrap.php"]
00:00:11.124 #3: {closure:Composer\Autoload\ClassLoader::initializeIncludeClosure():575}() called at [/src/vendor/composer/ClassLoader.php:427] Args: ["/src/vendor/composer/../tysonandre/var_representation_polyfill/src/VarRepresentation/Encoder.php"]

Event Timeline

There is a deprecation notice, not sure if phan crashed there, when the notice is converted to exception by phpunit.

/src/vendor/tysonandre/var_representation_polyfill/src/VarRepresentation/Encoder.php:157 [8192] Case statements followed by a semicolon (;) are deprecated, use a colon (:) instead

Upstream issue is https://github.com/TysonAndre/var_representation_polyfill/pull/5. This was worked around in phan v6 by live-patching the dependency. I'm not sure if that fix is worth backporting, I don't think we advertised phan 5 as PHP 8.5-compatible. Maybe we can just ignore this until we upgrade to phan 6?

Upstream issue is https://github.com/TysonAndre/var_representation_polyfill/pull/5. This was worked around in phan v6 by live-patching the dependency. I'm not sure if that fix is worth backporting, I don't think we advertised phan 5 as PHP 8.5-compatible. Maybe we can just ignore this until we upgrade to phan 6?

If Phan 6 is coming soon, that'd be great; currently CI roll-out of PHP 8.5 testing in general is blocked by this.

The beta is out for general testing and I have already tested it extensively on MW core before release. The upgrade should be easy at this point for us. I don't think we have a timeline for the official release yet but I can ask.

There is a deprecation notice, not sure if phan crashed there, when the notice is converted to exception by phpunit. […]

PHPUnit does not run in this process, afaik. It seems Phan is directly choosing to enforce a strict mode of sorts where it tolerates no runtime warnings.

…
Parsing files...
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 54 / 64 (100%) 36MB
Analyzing classes...
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 51MB
Analyzing functions...
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 51MB
Analyzing methods...
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 51MB
/src/vendor/tysonandre/var_representation_polyfill/src/VarRepresentation/Encoder.php:157 [8192] Case statements followed by a semicolon (;) are deprecated, use a colon (:) instead
(Phan 5.5.2 crashed when parsing/analyzing 'lib/Less/Cache.php')
More details:
#2: include() called at [/src/vendor/composer/ClassLoader.php:576] Args: ["/src/vendor/phan/phan/src/Phan/Bootstrap.php"]
#3: {closure:Composer\Autoload\ClassLoader::initializeIncludeClosure():575}() called at [/src/vendor/composer/ClassLoader.php:427] Args: ["/src/vendor/composer/../tysonandre/var_representation_polyfill/src/VarRepresentation/Encoder.php"]
#4: Composer\Autoload\ClassLoader->loadClass() called at [/src/vendor/tysonandre/var_representation_polyfill/src/var_representation.php:41] Args: ["VarRepresentation\\Encoder"]
#5: var_representation() called at [/src/vendor/phan/phan/src/Phan/AST/ASTReverter.php:72] Args: ["\n", 1]
#6: Phan\AST\ASTReverter::toShortString() Args: ["\n"]
#7: array_map() called at [/src/vendor/phan/phan/src/Phan/AST/ASTReverter.php:148] Args: [["Phan\\AST\\ASTReverter", "toShortString"], ["\n", ast\Node({"kind":256,"flags":0,"lineno":112,"children":{"name":"list"}})]]
…
#50: require_once() called at [/src/vendor/phan/phan/phan:10] Args: ["/src/vendor/phan/phan/src/phan.php"]
#51: include() called at [/src/vendor/bin/phan:119] Args: ["/src/vendor/phan/phan/phan"]

Script phan --allow-polyfill-parser handling the phan event returned with error code 1
Script @phan was called via test
Build step 'Execute shell' marked build as failure

There is a deprecation notice, not sure if phan crashed there, when the notice is converted to exception by phpunit. […]

PHPUnit does not run in this process, afaik. It seems Phan is directly choosing to enforce a strict mode of sorts where it tolerates no runtime warnings.

…
Parsing files...
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 54 / 64 (100%) 36MB
Analyzing classes...
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 51MB
Analyzing functions...
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 51MB
Analyzing methods...
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 51MB
/src/vendor/tysonandre/var_representation_polyfill/src/VarRepresentation/Encoder.php:157 [8192] Case statements followed by a semicolon (;) are deprecated, use a colon (:) instead
(Phan 5.5.2 crashed when parsing/analyzing 'lib/Less/Cache.php')
More details:
#2: include() called at [/src/vendor/composer/ClassLoader.php:576] Args: ["/src/vendor/phan/phan/src/Phan/Bootstrap.php"]
#3: {closure:Composer\Autoload\ClassLoader::initializeIncludeClosure():575}() called at [/src/vendor/composer/ClassLoader.php:427] Args: ["/src/vendor/composer/../tysonandre/var_representation_polyfill/src/VarRepresentation/Encoder.php"]
#4: Composer\Autoload\ClassLoader->loadClass() called at [/src/vendor/tysonandre/var_representation_polyfill/src/var_representation.php:41] Args: ["VarRepresentation\\Encoder"]
#5: var_representation() called at [/src/vendor/phan/phan/src/Phan/AST/ASTReverter.php:72] Args: ["\n", 1]
#6: Phan\AST\ASTReverter::toShortString() Args: ["\n"]
#7: array_map() called at [/src/vendor/phan/phan/src/Phan/AST/ASTReverter.php:148] Args: [["Phan\\AST\\ASTReverter", "toShortString"], ["\n", ast\Node({"kind":256,"flags":0,"lineno":112,"children":{"name":"list"}})]]
…
#50: require_once() called at [/src/vendor/phan/phan/phan:10] Args: ["/src/vendor/phan/phan/src/phan.php"]
#51: include() called at [/src/vendor/bin/phan:119] Args: ["/src/vendor/phan/phan/phan"]

Script phan --allow-polyfill-parser handling the phan event returned with error code 1
Script @phan was called via test
Build step 'Execute shell' marked build as failure

Yes, it seems the error handler of phan itself decides to make this a failure and not phpunit or composer.

Upstream issue: https://github.com/phan/phan/issues/5420

In practice, we're treating this as a blocker to the migration (see T406326#11543498), so let's invert the dependency tree.

Change #1235308 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/tools/phan@master] Provide phan/var_representation_polyfill@0.1.4

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

Change #1235309 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/tools/phan/SecurityCheckPlugin@master] Provide phan/var_representation_polyfill@0.1.4

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

Change #1235308 abandoned by Umherirrender:

[mediawiki/tools/phan@master] Provide phan/var_representation_polyfill@0.1.4

Reason:

Waiting for phan v6

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

Change #1235309 abandoned by Umherirrender:

[mediawiki/tools/phan/SecurityCheckPlugin@master] Provide phan/var_representation_polyfill@0.1.4

Reason:

Waiting for phan v6

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

Umherirrender edited projects, added Upstream; removed Patch-For-Review.

Not fixed with phan v5, waiting for phan v6

Change #1238038 had a related patch set uploaded (by Jforrester; author: Jforrester):

[integration/config@master] Zuul: [mediawiki/tools/phan] Add PHP 8.5 CI job

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

Change #1238039 had a related patch set uploaded (by Jforrester; author: Jforrester):

[integration/config@master] [WIP] Zuul: Add PHP 8.5 CI job to various things blocked by Phan

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

Change #1238038 merged by jenkins-bot:

[integration/config@master] Zuul: [mediawiki/tools/phan] Add PHP 8.5 CI job

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

Mentioned in SAL (#wikimedia-releng) [2026-02-09T21:58:45Z] <James_F> Zuul: [mediawiki/tools/phan] Add PHP 8.5 CI job, for T410941

Change #1238039 merged by jenkins-bot:

[integration/config@master] Zuul: Add PHP 8.5 CI job to various things noted as blocked by Phan

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

Mentioned in SAL (#wikimedia-releng) [2026-02-12T19:31:13Z] <James_F> Zuul: Add PHP 8.5 CI job to various things noted as blocked by Phan, for T410941, T406326