An unpacked call carries a single Node\Arg regardless of its runtime
arity, so the arity check alone still accepted intval(...$args) as a
single-argument Native conversion and lowered the array itself:
intval(...['ff', 16]) // php::toInt(withBase) -> int(1)
strval(...['42']) // php::toString(single) -> "Array" + warning
A named argument has the same shape and need not be the value being
converted: intval(bogus: 1) must raise "Unknown named parameter", not
fold to a cast of 1.
Reject both in dispatchConversion() so the runtime determines the
expanded arity and the parameter names, matching what
dispatchFuncCall() already does for every other builtin.
master
parent
93909274e2
commit
c291d79703
4 changed files with 68 additions and 1 deletions
@ -0,0 +1,21 @@ |
||||
<?php |
||||
/** |
||||
* This file is part of TypePHP(AOT). |
||||
* |
||||
* @link https://www.swoole.com/aot/ |
||||
* @contact service@swoole.com |
||||
*/ |
||||
|
||||
function main(): void |
||||
{ |
||||
$withBase = ['ff', 16]; |
||||
$single = ['42']; |
||||
|
||||
var_dump(intval(...$withBase)); |
||||
var_dump(intval(...$single)); |
||||
var_dump(strval(...$single)); |
||||
var_dump(floatval(...$single)); |
||||
var_dump(boolval(...$single)); |
||||
var_dump(intval('ff', ...[16])); |
||||
var_dump(intval(value: '42')); |
||||
} |
||||
Loading…
Reference in new issue