## Category `stdlib` · **php-src-strict** ## Problem php-src names `random_int()` parameters **`min`** and **`max`**. Zend accepts: ```php random_int(min: 1, max: 3); // int in [1,3] ``` VM rejects with `Unknown named parameter $min`. Positional `random_int(1, 3)` works. ## php-src reference - [php/php-src `ext/random/random.c`](https://github.com/php/php-src/blob/master/ext/random/random.c) — `php_random_int` - [php/php-src `ext/random/random.stub.php`](https://github.com/php/php-src/blob/master/ext/random/random.stub.php) — `min`, `max` parameter names - Named binding: [php/php-src `Zend/zend_compile.c`](https://github.com/php/php-src/blob/master/Zend/zend_compile.c) ## Repro (failure today) ```php <?php echo random_int(min: 1, max: 3), "\n"; ``` ```bash ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh php repro.php php bin/vm.php repro.php # VM: Unknown named parameter $min ' ``` | Call | Zend PHP 8.2+ | VM today | |------|---------------|----------| | `random_int(min: 1, max: 3)` | int in range | fatal ❌ | | positional | int in range | int in range ✅ | ## Scope (this repo) | Path | Work | |------|------| | `patches/php-types*.patch` / builtin arginfo | Export `min`/`max` for `random_int` | | `lib/Compiler.php`, `lib/VM/NamedArgs.php`, `lib/JIT/NamedArgs.php` | Named binding | | `ext/standard/random_int.php` (or random module) | handler after arg wiring | | Tests | `test/compliance/cases/stdlib/random_int_named.phpt` | **PHP-in-PHP first** — no new `runtime/*.c`. ## Done when - [ ] Repro runs without fatal; result in `[1,3]` on VM - [ ] `max < min` still throws `ValueError` like Zend - [ ] `./script/docker-exec.sh -- vendor/bin/phpunit --filter random_int_named` green ## Related - **#3295** mt_rand parity · **#10013** hash_hmac named · **#1492**
Category
stdlib· php-src-strictProblem
php-src names
random_int()parametersminandmax. Zend accepts:VM rejects with
Unknown named parameter $min. Positionalrandom_int(1, 3)works.php-src reference
ext/random/random.c—php_random_intext/random/random.stub.php—min,maxparameter namesZend/zend_compile.cRepro (failure today)
random_int(min: 1, max: 3)Scope (this repo)
patches/php-types*.patch/ builtin arginfomin/maxforrandom_intlib/Compiler.php,lib/VM/NamedArgs.php,lib/JIT/NamedArgs.phpext/standard/random_int.php(or random module)test/compliance/cases/stdlib/random_int_named.phptPHP-in-PHP first — no new
runtime/*.c.Done when
[1,3]on VMmax < minstill throwsValueErrorlike Zend./script/docker-exec.sh -- vendor/bin/phpunit --filter random_int_namedgreenRelated