I tried to import a totally valid dump by pasting in the SQL textfield, and it throws this error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE IF NOT EXISTS `test` (
`id` int(11) NOT NULL,
`test` text NOT N' at line 12
Importing from file works. Also tested on http://demo.phpmyadmin.net/master/
-- phpMyAdmin SQL Dump
-- version 4.3.0-dev
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Erstellungszeit: 10. Sep 2014 um 15:01
-- Server Version: 5.5.38-0ubuntu0.14.04.1
-- PHP-Version: 5.5.9-1ubuntu4.4
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Datenbank: `test`
--
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `test`
--
DROP TABLE IF EXISTS `test`;
CREATE TABLE IF NOT EXISTS `test` (
`id` int(11) NOT NULL,
`test` text NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
--
-- Daten für Tabelle `test`
--
INSERT INTO `test` (`id`, `test`) VALUES
(1, 'asdasdasdas\r\nasdasdasd''adsadadsa\r\nIt''s broken');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `test`
--
ALTER TABLE `test`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `test`
--
ALTER TABLE `test`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
It seems that the "ü" are causing some troubles.
I removed the following line and the error was thrown later in the script:
-- Tabellenstruktur für Tabelle test
This might be caused by use (or not use) of mb_* functions.
With "git bisect", I determined that the first bad commit is 9b77d746aba.
A PR has been sent: https://github.com/phpmyadmin/phpmyadmin/pull/1356
Fix merged, thanks. Raimund, please confirm, possibly with other, bigger German dumps.
And, Raimund, thanks for testing master!
Thanks for the fix, the dump above is working now. Unfortunately I still have problems with the exmaple below. Apparently there's a problem if and only if these conditions meet:
Thanks for this tricky bug…
I kept only the minimum to have the error:
I think I found why, but currently, I don't know how to solve it…
Let's try to explain: to be sure that the ";" (the delimiter) isn't into a string, the query is parsed to find each quoted string. But the preg_match doesn't seem to support an UTF8 subject. In fact, he can search into it, but he will return a wrong position… Because of this, the position is shifted and so, we don't find the last string ('test;test').
So I need to find a way to get the correct position of a match. I hope I won't need to develop a way to look for a pattern…
I'll keep you informed.
I sent a new PR: https://github.com/phpmyadmin/phpmyadmin/pull/1360/files#diff-54274ad561345ccbab758e2af1a1c0abL310
This modification is the one which fix the issue.
The other modifications are just modifications for comprehension.
Thanks, it's now working