Page 1 of 1

Syntax errors in classes fail to generate error messages

Posted: Tue Jul 27, 2010 1:38 am
by cpetercarter
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.

Re: Syntax errors in classes fail to generate error messages

Posted: Tue Jul 27, 2010 1:31 pm
by Jade
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

Posted: Tue Jul 27, 2010 3:19 pm
by Weirdan
This usually indicates that you're using shut-up operator (@) on the require() / include() call.

Re: Syntax errors in classes fail to generate error messages

Posted: Tue Jul 27, 2010 3:54 pm
by cpetercarter
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.