Closed
Description
Description
- Foo.php
<?php class Foo {}
- Foo2.php
<?php class Foo {}
- test.php
<?php include 'Foo.php'; include 'Foo2.php';
With these files, test.php gives this result:
PHP Fatal error: Cannot declare class Foo, because the name is already in use in /path/to/Foo2.php on line 2
This error message includes nothing about Foo.php
, which sometimes makes debugging hard.
It would be nice if the error message includes the file path and line number of previously declared class. Probably like this:
PHP Fatal error: Cannot declare class Foo, because the name is already in use (declared in /path/to/Foo.php on line 2) in /path/to/Foo2.php on line 2