bug #37912 [ExpressionLanguage] fix passing arguments to call_user_func_array() on PHP 8 (xabbuh)

This PR was merged into the 3.4 branch.

Discussion
----------

[ExpressionLanguage] fix passing arguments to call_user_func_array() on PHP 8

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

a55ce7c8bb fix passing arguments to call_user_func_array() on PHP 8
This commit is contained in:
Fabien Potencier 2020-08-21 18:53:32 +02:00
commit 2abf876260

View File

@ -86,7 +86,13 @@ class GetAttrNode extends Node
throw new \RuntimeException(sprintf('Unable to call method "%s" of object "%s".', $this->nodes['attribute']->attributes['value'], \get_class($obj)));
}
return \call_user_func_array($toCall, $this->nodes['arguments']->evaluate($functions, $values));
$arguments = $this->nodes['arguments']->evaluate($functions, $values);
if (\PHP_VERSION_ID >= 80000) {
$arguments = array_values($arguments);
}
return \call_user_func_array($toCall, $arguments);
case self::ARRAY_CALL:
$array = $this->nodes['node']->evaluate($functions, $values);