[Phpmyadmin-devel] split_sql_file produces sometimes wrong pieces

Benjamin Gandon gandon at isia.cma.fr
Fri Aug 3 03:06:19 CEST 2001

> (210,20010731131330,'Matrix','dadad' in Zeile 1.
>                           ^ here is the problem.

Not exactly. :)
It's in fact there:
because of that line of code in lib.inc.php3:
1480:           if ($last_char == $in_string && $char == ')') {
1481:                $in_string = FALSE;
1482:            }

> if you remove the parenthesis in the second row, readdump has 
> no problems.

Yes, that's the question I was asking to pete kelly about split_sql(). 

Actually, there is another big bug in this function that is here 
since the very begining of phpMyAdmin. Try that kind of manual SQL 
insert and it won't work: 
insert into table values ('\\');insert into table values ('\\');

The thing is that you have to know if there is an odd number of 
backslashes before a quote to know if it is escaped or not.
Previously, split_sql_file() only checked if there was a backslash 
before a quote. But that backslash could be escaped by another 
The new alorithm I coded should be ok in that matter.

I've already recoded the function and I just managed to commit my 
changes (curiously I had to try to connect to cvs.sf.net with ssh 
to create my home directory there and then be able to connect to 
cvs via ssh...)

> The problem in split_sql_file is row 1480 which try to detect the last
> ')' char.

Exactly. And that's a quick hack (Pete didn't answer my question about 
it in my message "a bit of story about split_string()").


More information about the Developers mailing list