Skip to content

Closure created from magic method does not accept named arguments #11348

Closed
@danog

Description

@danog

Description

The following code:

<?php

class a {
	public function __call($name, $args) { var_dump($args); }
}
$a = new a;
$a->test(a: 123);
$a->test(...)(a: 123);

Resulted in this output:

array(1) {
  ["a"]=>
  int(123)
}
PHP Fatal error:  Uncaught Error: Unknown named parameter $a in /home/daniil/repos/MadelineProto/a.php:8
Stack trace:
#0 {main}
  thrown in /home/daniil/repos/MadelineProto/a.php on line 8

But I expected this output instead:

array(1) {
  ["a"]=>
  int(123)
}
array(1) {
  ["a"]=>
  int(123)
}

PHP Version

8.2.6

Operating System

Arch linux

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions