Skip to content

Commit

Permalink
remove smarty messages in error logs unless $smarty_debug is set to t…
Browse files Browse the repository at this point in the history
…rue (#909)
  • Loading branch information
David Coutadeur committed Jun 19, 2024
1 parent a52e095 commit d414cdd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions conf/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@
#$smarty_cache_dir = "/var/cache/self-service-password/cache";

# Smarty debug mode - will popup debug information on web interface
# and add many smarty debug messages in error logs
$smarty_debug = false;

## Custom Password Fields
Expand Down
3 changes: 2 additions & 1 deletion docs/config_general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ This is also possible to enable Smarty debug, for web interface issues:
$smarty_debug = true;
.. tip:: Debug messages will appear on web interface.
.. tip:: Debug messages will appear on web interface as a popup.
You will also have many more messages in error logs.

.. _security:

Expand Down
9 changes: 9 additions & 0 deletions htdocs/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,15 @@
$smarty->setCompileDir($compile_dir);
$smarty->setCacheDir($cache_dir);
$smarty->debugging = $smarty_debug;
if(isset($smarty_debug) && $smarty_debug == true )
{
$smarty->error_reporting = E_ALL;
}
else
{
# Do not report smarty stuff unless $smarty_debug == true
$smarty->error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED & ~E_WARNING;
}

error_reporting(0);
if ($debug) {
Expand Down

0 comments on commit d414cdd

Please sign in to comment.