## Category `stdlib` · **php-src-strict** ## Problem `round()` third argument cannot accept `PHP_ROUND_HALF_*` named constants at runtime—the VM passes `null` and throws: ``` TypeError: round(): Argument #3 ($mode) must be of type RoundingMode|int, null given ``` | Call | Zend | VM today | |------|------|----------| | `round(2.5, 0, PHP_ROUND_HALF_UP)` | `3.0` | `TypeError` | | `round(2.5, 0, PHP_ROUND_HALF_DOWN)` | `2.0` | `TypeError` | | `round(3.5, 0, PHP_ROUND_HALF_EVEN)` | `4.0` | `TypeError` | Same class of bug as **#9278** / **#9429** (inline `SORT_*` flags)—builtin arg lowering does not resolve core PHP constants to integers. ## php-src reference - [php/php-src `ext/standard/math.c`](https://github.com/php/php-src/blob/master/ext/standard/math.c) — `zif_round`, `PHP_ROUND_HALF_*` handling ## Repro ```bash ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_round_php_round_half.php' php bin/vm.php test/repro/maintainer_gap_round_php_round_half.php ``` ## Implementation hints (PHP-in-PHP) - `ext/standard/round.php` + shared constant folding for builtin int args (same helper path as sort flags) - `ext/standard/JitRound.php` if JIT lowers mode separately - PHP 8.4+ `RoundingMode` enum cases should also work when passed by name ## Done when - [ ] Repro script matches Zend - [ ] `round(2.5, 0, PHP_ROUND_HALF_UP)` → `3.0` under VM - [ ] Compliance guard added - [ ] JIT/AOT round mode agrees ## Related - **#9278**, **#9429** — SORT_* constant binding pattern - **#9438** — number_format RoundingMode (PHP 8.4) - North star **#1492**
Category
stdlib· php-src-strictProblem
round()third argument cannot acceptPHP_ROUND_HALF_*named constants at runtime—the VM passesnulland throws:round(2.5, 0, PHP_ROUND_HALF_UP)3.0TypeErrorround(2.5, 0, PHP_ROUND_HALF_DOWN)2.0TypeErrorround(3.5, 0, PHP_ROUND_HALF_EVEN)4.0TypeErrorSame class of bug as #9278 / #9429 (inline
SORT_*flags)—builtin arg lowering does not resolve core PHP constants to integers.php-src reference
ext/standard/math.c—zif_round,PHP_ROUND_HALF_*handlingRepro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_round_php_round_half.php' php bin/vm.php test/repro/maintainer_gap_round_php_round_half.phpImplementation hints (PHP-in-PHP)
ext/standard/round.php+ shared constant folding for builtin int args (same helper path as sort flags)ext/standard/JitRound.phpif JIT lowers mode separatelyRoundingModeenum cases should also work when passed by nameDone when
round(2.5, 0, PHP_ROUND_HALF_UP)→3.0under VMRelated