diff --git a/apartados.php b/apartados.php index f1316df..b98ec3b 100755 --- a/apartados.php +++ b/apartados.php @@ -25,7 +25,7 @@ if (!@$apartado) { include "footer.php"; $resultInclude = ob_get_clean(); - if (strpos($resultInclude,".php on line ") === false){ + if (detect_error_on_code($resultInclude) === false){ echo $resultInclude; }else{ echo error_html($resultInclude,true); @@ -47,7 +47,7 @@ if (!@$apartado) { $resultInclude = ob_get_clean(); - if (strpos($resultInclude,".php on line ") === false){ + if (detect_error_on_code($resultInclude) === false){ echo $resultInclude; }else{ echo error_html($resultInclude); diff --git a/funciones.php b/funciones.php index 5ab67bd..ed882b2 100755 --- a/funciones.php +++ b/funciones.php @@ -298,6 +298,10 @@ function muestra_breadcrumb($record = array(), $previousLinks = array(),$class = echo ''; } +function detect_error_on_code($code) { + preg_match_all('/\b(Fatal error|Parse error|Warning|Notice):.*?\b/i', $code, $matches); + return @$matches[0]; +} function error_html($error, $a404 = false) { $result = ''; $icon = ' diff --git a/slug.php b/slug.php index b96a5d4..3887727 100755 --- a/slug.php +++ b/slug.php @@ -392,7 +392,7 @@ addPlugins("pre_render",$resultInclude); if (class_exists("CocoDB") && isset(CocoDB::$force_redis_html) && CocoDB::$force_redis_html && @$hash){ CocoDB::cacheSet(@$hash,$resultInclude); } -if (strpos($resultInclude,".php on line ") === false){ +if (detect_error_on_code($resultInclude) === false){ echo $resultInclude; }else{ echo error_html($resultInclude);