diff --git a/tests/compiler/array/array-push-empty-unpack.phpt b/tests/compiler/array/array-push-empty-unpack.phpt new file mode 100644 index 00000000..a82e7656 --- /dev/null +++ b/tests/compiler/array/array-push-empty-unpack.phpt @@ -0,0 +1,24 @@ +--TEST-- +array_push retains its required array argument when an unpacked list is empty +--FILE-- + +--EXPECT-- +array(0) { +} +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} diff --git a/tests/compiler/closure/static-closure-delayed-callback.phpt b/tests/compiler/closure/static-closure-delayed-callback.phpt new file mode 100644 index 00000000..5bcda510 --- /dev/null +++ b/tests/compiler/closure/static-closure-delayed-callback.phpt @@ -0,0 +1,45 @@ +--TEST-- +static closure created in an instance method remains a valid delayed callback +--FILE-- +callback = $callback; + } + + public function invoke(): mixed + { + return ($this->callback)(); + } +} + +final class CallbackFactory +{ + public function create(): CallbackHolder + { + return new CallbackHolder( + static function (): never { + throw new LogicException('expected callback'); + }, + ); + } +} + +function main(): void +{ + $callback = (new CallbackFactory())->create(); + + try { + $callback->invoke(); + } catch (LogicException $error) { + echo $error->getMessage(), "\n"; + } +} +?> +--EXPECT-- +expected callback