samsonasik / ErrorHeroModule

:gem: A Hero for your Zend Framework/Laminas, and Expressive/Mezzio application to log ( DB and Mail ) and handle php errors & exceptions during Mvc process/between request and response
MIT License
50 stars 6 forks source link

display_errors setting being set to 1 does not show errors in browser. #74

Closed dennis-fedco closed 4 years ago

dennis-fedco commented 4 years ago

What ZF application I'm using when issue happen ?

What PHP version you're using?

What ErrorHeroModule version you're using?

What Database you're using?

Expected behavior

Show exact error message in the browser, and log the error message in the error log.

Actual behavior

No error is shown, but my application has null values when I expect values. The exact error message is not shown explicitly even though effects of the error are evident by observing that my application is not working as expected.

Steps/Codes to reproduce the behavior

When in the hero config file I set ['display-settings']['display_errors'] to 0, the exact error of the application is written into the log, which is helpful in debugging the error. But when I set ['display-settings']['display_errors'] to 1, my application does not show explicit error in the browser, and no error message is written into the log, even though it is evident that my application is affected by the (unknown/unlogged) error.

Thus I feel like there is more to ['display-settings']['display_errors'] setting than I am aware of. What happens when ['display-settings']['display_errors'] is set to 1, because I do not see the error in the browser, or any of the logs.

Looking in the ErrorHeroModule code briefly it looks like the setting being 0 turns off ErrorHeroModule handling of the error and pushes it back to MVC module. I am not sure what it means, but it may explain why error is not logged, and why I may not be getting an error message displayed in my browser.

samsonasik commented 4 years ago

I can't reproduce, when I set display_errors to 1, it display the error:

Screen Shot 2020-05-15 at 2 09 04 PM

and save the log to db:

Screen Shot 2020-05-15 at 2 09 43 PM

For saving same error to db, it uses interval for new record:

// config/autoload/mezzio-error-hero-module.local.php
<?php 

return [
    // ...
   'logging-settings' => [
        'same-error-log-time-range' => 86400,
    ],
    // ...
];

Please also check if cache is enabled.

If you have a persist issue, please provide a minimal reproducible repo or unit test.

samsonasik commented 4 years ago

I'm closing it. If you have a persist issue, please provide a minimal reproducible repo or unit test.