From c6113f81bda6749a8e8106c000a9955aa56daa40 Mon Sep 17 00:00:00 2001 From: Vojta Svoboda Date: Sat, 2 Jan 2016 12:20:19 +0100 Subject: [PATCH] Update RequestLog.php Truncate URL which should be maximum 255 lenght. Reason: Today I got this error: ``` Next exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'url' at row 1 (SQL: insert into `system_request_logs` (`url`, `status_code`, `count`, `updated_at`, `created_at`) values (http://www.mysite.com/docs/%C3%83%C6%92%......%80%9A%C3%82%C2%814.pdf, 404, 1, 2016-01-02 12:16:08, 2016-01-02 12:16:08)) ``` --- modules/system/models/RequestLog.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/system/models/RequestLog.php b/modules/system/models/RequestLog.php index d32278fcb..9de194687 100644 --- a/modules/system/models/RequestLog.php +++ b/modules/system/models/RequestLog.php @@ -36,7 +36,7 @@ class RequestLog extends Model if (!DbDongle::hasDatabase()) return; $record = static::firstOrNew([ - 'url' => Request::fullUrl(), + 'url' => substr(Request::fullUrl(), 0, 255), 'status_code' => $statusCode, ]);