From 56e13501184d1354b84b63dce7c00deae5066e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 13 Jul 2016 09:57:49 +0200 Subject: [PATCH] Properly handle newlines in SQL comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- libraries/plugins/export/ExportSql.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/plugins/export/ExportSql.class.php b/libraries/plugins/export/ExportSql.class.php index fade66e5b3..a5caffee7c 100644 --- a/libraries/plugins/export/ExportSql.class.php +++ b/libraries/plugins/export/ExportSql.class.php @@ -519,7 +519,14 @@ class ExportSql extends ExportPlugin && $GLOBALS['sql_include_comments'] ) { // see http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-comments.html - return '--' . (empty($text) ? '' : ' ') . $text . $GLOBALS['crlf']; + if (empty($text)) { + return '--' . $GLOBALS['crlf']; + } else { + $lines = preg_split("/\\r\\n|\\r|\\n/", $text); + foreach ($lines as $line) { + return '-- ' . $line . $GLOBALS['crlf']; + } + } } else { return ''; }