eric1235711 Posted July 3, 2007 Share Posted July 3, 2007 Hello, I lost some time trying to find out a problem: when I included a file in my script, it showed a "Page not found" error. I discovered that the file I was including had another version of a class that is already set in my "common header include". well, my doubt is: "Why PHP didn't say that there were classes with the same name???" thanks in advance! Quote Link to comment Share on other sites More sharing options...
per1os Posted July 3, 2007 Share Posted July 3, 2007 What is your error reporting level set at? Quote Link to comment Share on other sites More sharing options...
eric1235711 Posted July 3, 2007 Author Share Posted July 3, 2007 error_reporting(E_ALL & ~E_NOTICE); the problem is that it shows the browser's "page not found" error message... try reproducing the error: create two files with class test{ function __construct(){ echo "ok"; } } you can change the methods and properties. and then include both in another file, or make one file include the other. Boom! "Page Not Found" LOL Quote Link to comment Share on other sites More sharing options...
trq Posted July 3, 2007 Share Posted July 3, 2007 What browser? IE Has a show friendly server error messages setting somewhere that is useless to devs. Quote Link to comment Share on other sites More sharing options...
per1os Posted July 3, 2007 Share Posted July 3, 2007 If I could try it I would, but no PHP on this box. Why are you including two classes of the same name anyways, that should at least throw an error. Maybe it is a bug in PHP5. I think PHP 4 would throw an error. If someone else has PHP 5 and wants to confirm it I Would suggest submitting a bug report. But either way you shouldn't have two classes named the same and included at the same time... Quote Link to comment Share on other sites More sharing options...
eric1235711 Posted July 3, 2007 Author Share Posted July 3, 2007 for sure, I can't have two classes with same name, but I find that PHP should throw an error.... Quote Link to comment Share on other sites More sharing options...
per1os Posted July 3, 2007 Share Posted July 3, 2007 http://bugs.php.net/report.php I would suggest reporting the bug if you cannot find it already being reported. But know that it could also be your configuration of apache or iis or even php. Test it in Firefox too just to see what happens, as thorpe said it could be a browser issue. Quote Link to comment Share on other sites More sharing options...
eric1235711 Posted July 3, 2007 Author Share Posted July 3, 2007 ok, later I'll see that Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted July 4, 2007 Share Posted July 4, 2007 Have you enabled display_errors? display_errors is turned off by defualt. If it is not enabled no errors will be shown during runtime. Turn display_errors on and it should display errors. Get the following error: Fatal error: Cannot redeclare class test in C:\Server\www\class.test.php on line 3 I did what you suggested to do for reproducing the error. class.test.php is the file that has the same class code as the file that is including class.test.php Quote Link to comment Share on other sites More sharing options...
eric1235711 Posted July 24, 2007 Author Share Posted July 24, 2007 I must check for that, thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.