diff --git a/ChangeLog b/ChangeLog index 90543b65f2..ac57b8bdc3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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() diff --git a/libraries/Util.class.php b/libraries/Util.class.php index 701f8c982f..f19ec12600 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -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; diff --git a/test/libraries/common/PMA_quoting_slashing_test.php b/test/libraries/common/PMA_quoting_slashing_test.php index 1f29191035..b750aa5dc0 100644 --- a/test/libraries/common/PMA_quoting_slashing_test.php +++ b/test/libraries/common/PMA_quoting_slashing_test.php @@ -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('\\\'') + ); } /**