diff --git a/ext/standard/JitUnpack.php b/ext/standard/JitUnpack.php index 0d03603fa02..a73145492dd 100644 --- a/ext/standard/JitUnpack.php +++ b/ext/standard/JitUnpack.php @@ -25,7 +25,7 @@ public static function unpack(Context $context, JITVariable ...$args): Value $data = JitStringBuiltinArg::lower($context, $args[1], 'unpack', 1, 'string'); $offset = $context->getTypeFromString('int64')->constInt(0, false); if (3 === $argc) { - $offset = JitSleep::zParamLong($context, $args[2], 'unpack', 3, 'offset'); + $offset = JitIntdiv::lowerIntBuiltinArgForCaller($context, $args[2], 'unpack', 3, 'offset'); } $slot = JitValueBox::alloc($context); diff --git a/ext/standard/unpack.php b/ext/standard/unpack.php index 5e0d08da531..94bce8021c4 100644 --- a/ext/standard/unpack.php +++ b/ext/standard/unpack.php @@ -26,7 +26,7 @@ public function execute(Frame $frame): void $data = VmString::coerceStringBuiltinArg($frame->calledArgs[1], 'unpack', 1, 'string'); $offset = 0; if (3 === $argc) { - $offset = VmMath::parseIntBuiltinArg($frame->calledArgs[2], 'unpack', 3, 'offset'); + $offset = VmMath::parseIntBuiltinArgForFrame($frame, 2, 'unpack', 3, 'offset'); $dataLen = \strlen($data); if ($offset < 0 || $offset > $dataLen) { throw new \ValueError('unpack(): Argument #3 ($offset) must be contained in argument #2 ($data)'); diff --git a/test/repro/maintainer_gap_unpack_strict_float_offset.php b/test/repro/maintainer_gap_unpack_strict_float_offset.php new file mode 100644 index 00000000000..3aa340201f0 --- /dev/null +++ b/test/repro/maintainer_gap_unpack_strict_float_offset.php @@ -0,0 +1,16 @@ +getMessage(), 'unpack(): Argument #3 ($offset) must be of type int, float given')) { + fwrite(STDERR, 'unexpected message: '.$e->getMessage()."\n"); + exit(1); + } +} + +echo "ok\n";