[php-src] Issue #20814: Error message of Class not found is incorrect when parent class is not defined or defined in other file

From: Date: Wed, 31 Dec 2025 05:22:04 +0000
Subject: [php-src] Issue #20814: Error message of Class not found is incorrect when parent class is not defined or defined in other file
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251454@lists.php.net to get a copy of this message
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_

« previous php.bugs (#251454) next »