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

Use JSON_PARTIAL_OUTPUT_ON_ERROR when encoding JSON payload #96

Merged
merged 4 commits into from
Nov 11, 2019
Merged

Use JSON_PARTIAL_OUTPUT_ON_ERROR when encoding JSON payload #96

merged 4 commits into from
Nov 11, 2019

Conversation

bgraf-zlab
Copy link
Contributor

@bgraf-zlab bgraf-zlab commented Oct 21, 2019

This proposes a fix for #93,
where a recursive payload made the notification to fail because json_encode
returns null in that case.

Status

READY (imho)

Description

As stated in #93 , we have a problem with some exceptions that contain recursive references in their trance. Those cannot be json_encoded successfully, so json_encode silently returns null. Thus this exception won't be reported to the honeybadger backend.

Todos

  • Tests
  • Documentation
  • Changelog Entry (unreleased)

(I don't know

Steps to Test or Reproduce

I provided a test case in tests/HoneybadgerClientTest.php that covers that behaviour. Running that test without the fix fails.

> git pull --prune
> git checkout <branch>
> vendor/bin/phpunit

This proposes a fix for #93,
where a recursive payload made the notification to fail because `json_encode`
returns `null` in that case.
CHANGELOG.md Outdated
@@ -5,6 +5,10 @@ adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [2.0.1] - 2019-09-21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this heading and the blank line above it, keeping the "Unreleased" heading? We'll add in the appropriate heading at the time of release. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see, now I get it :-). Yes, sure!

I also wrote "Fixed" instead of "Changed" now, since this is more of a fix instead of a change in functionality.

@sixlive sixlive merged commit 8eeb061 into honeybadger-io:master Nov 11, 2019
sixlive pushed a commit to sixlive/honeybadger-php that referenced this pull request Nov 22, 2019
sixlive added a commit that referenced this pull request Dec 4, 2019
Use `JSON_PARTIAL_OUTPUT_ON_ERROR` when encoding JSON payload (#96)
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.

3 participants