[php-src] PR #25486: Fix deeply nested valid JSON being reported as a syntax error

From: Date: Mon, 16 Nov 2026 13:48:52 +0000
Subject: [php-src] PR #25486: Fix deeply nested valid JSON being reported as a syntax error
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-40684@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25486 Author: lacatoire json_decode() and json_validate() reported "Syntax error" for valid JSON nested beyond the parser stack limit (about 5000 levels), even with $depth raised to its maximum, because bison's "memory exhausted" was turned into a syntax error. Report it as JSON_ERROR_DEPTH. To reproduce: ```php <?php $s = str_repeat('[', 5000) . str_repeat(']', 5000); var_dump(json_validate($s, 2147483647)); echo json_last_error_msg(), "\n"; ``` Before: bool(false), "Syntax error". After: bool(false), "Maximum stack depth exceeded".

« previous php.git-pulls (#40684) next »