Skip to content

Commit a6c4ebd

Browse files
Merge branch '6.2' into 6.3
* 6.2: [Cache] fix trying to load Memcached before checking we can add missing variable [Notifier] Make `TransportTestCase` data providers static Fix PHPUnit 9.6 deprecations [Notifier] Add missing use statement [Security] fix compat with security-core v6 use proper methods to assert exception messages contain certain strings Fix tests replace usages of the deprecated PHPUnit getMockClass() method [gha] Fix high-deps to run with Symfony 6+ Fix PHPDoc (wrong order)
2 parents d04d7b6 + 13cfebf commit a6c4ebd

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Tests/ExpressionLanguageTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,21 @@ public function testNullSafeCompileFails($expression, $foo)
364364
{
365365
$expressionLanguage = new ExpressionLanguage();
366366

367-
$this->expectWarning();
368-
eval(sprintf('return %s;', $expressionLanguage->compile($expression, ['foo' => 'foo'])));
367+
$this->expectException(\ErrorException::class);
368+
369+
set_error_handler(static function (int $errno, string $errstr, string $errfile = null, int $errline = null): bool {
370+
if ($errno & (\E_WARNING | \E_USER_WARNING) && (str_contains($errstr, 'Attempt to read property') || str_contains($errstr, 'Trying to access'))) {
371+
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
372+
}
373+
374+
return false;
375+
});
376+
377+
try {
378+
eval(sprintf('return %s;', $expressionLanguage->compile($expression, ['foo' => 'foo'])));
379+
} finally {
380+
restore_error_handler();
381+
}
369382
}
370383

371384
public static function provideInvalidNullSafe()

0 commit comments

Comments
 (0)