Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only the last parameter in a function call is allowed to use ... #7087

Closed
nazar-pc opened this issue May 22, 2016 · 2 comments
Closed

Only the last parameter in a function call is allowed to use ... #7087

nazar-pc opened this issue May 22, 2016 · 2 comments

Comments

@nazar-pc
Copy link
Contributor

HHVM Version

HipHop VM 3.14.0-dev (rel)
Compiler: heads/master-0-gd8285fbc906f340182a2a94b1fd0cf40787a40b9
Repo schema: 093188019b394a8a53aee6c073772c7db4ffc5e6

Standalone code, or other way to reproduce the problem

$foo = ['x', 'y', 'z'];
var_dump(...$foo, ...$foo);

Expected result

~> php index.php
string(1) "x"
string(1) "y"
string(1) "z"
string(1) "x"
string(1) "y"
string(1) "z"

Actual result

~> hhvm index.php

Fatal error: Only the last parameter in a function call is allowed to use ... in * on line *

There are 2 tests: hphp/test/slow/unpack_args/unpack_call_error.php and hphp/test/slow/unpack_args/unpack_call_multi.php, but they are both wrong, such usage is completely valid in PHP7

@nazar-pc
Copy link
Contributor Author

Submitted PR #7088, it seems to fix this strange incompatibility (looks like the one who implemented this was confused with only one ... use allowed in function declaration, while during call any number of unpacking arguments is allowed).

nazar-pc added a commit to nazar-pc/CleverStyle-Framework that referenced this issue May 24, 2016
@jesseschalken
Copy link
Contributor

This is a duplicate of #4940

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants