[php-src] Issue #16122: `ReflectionFunction::getNamespaceName()` is broken for closures with PHP8.4
| From: | takaram | Date: | Sun, 29 Sep 2024 15:49:47 +0000 |
| Subject: | [php-src] Issue #16122: `ReflectionFunction::getNamespaceName()` is broken for closures with PHP8.4 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247935@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/16122
Author: takaram
### Description
The following code:
```php
<?php
namespace Foo;
class Bar
{
public static function testClass(): \Closure
{
return function(){};
}
}
function testFunc(): \Closure
{
return function(){};
}
var_dump((new \ReflectionFunction(Bar::testClass()))->getNamespaceName());
var_dump((new \ReflectionFunction(testFunc()))->getNamespaceName());
```
Resulted in this output:
```
string(12) "{closure:Foo"
string(12) "{closure:Foo"
```
But I expected this output instead:
```
string(3) "Foo"
string(3) "Foo"
```
https://3v4l.org/QjjJK/rfc
### PHP Version
PHP 8.4.0
### Operating System
_No response_