opcodesio / log-viewer

Fast and beautiful Log Viewer for Laravel
https://log-viewer.opcodes.io
MIT License
3.49k stars 250 forks source link

Context bug - PCRE JIT Stack Limit issue with large JSON contexts #369

Closed essell closed 4 months ago

essell commented 4 months ago

I discovered a silent failure that causes contexts to not be parsed properly in Laravel logs. This happens particularly when you are logging request/response objects from REST APIs and the JSON gets fairly large.

The preg_last_error_msg() is "JIT stack limit"

This is due to PHP relying on the PCRE JIT library which has a stack limit, mostly due to it not using POSIX threads. The regex used to match JSON is highly recursive (and has to be, to work).

I intend to create a pull request to fix this issue, which forgoes using preg to match json from log text. It will maintain the ability to parse out multiple contexts.

arukompas commented 4 months ago

hey @essell , thanks for the fix! Tagged v3.9.0

essell commented 4 months ago

Of course! Thanks for this project.