diff --git a/lam/docs/manual-sources/howto.xml b/lam/docs/manual-sources/howto.xml
index 3b201d26..cf423da9 100644
--- a/lam/docs/manual-sources/howto.xml
+++ b/lam/docs/manual-sources/howto.xml
@@ -1018,9 +1018,13 @@ Have fun!
LAM can log events (e.g. user logins). You can use system
logging (syslog for Unix, event viewer for Windows) or log to a
separate file. Please note that LAM may log sensitive data (e.g.
- passwords) at log level "Debug". Production system should be set to
+ passwords) at log level "Debug". Production systems should be set to
"Warning" or "Error".
+ The PHP error reporting is only for developers. By default LAM
+ does not show PHP notice messages in the web pages. You can select to
+ use the php.ini setting here.
+
diff --git a/lam/docs/manual-sources/images/configGeneral3.png b/lam/docs/manual-sources/images/configGeneral3.png
index 1bd01c4b..31cb39a3 100644
Binary files a/lam/docs/manual-sources/images/configGeneral3.png and b/lam/docs/manual-sources/images/configGeneral3.png differ
diff --git a/lam/help/help.inc b/lam/help/help.inc
index 5b6ecab6..0ca558c7 100644
--- a/lam/help/help.inc
+++ b/lam/help/help.inc
@@ -151,6 +151,8 @@ $helpArray = array (
"Text" => _("Here you can specify minimum requirements for passwords. The character classes are: lowercase, uppercase, numeric and symbols.")),
"243" => array ("Headline" => _('Email format'),
"Text" => _('Please change this setting only if you experience problems in receiving emails from LAM. This defines the line ending of emails.')),
+ "244" => array ("Headline" => _('PHP error reporting'),
+ "Text" => _('Defines if the PHP error reporting setting from php.ini is used or the setting preferred by LAM ("E_ALL & ~E_NOTICE"). If you do not develop LAM modules please use the default. This will prevent displaying messages that are useful only for developers.')),
"250" => array ("Headline" => _("Filter"),
"Text" => _("Here you can input simple filter expressions (e.g. 'value' or 'v*'). The filter is case-sensitive.")),
"260" => array ("Headline" => _("Additional LDAP filter"),
diff --git a/lam/lib/config.inc b/lam/lib/config.inc
index 287a797f..805b3c29 100644
--- a/lam/lib/config.inc
+++ b/lam/lib/config.inc
@@ -1352,6 +1352,11 @@ class LAMConfig {
*/
class LAMCfgMain {
+ /** PHP error reporting setting as E_ALL & ~E_NOTICE */
+ const ERROR_REPORTING_DEFAULT = 'default';
+ /** PHP error reporting setting from php.ini */
+ const ERROR_REPORTING_SYSTEM = 'system';
+
/** Default profile */
public $default;
@@ -1399,12 +1404,15 @@ class LAMCfgMain {
/** EOL for emails (default/unix) */
public $mailEOL = 'default';
+
+ /** error reporting */
+ public $errorReporting = self::ERROR_REPORTING_DEFAULT;
/** list of data fields to save in config file */
private $settings = array("password", "default", "sessionTimeout",
"logLevel", "logDestination", "allowedHosts", "passwordMinLength",
"passwordMinUpper", "passwordMinLower", "passwordMinNumeric",
- "passwordMinClasses", "passwordMinSymbol", "mailEOL");
+ "passwordMinClasses", "passwordMinSymbol", "mailEOL", 'errorReporting');
/**
* Loads preferences from config file
@@ -1490,6 +1498,7 @@ class LAMCfgMain {
if (!in_array("passwordMinSymbol", $saved)) array_push($file_array, "\n\n# Password: minimum symbolic characters\n" . "passwordMinSymbol: " . $this->passwordMinSymbol);
if (!in_array("passwordMinClasses", $saved)) array_push($file_array, "\n\n# Password: minimum character classes (0-4)\n" . "passwordMinClasses: " . $this->passwordMinClasses);
if (!in_array("mailEOL", $saved)) array_push($file_array, "\n\n# Email format (default/unix)\n" . "mailEOL: " . $this->mailEOL);
+ if (!in_array("errorReporting", $saved)) array_push($file_array, "\n\n# PHP error reporting (default/system)\n" . "errorReporting: " . $this->errorReporting);
$file = @fopen($this->conffile, "w");
if ($file) {
for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);
diff --git a/lam/lib/security.inc b/lam/lib/security.inc
index f1f597ab..d5ffa5ca 100644
--- a/lam/lib/security.inc
+++ b/lam/lib/security.inc
@@ -63,6 +63,10 @@ function startSecureSession($redirectToLogin = true, $initSecureData = false) {
$_SESSION['sec_sessionTime'] = time();
$_SESSION['cfgMain'] = new LAMCfgMain();
}
+ // set error reporting
+ if (empty($_SESSION['cfgMain']) || ($_SESSION['cfgMain']->errorReporting == LAMCfgMain::ERROR_REPORTING_DEFAULT)) {
+ ini_set('error_reporting', 'E_ALL & ~E_NOTICE');
+ }
// check session id
if (! isset($_SESSION["sec_session_id"]) || ($_SESSION["sec_session_id"] != session_id())) {
// session id is invalid
diff --git a/lam/templates/config/mainmanage.php b/lam/templates/config/mainmanage.php
index f14dfe7d..9441d78b 100644
--- a/lam/templates/config/mainmanage.php
+++ b/lam/templates/config/mainmanage.php
@@ -174,6 +174,7 @@ if (isset($_POST['submitFormData'])) {
if (isLAMProVersion()) {
$cfg->mailEOL = $_POST['mailEOL'];
}
+ $cfg->errorReporting = $_POST['errorReporting'];
// save settings
if (isset($_POST['submit'])) {
$cfg->save();
@@ -371,6 +372,14 @@ elseif ($cfg->logDestination == 'SYSLOG') {
$loggingTable->addElement(new htmlTableExtendedRadio(_("Log destination"), 'logDestination', $destinationOptions, $destinationSelected, '240'), true);
$loggingTable->addElement(new htmlOutputText(''));
$loggingTable->addElement(new htmlInputField('logFile', $destinationPath), true);
+$loggingTable->addElement(new htmlSpacer(null, '10px'), true);
+$errorLogOptions = array(
+ _('PHP system setting') => LAMCfgMain::ERROR_REPORTING_SYSTEM,
+ _('default') => LAMCfgMain::ERROR_REPORTING_DEFAULT
+);
+$errorLogSelect = new htmlTableExtendedSelect('errorReporting', $errorLogOptions, array($cfg->errorReporting), _('PHP error reporting'), '244');
+$errorLogSelect->setHasDescriptiveElements(true);
+$loggingTable->addElement($errorLogSelect, true);
$container->addElement($loggingTable, true);
$container->addElement(new htmlSpacer(null, '10px'), true);