Category
stdlib · php-src-strict
Problem
Under declare(strict_types=1), token_name(null) must TypeError on int $id. VM coerces via toInt() (null→0) and returns 'UNKNOWN'.
| Repro |
Zend 8.2.32 (2026-08-16) |
VM (2026-08-16) |
declare(strict_types=1); token_name(null) |
TypeError: token_name(): Argument #1 ($id) must be of type int, null given |
'UNKNOWN' |
Distinct from closed Reflection name drift (#23658) and AOT runtime-int (#27278). Reflection still leaves $id untyped on VM (optional follow-up).
php-src reference
PHP implementation target
ext/tokenizer/token_name.php — replace bare toInt() with InternalStrictArg / shared int-arg guard under strict_types; ext/tokenizer/JitTokenName.php / JitLongArg must TypeError on null (not coerce); no new runtime/*.c
Repro
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_token_name_null.php'
# expect TypeError (match host `php test/repro/maintainer_gap_token_name_null.php`)
<?php
declare(strict_types=1);
token_name(null);
Done when
Category
stdlib· php-src-strictProblem
Under
declare(strict_types=1),token_name(null)mustTypeErroronint $id. VM coerces viatoInt()(null→0) and returns'UNKNOWN'.declare(strict_types=1); token_name(null)TypeError: token_name(): Argument #1 ($id) must be of type int, null given'UNKNOWN'Distinct from closed Reflection name drift (#23658) and AOT runtime-int (#27278). Reflection still leaves
$iduntyped on VM (optional follow-up).php-src reference
ext/tokenizer/tokenizer.c—PHP_FUNCTION(token_name)ext/tokenizer/tokenizer.stub.php—token_name(int $id): stringPHP implementation target
ext/tokenizer/token_name.php— replace baretoInt()withInternalStrictArg/ shared int-arg guard understrict_types;ext/tokenizer/JitTokenName.php/JitLongArgmust TypeError on null (not coerce); no newruntime/*.cRepro
Done when
strict_types,token_name(null)→TypeError: … Argument #1 ($id) must be of type int, null given(VM + JIT/AOT when in scope)'UNKNOWN'for this casetest/compliance/cases/or targeted PHPUnit