public static function handleException(Exception $e, $encoding)
    {
        // PHPTAL's handler is only useful on fresh HTTP response
        if (PHP_SAPI !== 'cli' && !headers_sent()) {
            $old_exception_handler = set_exception_handler(array(new PHPTAL_ExceptionHandler($encoding), '_defaultExceptionHandler'));

            if ($old_exception_handler !== NULL) {
                restore_exception_handler(); // if there's user's exception handler, let it work
            }
        }
        throw $e; // throws instead of outputting immediately to support user's try/catch
    }
public static function handleException(Exception $e, $encoding)
    {
        // PHPTAL's handler is only useful on fresh HTTP response
        if (PHP_SAPI !== 'cli' && !headers_sent()) {
            $old_exception_handler = set_exception_handler(array(new PHPTAL_ExceptionHandler($encoding), '_defaultExceptionHandler'));

            if ($old_exception_handler !== NULL) {
                restore_exception_handler(); // if there's user's exception handler, let it work
            }
        }
        throw $e; // throws instead of outputting immediately to support user's try/catch
    }
public static function handleException ( Exception $ e , $ encoding ) { // PHPTAL's handler is only useful on fresh HTTP response if ( PHP_SAPI !== 'cli' && ! headers_sent ( ) ) { $ old_exception_handler = set_exception_handler ( array ( new PHPTAL_ExceptionHandler ( $ encoding ) , '_defaultExceptionHandler' ) ) ; if ( $ old_exception_handler !== NULL ) { restore_exception_handler ( ) ; // if there's user's exception handler, let it work } } throw $ e ; // throws instead of outputting immediately to support user's try/catch }
PHP's default exception handler allows error pages to be indexed and can reveal too much information,
so if possible PHPTAL sets up its own handler to fix this.

Doesn't change exception handler if non-default one is set.

@param Exception e exception to re-throw and display

@return void
@throws Exception
PHP s default exception handler allows error pages to be indexed and can reveal too much information so if possible PHPTAL sets up its own handler to fix this .