I have recently encountered a most puzzling problem.
I am working on the development of a CMS for podcasting. The initialisation script of my code switches full error reporting on, for obvious reasons. So whenever I make a silly syntax error, the script tells me about it, with one of php's wonderfully helpful error messages.
But if I make a syntax error inside a class, all I get is a blank screen - no error message. The problem relates only to parse errors - if there is a runtime problem, I get error messages in the normal way. I have adopted the policy of reloading and running the script after every tiny change so that I can quickly identify the problem when I get a blank screen. However, this is tedious, and if anyone has any thoughts on why I am not getting normal error messages and what I can do about it, I would be pleased to know.
Syntax errors in classes fail to generate error messages
Moderator: General Moderators
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: Syntax errors in classes fail to generate error messages
Do you have error reporting turned on in your .ini file or at the top of the page? If you're putting the error_reporting(E_ALL); at the top of the page try putting it in the class files too.
Re: Syntax errors in classes fail to generate error messages
This usually indicates that you're using shut-up operator (@) on the require() / include() call.
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: Syntax errors in classes fail to generate error messages
Thanks. I have identified the problem as a "@" in the __autoload() function. I must have put it there months ago, thinking that it would suppress error messages if the file did not exist, and forgetting that it would also suppress messages about parse errors in the included file.