|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
TakingSides Smarty Rookie
Joined: 11 Dec 2010 Posts: 30
|
Posted: Mon Aug 15, 2011 8:16 pm Post subject: Tracing, Error Logs and Exception Handling |
|
|
Hi,
I have created my own tracing methods which will write messages to a log file while PHP does not display any on-screen errors.
However, i cannot avoid the Smarty errors which are thrown, annoying the the E_NOTICE errors (which I don't like because it's bad practice)
I have tried setting the smarty error_reporting to 0.
I have created an .htaccess file inside Smarty/ directory with the following:
Code: | php_flag display_errors Off
php_flag error_reporting = 0 |
Could anyone help me Completely turn off ALL E_NOTICE warnings from smarty so it doesnt trigger my custom error_handler function.
Thanks,
Ash |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Aug 15, 2011 8:28 pm Post subject: |
|
|
You can tell Smarty a specific error level for templates:
Code: | $smarty->error_reporting = E_ALL & ~E_NOTICE; |
Let me know if that doesn't help get what you want. |
|
Back to top |
|
TakingSides Smarty Rookie
Joined: 11 Dec 2010 Posts: 30
|
Posted: Mon Aug 15, 2011 8:37 pm Post subject: |
|
|
Thanks dude,
Technically I don't want Smarty's templates (compiled or otherwise) to throw errors therefore I wanted them turned off. Having said that I do not see a big issue with E_WARNING/E_ERROR since this would suggest something serious has occured.
I do however wish to have full control of logging/tracing errors because I may one day wish to hold a separate log for Smarty errors/exceptions.
I simply added a condition:
Code: | function traceErrors( ... ) {
if (error_reporting() === 0)
return false;
|
Which is registered with....
Code: | set_error_handler('traceErrors'); |
Anyway, Thanks for your input I overlooked that way
-
Ash |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|