The `errorLoggingLevel` config option doesn't respect the error suppression operator
imjoehaines opened this issue · 3 comments
By default, PsySH will report errors that should be suppressed with the @
operator. For example, the following code should only report a warning on line 2 (see https://3v4l.org/ZGeLF):
@preg_match('not a regex', '');
preg_match('not a regex', ''); // => Warning: preg_match(): ...
However, when run in PsySH both lines report the same warning
When Shell::handleError
is called while @
is being used, the error_reporting
level will not contain the $errno
because PHP will automatically remove most error types from error_reporting
. The same doesn't happen for the custom errorLoggingLevel
because PHP has no knowledge of it, so $errno
will always be contained in the errorLoggingLevel
and therefore this check will always pass:
Lines 1302 to 1304 in cbb33ba
This can be worked around by setting PsySH's errorReportingLevel
to 0
so only the built-in error_reporting
level is used, but it's unfortunate that the default behaviour will log errors when they should be suppressed
Thanks for reporting! This has been fixed and will go out in the next release.
Thanks for the quick fix!
No problem :)