Fix single quote export for servers in ANSI_QUOTES mode
It is possible to escape ' inside '' as both '' and \'. However using '' is MySQL extension and does not work in ANSI mode. We need to generate compatible exports in this case, so sticking with \' is safer. Fixes #11721 Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
parent
39c97184e8
commit
8742209c63
@ -15,6 +15,7 @@ phpMyAdmin - ChangeLog
|
||||
- issue #11698 Cannot create user on Percona Server
|
||||
- issue Properly report error on connecting
|
||||
- issue #11706 Database export template not saving compression option
|
||||
- issue #11721 Fix single quote export for servers in ANSI_QUOTES mode
|
||||
|
||||
4.5.2.0 (2015-11-23)
|
||||
- issue #11589 Incorrect parameter in mysqli_fetch_fields()
|
||||
|
||||
@ -308,7 +308,7 @@ class PMA_Util
|
||||
if ($php_code) {
|
||||
$a_string = str_replace('\'', '\\\'', $a_string);
|
||||
} else {
|
||||
$a_string = str_replace('\'', '\'\'', $a_string);
|
||||
$a_string = str_replace('\'', '\\\'', $a_string);
|
||||
}
|
||||
|
||||
return $a_string;
|
||||
|
||||
@ -35,7 +35,7 @@ class PMA_QuotingSlashing_Test extends PHPUnit_Framework_TestCase
|
||||
PMA_Util::sqlAddSlashes($string, true, true, true)
|
||||
);
|
||||
$this->assertEquals(
|
||||
"\\\\\\\\''test''''\\\\\\\\''''\\\\\\\\''\\r\\t\\n",
|
||||
"\\\\\\\\\\'test\\'\\'\\\\\\\\\\'\\'\\\\\\\\\\'\\r\\t\\n",
|
||||
PMA_Util::sqlAddSlashes($string, true, true, false)
|
||||
);
|
||||
$this->assertEquals(
|
||||
@ -43,7 +43,7 @@ class PMA_QuotingSlashing_Test extends PHPUnit_Framework_TestCase
|
||||
PMA_Util::sqlAddSlashes($string, true, false, true)
|
||||
);
|
||||
$this->assertEquals(
|
||||
"\\\\\\\\''test''''\\\\\\\\''''\\\\\\\\''\r\t\n",
|
||||
"\\\\\\\\\\'test\\'\\'\\\\\\\\\\'\\'\\\\\\\\\\'\r\t\n",
|
||||
PMA_Util::sqlAddSlashes($string, true, false, false)
|
||||
);
|
||||
$this->assertEquals(
|
||||
@ -51,7 +51,7 @@ class PMA_QuotingSlashing_Test extends PHPUnit_Framework_TestCase
|
||||
PMA_Util::sqlAddSlashes($string, false, true, true)
|
||||
);
|
||||
$this->assertEquals(
|
||||
"\\\\''test''''\\\\''''\\\\''\\r\\t\\n",
|
||||
"\\\\\\'test\\'\\'\\\\\\'\\'\\\\\\'\\r\\t\\n",
|
||||
PMA_Util::sqlAddSlashes($string, false, true, false)
|
||||
);
|
||||
$this->assertEquals(
|
||||
@ -59,9 +59,13 @@ class PMA_QuotingSlashing_Test extends PHPUnit_Framework_TestCase
|
||||
PMA_Util::sqlAddSlashes($string, false, false, true)
|
||||
);
|
||||
$this->assertEquals(
|
||||
"\\\\''test''''\\\\''''\\\\''\r\t\n",
|
||||
"\\\\\\'test\\'\\'\\\\\\'\\'\\\\\\'\r\t\n",
|
||||
PMA_Util::sqlAddSlashes($string, false, false, false)
|
||||
);
|
||||
$this->assertEquals(
|
||||
"\\\\\\'",
|
||||
PMA_Util::sqlAddSlashes('\\\'')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user