Skip to content

Commit 118a3a7

Browse files
committed
bug #4728 Fix opcache preload warning for unlinked anonymous class (OndraM)
This PR was merged into the 3.x branch. Discussion ---------- Fix opcache preload warning for unlinked anonymous class This fixes PHP opcache preload warning, caused by php/php-src#10131 . The warning is now produced when the preload is initiated. > Can't preload unlinked class Twig\ExpressionParser\Infix\BinaryOperatorExpressionParser@anonymous: Unknown parent Twig\ExpressionParser\Infix\BinaryOperatorExpressionParser This started with Twig 3.21, when the anonymous class started to be used in ExtensionSet. This is a similar woraround as is already used in a TwigBridge, as suggested by `@nicolas`-grekas here symfony/symfony#38533 Also similar fix is in API platform: api-platform/core#3827 Commits ------- 86997d1 Fix opcache preload warning for unlinked anonymous class
2 parents 6e38bec + 86997d1 commit 118a3a7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/ExtensionSet.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
use Twig\NodeVisitor\NodeVisitorInterface;
2828
use Twig\TokenParser\TokenParserInterface;
2929

30+
// Help opcache.preload discover always-needed symbols
31+
// @see https://github.com/php/php-src/issues/10131
32+
class_exists(BinaryOperatorExpressionParser::class);
33+
3034
/**
3135
* @author Fabien Potencier <fabien@symfony.com>
3236
*

0 commit comments

Comments
 (0)