Skip to content

Commit d7d8e73

Browse files
Closes #5956
1 parent 9009862 commit d7d8e73

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ChangeLog-8.5.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ All notable changes of the PHPUnit 8.5 release series are documented in this fil
66

77
### Changed
88

9+
* [#5956](https://github.com/sebastianbergmann/phpunit/issues/5956): Deprecation of the `E_STRICT` constant in PHP 8.4
910
* Removed `.phpstorm.meta.php` file as methods such as `TestCase::createStub()` use generics / template types for their return types and PhpStorm, for example, uses that information
1011

1112
## [8.5.39] - 2024-07-10

src/Util/ErrorHandler.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use const E_USER_NOTICE;
1717
use const E_USER_WARNING;
1818
use const E_WARNING;
19+
use function defined;
1920
use function error_reporting;
2021
use function restore_error_handler;
2122
use function set_error_handler;
@@ -93,10 +94,18 @@ public function __invoke(int $errorNumber, string $errorString, string $errorFil
9394
return false;
9495
}
9596

97+
/**
98+
* E_STRICT is deprecated since PHP 8.4.
99+
*
100+
* @see https://github.com/sebastianbergmann/phpunit/issues/5956
101+
*/
102+
if (defined('E_STRICT') && $errorNumber === @E_STRICT) {
103+
$errorNumber = E_NOTICE;
104+
}
105+
96106
switch ($errorNumber) {
97107
case E_NOTICE:
98108
case E_USER_NOTICE:
99-
case E_STRICT:
100109
if (!$this->convertNoticesToExceptions) {
101110
return false;
102111
}

0 commit comments

Comments
 (0)