diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Log/Logger.php b/snappymail/v/0.0.0/app/libraries/MailSo/Log/Logger.php index 5bb507df8..9b9e1f5ce 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Log/Logger.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Log/Logger.php @@ -23,7 +23,7 @@ class Logger extends \SplFixedArray private $aSecretWords = []; - private $bShowSecter = false; + private $bShowSecrets = false; function __construct(bool $bRegPhpErrorHandler = true) { @@ -103,15 +103,15 @@ class Logger extends \SplFixedArray } } - public function SetShowSecter(bool $bShow) : self + public function SetShowSecrets(bool $bShow) : self { - $this->bShowSecter = $bShow; + $this->bShowSecrets = $bShow; return $this; } public function IsShowSecter() : bool { - return $this->bShowSecter; + return $this->bShowSecrets; } public function AddForbiddenType(int $iType) : self @@ -121,12 +121,6 @@ class Logger extends \SplFixedArray return $this; } - public function RemoveForbiddenType(int $iType) : self - { - $this->aForbiddenTypes[$iType] = false; - return $this; - } - public function __phpErrorHandler(int $iErrNo, string $sErrStr, string $sErrFile, int $iErrLine) : bool { if (\error_reporting() & $iErrNo) { @@ -140,7 +134,21 @@ class Logger extends \SplFixedArray $iType = Enumerations\Type::WARNING_PHP; break; } - +/* + case E_ERROR: + case E_WARNING: + case E_PARSE: + case E_NOTICE: + case E_CORE_ERROR: + case E_CORE_WARNING: + case E_COMPILE_ERROR: + case E_COMPILE_WARNING: + case E_USER_NOTICE: + case E_STRICT: + case E_RECOVERABLE_ERROR: + case E_DEPRECATED: + case E_USER_DEPRECATED: +*/ $this->Write($sErrFile.' [line:'.$iErrLine.', code:'.$iErrNo.']', $iType, 'PHP'); $this->Write('Error: '.$sErrStr, $iType, 'PHP'); } @@ -173,22 +181,20 @@ class Logger extends \SplFixedArray public function Write(string $sDesc, int $iType = Enumerations\Type::INFO, string $sName = '', bool $bSearchSecretWords = true, bool $bDiplayCrLf = false) : bool { - if (isset($this->aForbiddenTypes[$iType]) && true === $this->aForbiddenTypes[$iType]) + if (!empty($this->aForbiddenTypes[$iType])) { return true; } $this->bUsed = true; - $oLogger = null; - $aLoggers = array(); - $iResult = 1; - - if ($bSearchSecretWords && !$this->bShowSecter && \count($this->aSecretWords)) + if ($bSearchSecretWords && !$this->bShowSecrets && \count($this->aSecretWords)) { $sDesc = \str_replace($this->aSecretWords, '*******', $sDesc); } + $iResult = 1; + foreach ($this as /* @var $oLogger \MailSo\Log\Driver */ $oLogger) { $iResult = $oLogger->Write($sDesc, $iType, $sName, $bDiplayCrLf); @@ -256,16 +262,8 @@ class Logger extends \SplFixedArray $iType = null === $iType ? Enumerations\Type::NOTICE : $iType; return $this->WriteException($mData, $iType, $sName, $bSearchSecretWords, $bDiplayCrLf); } - else - { - return $this->WriteDump($mData, $iType, $sName, $bSearchSecretWords, $bDiplayCrLf); - } + return $this->WriteDump($mData, $iType, $sName, $bSearchSecretWords, $bDiplayCrLf); } - else - { - return $this->Write($mData, $iType, $sName, $bSearchSecretWords, $bDiplayCrLf); - } - - return false; + return $this->Write($mData, $iType, $sName, $bSearchSecretWords, $bDiplayCrLf); } } diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php index 9d13bdaf6..f228d94fd 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -154,7 +154,7 @@ class Actions $sTimeZone = $this->oConfig->Get('logs', 'time_zone', 'UTC'); - $this->oLogger->SetShowSecter(!$this->oConfig->Get('logs', 'hide_passwords', true)); + $this->oLogger->SetShowSecrets(!$this->oConfig->Get('logs', 'hide_passwords', true)); $sLogFileName = $this->oConfig->Get('logs', 'filename', ''); @@ -643,9 +643,10 @@ class Actions mkdir($sLogFileDir, 0755, true); } - $this->oLoggerAuth->AddForbiddenType(\MailSo\Log\Enumerations\Type::MEMORY); - $this->oLoggerAuth->AddForbiddenType(\MailSo\Log\Enumerations\Type::TIME); - $this->oLoggerAuth->AddForbiddenType(\MailSo\Log\Enumerations\Type::TIME_DELTA); + $this->oLoggerAuth + ->AddForbiddenType(\MailSo\Log\Enumerations\Type::MEMORY) + ->AddForbiddenType(\MailSo\Log\Enumerations\Type::TIME) + ->AddForbiddenType(\MailSo\Log\Enumerations\Type::TIME_DELTA); $oDriver = new \MailSo\Log\Drivers\File($sAuthLogFileFullPath); diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php index 743ca8f6f..841d105df 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/ServiceActions.php @@ -158,9 +158,9 @@ class ServiceActions } catch (\Throwable $oException) { - error_log($oException->getMessage()); + \error_log($oException->getMessage()); if ($e = $oException->getPrevious()) { - error_log("\t{$e->getMessage()} @ {$e->getFile()}#{$e->getLine()}"); + \error_log("\t{$e->getMessage()} @ {$e->getFile()}#{$e->getLine()}"); } $aResponseItem = $this->oActions->ExceptionResponse(