[php-src] Issue #9420: Native parameter attributes may not be used on promoted properties
| From: | TimWolla | Date: | Wed, 24 Aug 2022 20:06:52 +0000 |
| Subject: | [php-src] Issue #9420: Native parameter attributes may not be used on promoted properties | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242303@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9420
Author: TimWolla
### Description
The following code:
```php
<?php
class Foo {
public function __construct(
#[SensitiveParameter]
public string $password
)
{
throw new \Exception('foo');
}
}
new Foo('bar');
```
Resulted in this output:
```
Fatal error: Attribute "SensitiveParameter" cannot target property (allowed targets:
parameter) in php-src/test.php on line 4
```
But I expected this output instead:
```
Fatal error: Uncaught Exception: foo in php-src/test.php:9
Stack trace:
#0 php-src/test.php(13): Foo->__construct(Object(SensitiveParameterValue))
#1 {main}
thrown in /tmp/php-src/test.php on line 9
```
### PHP Version
Current git master
### Operating System
_No response_