Now I get a lot of crap catched :) For example: fopen(/mnt/home/sasas/www/auto/application/controllers/ImagesController.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /mnt/home/sasas/www/Zend/Loader.php #165.
which is ok, but this: fopen(/mnt/home/sasas/www/auto/application/views/helpers/FormLabel.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /mnt/home/sasas/www/Zend/Loader.php #165. fopen(/mnt/home/sasas/www/auto/application/views/helpers/FormLabel.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /mnt/home/sasas/www/Zend/Loader.php #165. fopen(/mnt/home/sasas/www/auto/application/views/helpers/FormSelect.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /mnt/home/sasas/www/Zend/Loader.php #165. fopen(/mnt/home/sasas/www/auto/application/views/helpers/FormButton.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /mnt/home/sasas/www/Zend/Loader.php #165. fopen(/mnt/home/sasas/www/auto/application/views/helpers/FormButton.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /mnt/home/sasas/www/Zend/Loader.php #165. fopen(/mnt/home/sasas/www/auto/application/views/helpers/Form.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /mnt/home/sasas/www/Zend/Loader.php #165. fopen(/mnt/home/sasas/www/auto/application/views/helpers/Form.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /mnt/home/sasas/www/Zend/Loader.php #165. fopen(/mnt/home/sasas/www/auto/application/views/helpers/Layout.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /mnt/home/sasas/www/Zend/Loader.php #165. fopen(/mnt/home/sasas/www/auto/application/views/helpers/Layout.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /mnt/home/sasas/www/Zend/Loader.php #165. which is strange, why loader looks for helpers in my helpers path, and not in zf library first? Regards, Saša Stamenković On Mon, Sep 28, 2009 at 1:08 PM, Саша Стаменковић <umpir...@gmail.com>wrote: > Nice answer Grecki, thanks. > require_once 'controllers/ErrorController.php'; > set_error_handler(array('ErrorController', 'phpError')); > > fixed problem. Strange :) > > Regards, > Saša Stamenković > > > > On Mon, Sep 28, 2009 at 1:03 PM, Karol Grecki <kgre...@gmail.com> wrote: > >> >> If you named your functions differently you need to modify the code >> accordingly. >> Also, make sure that this class is actually loaded or can be loaded with >> autoloader before you try to use it and register the error handler. >> >> Regards >> Karol >> >> >> >> umpirsky wrote: >> > >> > *Warning*: set_error_handler() expects the argument >> > (ErrorController::phpError) to be a valid callback in * >> > /mnt/home/sasas/www/auto/application/Bootstrap.php* on line *16* >> > >> > Regards, >> > Saša Stamenković >> > >> > >> > On Mon, Sep 28, 2009 at 12:29 PM, Karol Grecki <kgre...@gmail.com> >> wrote: >> > >> >> >> >> Try this, it works for me. >> >> >> >> class X_Error_Handler >> >> { >> >> public static function handle($errno, $errstr, $errfile, $errline) >> >> { >> >> //this allows error suppression in 3rd party code to work >> >> if (!error_reporting()) return; >> >> >> >> throw new X_RuntimeException($errstr . " in $errfile:$errline", >> >> $errno); >> >> } >> >> >> >> public static function set() >> >> { >> >> set_error_handler(array(__CLASS__, 'handle')); >> >> } >> >> } >> >> >> >> Then you call X_Error_Handler::set() in your bootstrap and built in php >> >> errors will bubble up to error controller as exceptions. >> >> Bear in mind there are some limitation to it, like fatal errors cannot >> be >> >> handled this way and not everything can be captured in the error >> >> controller. >> >> You need a try-catch block around your whole dispatch loop to catch >> >> errors >> >> in plugins etc. >> >> >> >> Regards >> >> Karol >> >> >> >> >> >> umpirsky wrote: >> >> > >> >> > I'm trying to do this with set_error_handler(), my will is to trigger >> >> > Error >> >> > controller and catch this as application error, since I want to log >> all >> >> > errors in one place - Error controller. >> >> > I tried with setting error handler in bootstrap to function in >> >> index.php >> >> > and >> >> > that function calls error controller statically, but no success. >> There >> >> > must >> >> > be some easy way to do this. >> >> > >> >> > Anyone know? >> >> > >> >> > Regards, >> >> > Saša Stamenković >> >> > >> >> > >> >> >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/Turn-PHP-errors-warnings-notices-into-exceptions-tp25591556p25643507.html >> >> Sent from the Zend Framework mailing list archive at Nabble.com. >> >> >> >> >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Turn-PHP-errors-warnings-notices-into-exceptions-tp25591556p25643850.html >> Sent from the Zend Framework mailing list archive at Nabble.com. >> >> >