Description
From an error.log report:
[22-Sep-2026 18:51:21 UTC] PHP Fatal error: Cannot redeclare example() (previously declared in D:\wamp\errors.php:11) in D:\wamp\errors.php on line 11
This ambiguous error has wasted a lot of developer's precious time. It tells us where the function is declared but it fails to tell us where the file is included a second time. This results in developers opting to use include_once() instead of include() and tracking down errors in logic.
A proper fix applied to the same scenario should result in the following error report:
[22-Sep-2026 18:51:21 UTC] PHP Fatal error: Cannot redeclare example() from D:\wamp\test.php:427 (previously declared in D:\wamp\errors.php:11) in D:\wamp\errors.php on line 11
PHP Version
Operating System
No response
Description
From an error.log report:
This ambiguous error has wasted a lot of developer's precious time. It tells us where the function is declared but it fails to tell us where the file is included a second time. This results in developers opting to use include_once() instead of include() and tracking down errors in logic.
A proper fix applied to the same scenario should result in the following error report:
PHP Version
Operating System
No response