This issue happens most of the times, but not always. When it doesn't result in failure, I just rerun the build and then it fails.
As you can see in commit history, looks like issue doesn't happen if I remove other dependecies that we use (I've ensured that's the case by rerunning this successful build several times), so it's probably also related to number of files that's loaded?
After experimentation, what I can say is that it looks like all 3 things you can see in file:
assertFalse()
class_exists()
loading class in separate file (new Configuration()) - inlining the class via anonymous class doesn't reproduce the issue
We have issue in DoctrineBundle with following test in PHP 8.1
https://github.com/doctrine/DoctrineBundle/blob/4fd840eb3c6469619be34d473af3dbc3a6b2a957/Tests/DependencyInjection/ConfigurationTest.php, see https://github.com/doctrine/DoctrineBundle/commits/test-failure-experiment and one of its CI failures
Above is reduced version of the file after troubleshooting it to shrink down the reproducer, original version was https://github.com/doctrine/DoctrineBundle/blob/2.5.x/Tests/DependencyInjection/ConfigurationTest.php
This issue happens most of the times, but not always. When it doesn't result in failure, I just rerun the build and then it fails.
As you can see in commit history, looks like issue doesn't happen if I remove other dependecies that we use (I've ensured that's the case by rerunning this successful build several times), so it's probably also related to number of files that's loaded?
After experimentation, what I can say is that it looks like all 3 things you can see in file: assertFalse() class_exists() loading class in separate file (
new Configuration()
) - inlining the class via anonymous class doesn't reproduce the issueare required to reproduce issue.