From e3e6008743bc2389756124ef7a2e4e714f0469c2 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 21 Nov 2013 15:19:43 -0800 Subject: [PATCH] Truncate super long SQL in DB error log lines (useful for blobs) Change-Id: Ibb9b9178de80e691406e5c1a7113f0511055d18d --- includes/db/Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/db/Database.php b/includes/db/Database.php index 9ba1851632..f70934b08f 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -1105,7 +1105,7 @@ abstract class DatabaseBase implements IDatabase, DatabaseType { wfDebug( "SQL ERROR (ignored): $error\n" ); $this->ignoreErrors( $ignore ); } else { - $sql1line = str_replace( "\n", "\\n", $sql ); + $sql1line = mb_substr( str_replace( "\n", "\\n", $sql ), 0, 5*1024 ); wfLogDBError( "$fname\t{$this->mServer}\t$errno\t$error\t$sql1line\n" ); wfDebug( "SQL ERROR: " . $error . "\n" ); throw new DBQueryError( $this, $error, $errno, $sql, $fname ); -- 2.20.1