Skip to content

Commit

Permalink
move display_errors check early
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Sep 21, 2018
1 parent 093f8e1 commit 6af28a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/HeroTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ public function phpErrorHandler(int $errorType, string $errorMessage, string $er
return;
}

if (! $this->errorHeroModuleConfig['display-settings']['display_errors']) {
\error_reporting(\E_ALL | \E_STRICT);
\ini_set('display_errors', '0');
}

if (\in_array($errorType, $this->errorHeroModuleConfig['display-settings']['exclude-php-errors'])) {
return;
}
Expand Down
5 changes: 5 additions & 0 deletions src/Listener/Mvc.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ public function phpError(MvcEvent $e) : void
{
$this->mvcEvent = $e;

if (! $this->errorHeroModuleConfig['display-settings']['display_errors']) {
\error_reporting(\E_ALL | \E_STRICT);
\ini_set('display_errors', '0');
}

\ob_start([$this, 'phpFatalErrorHandler']);
\register_shutdown_function([$this, 'execOnShutdown']);
\set_error_handler([$this, 'phpErrorHandler']);
Expand Down
5 changes: 5 additions & 0 deletions src/Middleware/Expressive.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface

public function phpError() : void
{
if (! $this->errorHeroModuleConfig['display-settings']['display_errors']) {
\error_reporting(\E_ALL | \E_STRICT);
\ini_set('display_errors', '0');
}

\ob_start([$this, 'phpFatalErrorHandler']);
\register_shutdown_function([$this, 'execOnShutdown']);
\set_error_handler([$this, 'phpErrorHandler']);
Expand Down

0 comments on commit 6af28a0

Please sign in to comment.