[php-src] Issue #22324: ext/reflection: ReflectionParameter fails to load function with leading \
| From: | jorgsowa | Date: | Mon, 15 Jun 2026 22:20:01 +0000 |
| Subject: | [php-src] Issue #22324: ext/reflection: ReflectionParameter fails to load function with leading \ | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-252203@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/22324
Author: jorgsowa
### Description
The following code:
```php
<?php
function demo(string $arg) {}
$p = new ReflectionParameter("\\demo", 0);
var_dump($p->getName());
$p = new ReflectionParameter("demo", 0);
var_dump($p->getName());
```
Resulted in this output:
```
Fatal error: Uncaught ReflectionException: Function \demo() does not exist in /in/a4prG:5
Stack trace:
#0 /in/a4prG(5): ReflectionParameter->__construct('\\demo', 0)
#1 {main}
thrown in /in/a4prG on line 5
```
But I expected this output instead:
```
string(3) "arg"
string(3) "arg"
```
### PHP Version
```plain
master
```
### Operating System
_No response_