Skip to content

Commit

Permalink
Merge pull request #161 from devenbansod/log_long_errmsg
Browse files Browse the repository at this point in the history
Log and don't save if length of error message for an incident field is too long
  • Loading branch information
nijel committed Jun 18, 2017
2 parents 01758b8 + f661693 commit 2fadbe1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Model/Table/IncidentsTable.php
Expand Up @@ -528,15 +528,20 @@ private function _logLongIncidentSubmissions($si, &$incident_ids) {

$stacktraceLength = mb_strlen($si['stacktrace']);
$fullReportLength = mb_strlen($si['full_report']);
$errorMessageLength = mb_strlen($si['error_message']);

if ($stacktraceLength > 65535 || $fullReportLength > 65535) {
if ($stacktraceLength > 65535
|| $fullReportLength > 65535
|| $errorMessageLength > 100 // length of field in 'incidents' table
) {
// If length of report is longer than
// what can fit in the table field,
// we log it and don't save it in the database
Log::error(
'Too long data submitted in the incident. The length of stacktrace: '
. $stacktraceLength . ', while length of bug report: '
. $fullReportLength . '. The full incident reported was as follows: '
. $stacktraceLength . ', the length of bug report: '
. $fullReportLength . ', the length of error message: '
. $errorMessageLength . '. The full incident reported was as follows: '
. json_encode($si)
);

Expand Down

0 comments on commit 2fadbe1

Please sign in to comment.