mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #10563 from creative-commoners/pulls/4/conf-version
FIX Filter out E_USER_DEPRECATED unrelated to unit test
This commit is contained in:
commit
e454db6dc9
@ -24,12 +24,18 @@ class DeprecationTest extends SapphireTest
|
||||
// https://github.com/laminas/laminas-di/pull/30#issuecomment-927585210
|
||||
parent::setup();
|
||||
$this->oldHandler = set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline) {
|
||||
if (str_contains($errstr, 'SilverStripe\\Dev\\Tests\\DeprecationTest')) {
|
||||
throw new Deprecated($errstr, $errno, '', 1);
|
||||
if ($errno === E_USER_DEPRECATED) {
|
||||
if (str_contains($errstr, 'SilverStripe\\Dev\\Tests\\DeprecationTest')) {
|
||||
throw new Deprecated($errstr, $errno, '', 1);
|
||||
} else {
|
||||
// Surpress any E_USER_DEPRECATED unrelated to this unit-test
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (is_callable($this->oldHandler)) {
|
||||
return call_user_func($this->oldHandler, $errno, $errstr, $errfile, $errline);
|
||||
}
|
||||
// Fallback to default PHP error handler
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user