[php-src] Issue #22324: ext/reflection: ReflectionParameter fails to load function with leading \
[email protected] (jorgsowa) Mon, 15 Jun 2026 22:20:01 +0000
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <QYGD6L4GtkGcmHqHKeJe03aZlE2hqq4ynYjqHewgZg8@main.internal.php.net> |
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_