[php-src] Issue #13097: Anonymous class reference in trigger_error
| From: | henzeb | Date: | Tue, 09 Jan 2024 08:53:16 +0000 |
| Subject: | [php-src] Issue #13097: Anonymous class reference in trigger_error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246198@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13097
Author: henzeb
### Description
The following code is a bug since the introduction of anonymous classes in PHP 7.0:
https://3v4l.org/0OTZ9#v7.0.0 // for reference
https://3v4l.org/0OTZ9#v8.3.1
```php
<?php
$anonymous = new class(){};
echo get_class($anonymous).': now you see me...';
trigger_error(
get_class($anonymous).' ...now you don\'t!',
E_USER_ERROR
);
```
Resulted in this output:
```
class@anonymous/in/0OTZ9:3$0: now you see me...
Fatal error: class@anonymous in /in/0OTZ9 on line 7
Process exited with code 255.
```
But I expected this output instead:
```
class@anonymous/in/0OTZ9:3$0: now you see me...
Fatal error: class@anonymous ... now you don't in /in/0OTZ9 on line 7
Process exited with code 255.
```
### PHP Version
PHP 8.3.1
### Operating System
_No response_