Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Hide php errors if debug flag is false to avoid leaking info in production

givanzaf1e6ac02417
diff --git a/app/template/error404.tpl b/app/template/error404.tpl
index f50b3a4..93951ca 100755
--- a/app/template/error404.tpl
+++ b/app/template/error404.tpl
@@ -15,5 +15,5 @@ foreach ($this->lines as $index => $line) {?>
[data-v-exception-lines] [data-v-exception-line]|after = <?php
} ?>
-body|prepend = <?php $debug = constant('DEBUG');?>
+body|prepend = <?php $debug = defined('DEBUG') && DEBUG;?>
[data-debug]|if_exists = $debug
diff --git a/app/template/error500.tpl b/app/template/error500.tpl
index e424feb..5b4ef03 100755
--- a/app/template/error500.tpl
+++ b/app/template/error500.tpl
@@ -3,9 +3,6 @@ import(ifmacros.tpl)
[data-v-exception-*]|innerText = $this->@@__data-v-exception-(*)__@@
-[data-v-debug]|before = <?php if (defined('DEBUG') && DEBUG == true) { ?>
-[data-v-debug]|after = <?php } ?>
-
[data-v-exception-lines] [data-v-exception-line]|deleteAllButFirstChild
[data-v-exception-lines] [data-v-exception-line]|before = <?php
@@ -27,5 +24,5 @@ if (isset($lines) && is_array($lines)) {
}
} ?>
-body|prepend = <?php $debug = constant('DEBUG');?>
-
+body|prepend = <?php $debug = defined('DEBUG') && DEBUG;?>
+[data-debug]|if_exists = $debug
diff --git a/env.php b/env.php
index 829810f..aa778b4 100755
--- a/env.php
+++ b/env.php
@@ -55,4 +55,7 @@ if (DEBUG) {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
+} else {
+ error_reporting(0);
+ ini_set('display_errors', 0);
}