|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2018-01-06 19:59 UTC] timok at ya dot ru
[2018-01-06 20:07 UTC] nikic@php.net
-Type: Bug
+Type: Feature/Change Request
-Package: Dynamic loading
+Package: Scripting Engine problem
[2018-01-06 20:07 UTC] nikic@php.net
[2018-01-12 17:44 UTC] nikic@php.net
[2018-01-12 17:44 UTC] nikic@php.net
-Status: Open
+Status: Closed
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 16 03:00:01 2025 UTC |
Description: ------------ When the base class of a dynamically loaded class is not found, PHP raises a fatal error instead of throwing an exception. Test script: --------------- <?php spl_autoload_register(function ($class_name) { if (file_exists(__DIR__ . "/{$class_name}.php")) { include __DIR__ . "/{$class_name}.php"; } }); // Following code throws an exception since CDE is not found try { $a = new CDE(); } catch (\Throwable $e) { echo 'CAUGHT CDE', PHP_EOL; } /* * Create ABC.php with an empty class ABC extending base class CDE * <?php class ABC extends CDE {} */ // Following code raises a fatal error since CDE (base class of ABC) is not found try { $a = new ABC(); } catch (\Throwable $e) { echo 'CAUGHT CDE', PHP_EOL; } Expected result: ---------------- CAUGHT CDE CAUGHT CDE Actual result: -------------- CAUGHT CDE PHP Fatal error: Class 'CDE' not found in /path/to/file/ABC.php on line 3 Fatal error: Class 'CDE' not found in /path/to/file/ABC.php on line 3