Skip to content

Commit 6af28a0

Browse files
committed
move display_errors check early
1 parent 093f8e1 commit 6af28a0

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/HeroTrait.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,6 @@ public function phpErrorHandler(int $errorType, string $errorMessage, string $er
7878
return;
7979
}
8080

81-
if (! $this->errorHeroModuleConfig['display-settings']['display_errors']) {
82-
\error_reporting(\E_ALL | \E_STRICT);
83-
\ini_set('display_errors', '0');
84-
}
85-
8681
if (\in_array($errorType, $this->errorHeroModuleConfig['display-settings']['exclude-php-errors'])) {
8782
return;
8883
}

src/Listener/Mvc.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ public function phpError(MvcEvent $e) : void
6161
{
6262
$this->mvcEvent = $e;
6363

64+
if (! $this->errorHeroModuleConfig['display-settings']['display_errors']) {
65+
\error_reporting(\E_ALL | \E_STRICT);
66+
\ini_set('display_errors', '0');
67+
}
68+
6469
\ob_start([$this, 'phpFatalErrorHandler']);
6570
\register_shutdown_function([$this, 'execOnShutdown']);
6671
\set_error_handler([$this, 'phpErrorHandler']);

src/Middleware/Expressive.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
6464

6565
public function phpError() : void
6666
{
67+
if (! $this->errorHeroModuleConfig['display-settings']['display_errors']) {
68+
\error_reporting(\E_ALL | \E_STRICT);
69+
\ini_set('display_errors', '0');
70+
}
71+
6772
\ob_start([$this, 'phpFatalErrorHandler']);
6873
\register_shutdown_function([$this, 'execOnShutdown']);
6974
\set_error_handler([$this, 'phpErrorHandler']);

0 commit comments

Comments
 (0)