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

Fix JSON formatting of resource type #1410

Closed
wants to merge 1 commit into from

Conversation

theravel
Copy link
Contributor

I think it is well-known that json_encode does not handle variables of resource type properly. Easiest example is:

php -r "var_dump(json_encode(['test' => curl_init()]));" 
// returns bool(false)

JsonFormatter of Monolog is affected as well, so it returns empty line if there is a resource in "context".

This pull request leverages already existing code from NormalizerFormatter to convert resources to sprintf('[resource(%s)]', get_resource_type($data)).

@Seldaek Seldaek closed this in 9621075 Dec 20, 2019
@Seldaek
Copy link
Owner

Seldaek commented Dec 20, 2019

Thanks, merged in 1.x & master

@Seldaek Seldaek added this to the 1.x milestone Dec 20, 2019
@Seldaek Seldaek added the Bug label Dec 20, 2019
@lyrixx lyrixx mentioned this pull request Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants