> -----Original Message-----
> From: Yuchen Wang [mailto:phob...@gmail.com]
> Sent: Tuesday, May 22, 2012 10:19 PM
> To: php-general Maillist
> Subject: [PHP]How to handle E_ERROR,E_PARSE with a user defined function
>
> Hi all,
>
> How to handle E_ERROR,E_PARSE with a user defined function ?

Aren't these startup errors? I am not quite sure, but if the y can't be
handled with php.

This is from the PHP docs

"The following error types cannot be handled with a user defined function:
E_ERROR , E_PARSE , E_CORE_ERROR , E_CORE_WARNING , E_COMPILE_ERROR ,
E_COMPILE_WARNING , and most of E_STRICT raised in the file where
set_error_handler() is called.
If errors occur before the script is executed (e.g. on file uploads) the
custom error handler cannot be called since it is not registered at that
time."

So the only thing you can do is have a watchdog on your phperror.log  and
dosomething if these errors occur.

To preparse syntax errors you can use find and php -l

$ find . -name "*.php" -exec php -l {} \;
No syntax errors detected in ./bootstrap.php
No syntax errors detected in ./htdocs/index.php
No syntax errors detected in ./templates/comment.php
No syntax errors detected in ./templates/postform.php
No syntax errors detected in ./templates/blog.php
No syntax errors detected in ./templates/main.php
No syntax errors detected in ./templates/error.php
No syntax errors detected in ./templates/commentform.php
No syntax errors detected in ./templates/post.php
No syntax errors detected in ./classes/rendering/View.php
No syntax errors detected in ./classes/storage/SqliteStorage.php
No syntax errors detected in ./classes/storage/Storage.php
No syntax errors detected in ./classes/models/Blog.php
No syntax errors detected in ./classes/models/Comment.php
No syntax errors detected in ./classes/models/Post.php
No syntax errors detected in ./classes/models/Model.php
No syntax errors detected in ./classes/helper/HTMLResult.php
No syntax errors detected in ./classes/helper/Result.php
No syntax errors detected in ./classes/helper/ApplicationConfig.php
No syntax errors detected in ./classes/helper/ErrorHandler.php
No syntax errors detected in ./classes/helper/Request.php
No syntax errors detected in ./classes/helper/ExceptionHandler.php
No syntax errors detected in ./classes/helper/JSONResult.php
No syntax errors detected in ./classes/app/Router.php
No syntax errors detected in ./classes/controller/BlogController.php
No syntax errors detected in ./classes/controller/Controller.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to