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

GelfMessageFormatter and content/extra as numeric array #1932

Open
pmiroslawski opened this issue Dec 20, 2024 · 1 comment
Open

GelfMessageFormatter and content/extra as numeric array #1932

pmiroslawski opened this issue Dec 20, 2024 · 1 comment
Labels

Comments

@pmiroslawski
Copy link

Monolog version 3.8.1

GelfMessageFormatter::format throws an exception if any of the context or extra properties in the LogRecord argument contains a numeric array..

Exception:

preg_replace(): Argument #3 ($subject) must be of type array|string, int given

Thats of course due to strict_types=1 and this:
https://github.com/Seldaek/monolog/blob/main/src/Monolog/Formatter/GelfMessageFormatter.php#L118
https://github.com/Seldaek/monolog/blob/main/src/Monolog/Formatter/GelfMessageFormatter.php#L130

I'm not sure if this type of message is what you expected to receive, but some libraries, like the Elasticsearch client, send messages like this. Therefore, the logger shouldn't throw an exception in such cases.

@ybelenko
Copy link

ybelenko commented Dec 24, 2024

Mentioned and described TypeError in #1927

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

No branches or pull requests

2 participants