Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

excluded errors are not excluded #96

Closed
4 tasks done
pschelte-extec opened this issue Jul 3, 2023 · 3 comments
Closed
4 tasks done

excluded errors are not excluded #96

pschelte-extec opened this issue Jul 3, 2023 · 3 comments

Comments

@pschelte-extec
Copy link

pschelte-extec commented Jul 3, 2023

What ZF/Expressive/Laminas/Mezzio application I'm using when issue happen ?

  • Laminas 3

What PHP version you're using?

  • PHP 8.1

What ErrorHeroModule version you're using?

  • ^5.0

What Database you're using?

  • Oracle 12

Expected behavior

I have added \E_DEPRECATED error as a value of the array 'exclude-php-errors' in the config file
so E_DEPRACATED errors should be ignored.

Actual behavior

E_DEPRECATED errors are still catched even if I have added \E_DEPRECATED error as a value of the array 'exclude-php-errors' in the config file.

Steps/Codes to reproduce the behavior

in \config\autoload\error-hero-module.global.php

        'exclude-php-errors' => [
            \E_USER_DEPRECATED,
            \E_DEPRECATED, // <--- add this
        ],

in index.php add this at the first beginning :

<?php $a = false; $a[] = 1;

execute index.php within your app in your browser.

the E_DEPRECATED error is catched by ErrorHeroModule.

@samsonasik
Copy link
Owner

That's expected as in index.php early line, the service is not loaded yet. This works on module level, you should not touch index.php with custom logic.

@pschelte-extec
Copy link
Author

You are probably right, but how can you explain that the deprecated error is logged in the DB by ErrorHeroModule and that the user friendly message provided by ErrorHeroModule is displayed instead of the usual basic PHP error ?

here is the message I have in my DB reported by ErrorHeroModule :

Automatic conversion of false to array is deprecated
/ec/prod/app/webroot/home/food/safety/food_waste/eu-food-loss-waste-prevention-hub/index.php 10 E_DEPRECATED

@samsonasik
Copy link
Owner

That's out of this module scope, again, this is on module level, index.php consume the module on this execution:

https://github.com/laminas/laminas-mvc-skeleton/blob/e4bfbffdd5c52b680f515fa4853efefd0bc6d7fa/public/index.php#L35-L36

this module doesn't covert error to message, it is for logging and trap purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants