Category
stdlib
Status (refreshed 2026-06-07 — implementation-ready)
Phase 0 landed: json_validate() is registered in ext/standard/Module.php; VM returns true/false for valid/invalid JSON via VmJsonScanner / ext/standard/json_validate.php.
Remaining gaps (worker targets):
Problem
PHP 8.3 added json_validate(string $json, int $depth = 512, int $flags = 0): bool. Phase 0 exists; behavior must match php-src for depth/ValueError and strict operand guards.
php-src reference
Repro (verify today)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "var_export(json_validate(\"{\\\"a\\\":1}\")); echo PHP_EOL; var_export(json_validate(\"{\")); echo PHP_EOL;"
php bin/vm.php -r "var_export(json_validate(str_repeat(\"{\", 600)));" 2>&1 | head -1
'
| Check |
Zend PHP 8.3+ |
VM (2026-06-07) |
json_validate('{"a":1}') |
true |
true ✅ |
json_validate('{') |
false |
false ✅ |
| depth exceeded |
ValueError |
verify / fix if diverges |
Scope (this repo)
| Path |
Work |
ext/standard/json_validate.php |
Depth limit + flags (#4085) |
ext/standard/VmJsonScanner.php |
Shared scanner with json_decode |
| JIT |
lib/JIT/Builtin/StringJson*.php when required |
| Tests |
test/compliance/cases/stdlib/json_validate*.phpt |
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter json_validate'
Related
Category
stdlibStatus (refreshed 2026-06-07 — implementation-ready)
Phase 0 landed:
json_validate()is registered inext/standard/Module.php; VM returnstrue/falsefor valid/invalid JSON viaVmJsonScanner/ext/standard/json_validate.php.Remaining gaps (worker targets):
$flagsargument parity (phase 2)TypeError(php-src-strict)Problem
PHP 8.3 added
json_validate(string $json, int $depth = 512, int $flags = 0): bool. Phase 0 exists; behavior must match php-src for depth/ValueErrorand strict operand guards.php-src reference
ext/json/json.c—PHP_FUNCTION(json_validate),php_json_validate_exRepro (verify today)
json_validate('{"a":1}')truetrue✅json_validate('{')falsefalse✅ValueErrorScope (this repo)
ext/standard/json_validate.phpext/standard/VmJsonScanner.phpjson_decodelib/JIT/Builtin/StringJson*.phpwhen requiredtest/compliance/cases/stdlib/json_validate*.phptDone when
ValueErrormatches Zend$flagssubset documented + tested (Stdlib: json_validate() — flags argument parity (phase 2 of #3101) #4085)TypeErrorunder php-src-strict (Stdlib: json_validate()/preg_split()/preg_grep()/preg_quote() — enum operands must TypeError not LogicException (php-src-strict) #5999)Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter json_validate'Related