Skip to content

SensitiveParameter doesn't work for named argument passing to variadic parameter #20435

@ndossche

Description

@ndossche

Description

I assume this is a bug but I'm not 100% sure. I could fix it probably but would need to get confirmation first.

The following code:

<?php

function foobar(#[\SensitiveParameter] ...$x) {
	var_dump($x);
	throw new Error;
}

foobar(0, a: 1);

Resulted in this output:

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

Fatal error: Uncaught Error in x.php:5
Stack trace:
#0 x.php(8): foobar(Object(SensitiveParameterValue), a: 1)
#1 {main}
  thrown in x.php on line 5

We see that the positional argument gets censored, but the named argument doesn't. I expect both of them to be censored because they both go to the $x variadic argument. Especially because if $x isn't variadic and we pass a named argument x then it does get censored.

PHP Version

8.3+

Operating System

Irrelevant

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions