-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
NormalizerFormatter skips some stacktraces #1736
Comments
…cktrace. This causes Monolog\Formatter\NormalizerFormatter to return normalized error without "trace" field at all. But code expects it. Fix of this behavior. Check monolog related issue - Seldaek/monolog#1736
…cktrace. This causes Monolog\Formatter\NormalizerFormatter to return normalized error without "trace" field at all. But code expects it. Fix of this behavior. Check monolog related issue - Seldaek/monolog#1736
I would rather not change the format, right now it normalizes to an array of file/line arrays. If you think you can fix it without changing the data type then please send a PR (or tell me how if you'd rather discuss first). |
@Seldaek I agree with you in general. I've found that sentry does the following with such errors.
So, we may assume that someone parses an array for file/line string elements. The only option is to use a semicolon as a delimiter. So, the option is to mimic this format not to break compatibility. Option 1. P.S. I missed to attach my test.php script. <?php
function shutdownFunction() {
$e = error_get_last();
$exception = new \ErrorException($e['message'], $e['type'], $e['type'], $e['file'], $e['line']);
var_dump($exception->getTrace());
}
class ErrorHandler {
public static function shutdownMethod() {
shutdownFunction();
}
}
function register($classOrNot = false) {
if ($classOrNot) {
register_shutdown_function([ErrorHandler::class, 'shutdownMethod']);
} else {
register_shutdown_function('shutdownFunction');
}
}
register(false);
$buffer = [];
while (true) {
$buffer[] = str_repeat('+', 1024);
} |
Id maybe do this as option 4 for methods but otherwise yes I like this idea:
|
For me ErrorHandler->methodName may be confusing if this is static method.
ErrorHandler.methodName is less confusing imho.
…On Sat, Jul 23, 2022, 09:52 Jordi Boggiano ***@***.***> wrote:
Id maybe do this as option 4 for methods but otherwise yes I like this
idea:
internal[ErrorHandler->shutdownMethod]:0
—
Reply to this email directly, view it on GitHub
<#1736 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAU6HW4TRSVV4EP2E5GRMLVVOJBPANCNFSM537ASDPA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sure, the point was just to avoid |
Monolog version 2|3
Check the function.
monolog/src/Monolog/Formatter/NormalizerFormatter.php
Lines 230 to 235 in 5579edf
PHP Fatal Error caught by
register_shutdown_function()
hastrace
field. Inside thistrace
field there can be few elements withoutfile
andline
fields.Here is an example:
Run this script and you will see the following output of the
$e->getTrace()
method:You may change
register(false)
toregister(true)
and check the results:All that records without
file
andline
will be skipped and engineer can't understand the full picture.If you agree with this I may provide PR.
The text was updated successfully, but these errors were encountered: