Handle PHP build error

Asked

Viewed 32 times

1

I am developing a web system in PHP with MVC and Smarty. But I am having the following problem. My system when entering an Exception it automatically opens a call already with the error (inserts a value in a table responsible for the call). The problem starts there, build error does not enter any Exception. For example:

    <?php
        $a = 1;
        a
        echo $a;
    ?>

Note that there is a loose letter there, I get the following message:

Parse error: syntax error, unexpected 'echo' (T_ECHO) in...

I already use these two functions to catch PHP errors:

set_exception_handler('myException');
set_error_handler('myHandler',E_ALL);

I have already implemented classes that inherit the class Exception to handle errors. Nothing else to solve this problem.

  • 1

    See if that answer helping.

  • For reference (English) http://stackoverflow.com/q/13378959/194717

  • 2

    Thank you very much Papa Chalie, helped me a lot, that’s just what I needed.

  • @Pedrosoares, some errors cannot be captured by set_error_handler, therefore the use of shutdown to capture what 'remains'. Take a look at this reference.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.