diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2021-08-12 10:13:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-12 10:13:00 +0300 |
commit | 9873cb71e66be0f80839c76e923c3b866dd23b46 (patch) | |
tree | 3973fe06503f6099998c85e5cf435146b1b9a711 /plugins | |
parent | 99136cbf3183833b5d9dedb7943873fb8c3a8da5 (diff) |
avoid large amounts of notifications being added to the session (#17736)
* impose limit on notification message size when logging to notifications
* if in memory notification count exceeds max notification size in session, do not attempt to new ones it to the session
* Detect when session was too large to read and provide warning to user.
* add some tests for Notification\ManagerTest.php
* add tests for relevant DbTable members
* Change session data column type to allow larger session data values.
* update to rc3
* trigger new build?
* fix namespace
* fix test namespaces
* bump version correctly
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Monolog/Handler/WebNotificationHandler.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/Monolog/Handler/WebNotificationHandler.php b/plugins/Monolog/Handler/WebNotificationHandler.php index 0269282c9f..c365403590 100644 --- a/plugins/Monolog/Handler/WebNotificationHandler.php +++ b/plugins/Monolog/Handler/WebNotificationHandler.php @@ -20,6 +20,8 @@ use Zend_Session_Exception; */ class WebNotificationHandler extends AbstractProcessingHandler { + const MAX_NOTIFICATION_MESSAGE_LENGTH = 512; + public function isHandling(array $record) { if (!empty($record['context']['ignoreInScreenWriter'])) { @@ -46,7 +48,11 @@ class WebNotificationHandler extends AbstractProcessingHandler break; } - $message = $record['level_name'] . ': ' . htmlentities($record['message'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); + $recordMessage = $record['message']; + $recordMessage = str_replace(PIWIK_INCLUDE_PATH, '', $recordMessage); + $recordMessage = substr($recordMessage, 0, self::MAX_NOTIFICATION_MESSAGE_LENGTH); + + $message = $record['level_name'] . ': ' . htmlentities($recordMessage, ENT_COMPAT | ENT_HTML401, 'UTF-8'); $message .= $this->getLiteDebuggingInfo(); $notification = new Notification($message); |