Created
September 17, 2015 16:17
-
-
Save lkacenja/2dc7efc08073a59b7902 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function twig_shutdown() { | |
$is_error = false; | |
if ($error = error_get_last()){ | |
switch($error['type']){ | |
case E_ERROR: | |
case E_CORE_ERROR: | |
case E_COMPILE_ERROR: | |
case E_USER_ERROR: | |
case E_PARSE: | |
$is_error = TRUE; | |
break; | |
} | |
} | |
if ($is_error) { | |
watchdog('twig', 'A fatal error occured. Clearing Twig caches now. ' . time()); | |
twig_clear_cache(); | |
drupal_goto($_GET['q']); | |
} | |
} | |
register_shutdown_function('twig_shutdown'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment