Skip to content

json: Store errors in a structured fashion#22421

Merged
TimWolla merged 1 commit into
php:masterfrom
TimWolla:json-error-position-handling
Jun 25, 2026
Merged

json: Store errors in a structured fashion#22421
TimWolla merged 1 commit into
php:masterfrom
TimWolla:json-error-position-handling

Conversation

@TimWolla

Copy link
Copy Markdown
Member

This will make it both easier to consume the error information and reduce the chance for mistakes when settings errors, because not every field will need to be set manually.

The functions that have been removed as part of this change were added in master only, thus removing those is not an API change between the latest stable (PHP 8.5) and this PR.

Fixes #22420.

This will make it both easier to consume the error information and reduce the
chance for mistakes when settings errors, because not every field will need to
be set manually.

The functions that have been removed as part of this change were added in
master only, thus removing those is not an API change between the latest stable
(PHP 8.5) and this PR.

Fixes php#22420.
@TimWolla TimWolla force-pushed the json-error-position-handling branch from c261ab5 to 205cd4b Compare June 24, 2026 09:25

@Girgias Girgias left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Makes sense to me, just a minor nit.

Comment thread ext/json/php_json.h
@ndossche ndossche self-requested a review June 25, 2026 07:12

@ndossche ndossche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Much cleaner

@TimWolla TimWolla merged commit cd80e3e into php:master Jun 25, 2026
18 checks passed
@TimWolla TimWolla deleted the json-error-position-handling branch June 25, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

json_encode() errors don't clear the error position

3 participants