[php-src] Issue #20814: Error message of Class not found is incorrect when parent class is not defined or defined in other file
[email protected] (chopins)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
Issue: https://github.com/php/php-src/issues/20814
Author: chopins
### Description
1. when parent class is not defined:
The following code:
```php
<?php
new A;
class A extends B {
}
```
Resulted in this output:
```
Fatal error: Uncaught Error: Class "A" not found
```
But I expected this output instead:
```
Fatal error: Uncaught Error: Class "A" parent Class "B" not found
```
2. the parent class defined in other file:
In test2.php define class B:
```php
<?php
class B {}
```
In test.php extend class B:
```php
<?php
include_once 'test2.php';
new A;
class A extends B{
}
```
Resulted in this output:
```
Fatal error: Uncaught Error: Class "A" not found
```
But I expected this no Error be throwed
### PHP Version
```plain
PHP 8.3 and 8.4 and 8.5.0-dev
```
### Operating System
_No response_