Trying to run Parsoid parser tests on PHP 8 with -d opcache.enable_cli=1 produces a strange fatal:
/usr/local/opt/php@8.0/bin/php -dopcache.enable_cli=1 bin/parserTests.php --wt2html --wt2wt --html2wt --html2html --selser true --quiet --knownFailures true tests/parser/sectionWrappingParserTests.txt Loaded known failures from /Users/mateszabo/Wikia/parsoid-php/tests/parser/sectionWrappingParserTests-knownFailures.json PHP Fatal error: Uncaught TypeError: Wikimedia\Parsoid\Utils\Utils::isValidDSR(): Argument #1 ($dsr) must be of type ?Wikimedia\Parsoid\Core\DomSourceRange, Wikimedia\Parsoid\Core\DomSourceRange given, called in /Users/mateszabo/Wikia/parsoid-php/src/Wt2Html/PP/Handlers/CleanUp.php on line 227 and defined in /Users/mateszabo/Wikia/parsoid-php/src/Utils/Utils.php:202 Stack trace: #0 /Users/mateszabo/Wikia/parsoid-php/src/Wt2Html/PP/Handlers/CleanUp.php(227): Wikimedia\Parsoid\Utils\Utils::isValidDSR(Object(Wikimedia\Parsoid\Core\DomSourceRange)) #1 /Users/mateszabo/Wikia/parsoid-php/src/Wt2Html/DOMPostProcessor.php(515): Wikimedia\Parsoid\Wt2Html\PP\Handlers\CleanUp::cleanupAndSaveDataParsoid(Array, Object(DOMElement), Object(Wikimedia\Parsoid\Config\Env), true, Object(stdClass)) #2 [internal function]: Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->Wikimedia\Parsoid\Wt2Html\{closure}(Object(DOMElement), Object(Wikimedia\Parsoid\Config\Env), Array, true, Object(stdClass)) #3 /Users/mateszabo/Wikia/parsoid-php/src/Utils/DOMTraverser.php(80): call_user_func(Object(Closure), Object(DOMElement), Object(Wikimedia\Parsoid\Config\Env), Array, true, Object(stdClass)) #4 /Users/mateszabo/Wikia/parsoid-php/src/Utils/DOMTraverser.php(152): Wikimedia\Parsoid\Utils\DOMTraverser->callHandlers(Object(DOMElement), Object(Wikimedia\Parsoid\Config\Env), Array, true, Object(stdClass)) #5 /Users/mateszabo/Wikia/parsoid-php/src/Utils/DOMTraverser.php(166): Wikimedia\Parsoid\Utils\DOMTraverser->traverse(Object(Wikimedia\Parsoid\Config\Env), Object(DOMElement), Array, true, Object(stdClass)) #6 /Users/mateszabo/Wikia/parsoid-php/src/Utils/DOMTraverser.php(166): Wikimedia\Parsoid\Utils\DOMTraverser->traverse(Object(Wikimedia\Parsoid\Config\Env), Object(DOMElement), Array, true, NULL) #7 /Users/mateszabo/Wikia/parsoid-php/src/Utils/DOMTraverser.php(166): Wikimedia\Parsoid\Utils\DOMTraverser->traverse(Object(Wikimedia\Parsoid\Config\Env), Object(DOMElement), Array, true, NULL) #8 /Users/mateszabo/Wikia/parsoid-php/src/Wt2Html/DOMPostProcessor.php(150): Wikimedia\Parsoid\Utils\DOMTraverser->traverse(Object(Wikimedia\Parsoid\Config\Env), Object(DOMElement), Array, true, NULL) #9 /Users/mateszabo/Wikia/parsoid-php/src/Wt2Html/DOMPostProcessor.php(859): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->Wikimedia\Parsoid\Wt2Html\{closure}(Object(DOMElement), Array, true) #10 /Users/mateszabo/Wikia/parsoid-php/src/Wt2Html/DOMPostProcessor.php(909): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->doPostProcess(Object(DOMElement)) #11 /Users/mateszabo/Wikia/parsoid-php/src/Wt2Html/DOMPostProcessor.php(926): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->process(Object(DOMElement)) #12 /Users/mateszabo/Wikia/parsoid-php/src/Wt2Html/ParserPipeline.php(174): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->processChunkily('=1=\na\n\n{{1x|1=\n...', Array) #13 /Users/mateszabo/Wikia/parsoid-php/src/Wt2Html/ParserPipeline.php(235): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parseChunkily('=1=\na\n\n{{1x|1=\n...', Array) #14 /Users/mateszabo/Wikia/parsoid-php/src/Wt2Html/ParserPipelineFactory.php(299): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parseToplevelDoc('=1=\na\n\n{{1x|1=\n...', Array) #15 /Users/mateszabo/Wikia/parsoid-php/src/Core/WikitextContentModelHandler.php(106): Wikimedia\Parsoid\Wt2Html\ParserPipelineFactory->parse('=1=\na\n\n{{1x|1=\n...') #16 /Users/mateszabo/Wikia/parsoid-php/src/ParserTests/TestRunner.php(808): Wikimedia\Parsoid\Core\WikitextContentModelHandler->toDOM(Object(Wikimedia\Parsoid\Config\Env)) #17 /Users/mateszabo/Wikia/parsoid-php/src/ParserTests/TestRunner.php(889): Wikimedia\Parsoid\ParserTests\TestRunner->convertWt2Html(Object(Wikimedia\Parsoid\Config\Env), Object(Wikimedia\Parsoid\ParserTests\Test), 'wt2html', '=1=\na\n\n{{1x|1=\n...') #18 /Users/mateszabo/Wikia/parsoid-php/src/ParserTests/TestRunner.php(1205): Wikimedia\Parsoid\ParserTests\TestRunner->runTest(Object(Wikimedia\Parsoid\ParserTests\Test), 'wt2html', Array) #19 /Users/mateszabo/Wikia/parsoid-php/src/ParserTests/TestRunner.php(1426): Wikimedia\Parsoid\ParserTests\TestRunner->buildTasks(Object(Wikimedia\Parsoid\ParserTests\Test), Array, Array) #20 /Users/mateszabo/Wikia/parsoid-php/src/ParserTests/TestRunner.php(1509): Wikimedia\Parsoid\ParserTests\TestRunner->processTest(Object(Wikimedia\Parsoid\ParserTests\Test), Array) #21 /Users/mateszabo/Wikia/parsoid-php/bin/parserTests.php(65): Wikimedia\Parsoid\ParserTests\TestRunner->run(Array) #22 /Users/mateszabo/Wikia/parsoid-php/tools/doMaintenance.php(53): ParserTests->execute() #23 /Users/mateszabo/Wikia/parsoid-php/bin/parserTests.php(902): require_once('/Users/mateszab...') #24 {main} thrown in /Users/mateszabo/Wikia/parsoid-php/src/Utils/Utils.php on line 202
This seems like some kind of PHP/opcache bug, as the types listed by the error seem to match (also confirmed by debugging), and the error does not occur when opcache is disabled.