From d942db93d804586a0b6fa46ca78fac59972176e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 5 Oct 2023 15:15:50 +0800 Subject: [PATCH] eee --- BackupCommand.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/BackupCommand.php b/BackupCommand.php index 355562a..e4d0fc1 100644 --- a/BackupCommand.php +++ b/BackupCommand.php @@ -208,7 +208,6 @@ class BackupCommand extends Command { $strings = ['INSERT INTO ' . $dbname . '.' . $value]; foreach ($data as $datum) { - if (count($strings) == 1) { $keys = array_keys($datum); $strings[] = '(' . implode(',', $keys) . ') VALUES'; @@ -217,9 +216,9 @@ class BackupCommand extends Command $encode = []; foreach ($keys as $val) { if (is_string($val)) { - $encode[] = '\'' . htmlentities($val) . '\''; + $encode[] = '\'' . addcslashes($val,'\'') . '\''; } else { - $encode[] = $val; + $encode[] = $val === '' ? '\'\'' : $val; } } $strings[] = '(' . implode(',', $encode) . '),';