Skip to content

Fix the json_decode() and json_validate() depth upper bound message - #25468

Closed
lacatoire wants to merge 2 commits into
php:PHP-8.4from
lacatoire:fix/json-depth-upper-bound-message-master
Closed

lacatoire wants to merge 2 commits into
php:PHP-8.4from
lacatoire:fix/json-depth-upper-bound-message-master

Conversation

@lacatoire

Copy link
Copy Markdown
Member

Both functions accept a $depth of INT_MAX but rejected larger values with
"must be less than 2147483647". Say "less than or equal to" instead.

To reproduce:

json_decode('[]', true, 2147483648);

Before:

ValueError: json_decode(): Argument #3 ($depth) must be less than 2147483647

After:

ValueError: json_decode(): Argument #3 ($depth) must be less than or equal to 2147483647

@LamentXU123

Copy link
Copy Markdown
Member

@lacatoire Can you please rebase this to 8.4 as what #24780 does? I will merge for you.

lacatoire and others added 2 commits November 16, 2026 14:32
Both functions accept a $depth of INT_MAX but rejected larger values with
"must be less than 2147483647". Say "less than or equal to" instead.
@lacatoire
lacatoire force-pushed the fix/json-depth-upper-bound-message-master branch from e584917 to e1930d6 Compare November 16, 2026 13:33
@lacatoire
lacatoire changed the base branch from master to PHP-8.4 November 16, 2026 13:33
LamentXU123 added a commit that referenced this pull request Nov 16, 2026
* PHP-8.6:
  Fix json_decode() and json_validate() depth upper bound messages (#25468)
kairosci pushed a commit to kairosci/php-src that referenced this pull request Nov 16, 2026
* PHP-8.4:
  Fix json_decode() and json_validate() depth upper bound messages (php#25468)
kairosci pushed a commit to kairosci/php-src that referenced this pull request Nov 16, 2026
* PHP-8.5:
  Fix json_decode() and json_validate() depth upper bound messages (php#25468)
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.

2 participants