Bug #66621 [Com]: PDO::commit() bug

From: Date: Tue, 29 Apr 2014 15:07:30 +0000
Subject: Bug #66621 [Com]: PDO::commit() bug
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185505@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66621&edit=1

 ID:                 66621
 Comment by:         enrico_kaelert at kabelmail dot de
 Reported by:        enrico_kaelert at kabelmail dot de
 Summary:            PDO::commit() bug
 Status:             Feedback
 Type:               Bug
 Package:            PDO MySQL
 Operating System:   Windows 7 64bit
 PHP Version:        Irrelevant
 Assigned To:        ab
 Block user comment: N
 Private report:     N

 New Comment:

edit:
try this:

change the query in the test script to: 
# 3. multi insert via beginTransaction() and commit() / rollBack()
(...)
$sql = "
    -- this is my pretty commented query ...
    -- above comments works
    INSERT INTO
        testdb.tbl
    SET
        name = 'a' -- middle comment works
        -- name = 'a' middle new line comments works
    ; -- but this comment finally f* it up
    -- so simple nothing is allowed after the ;
    -- except if we destroy the stmt
";


Previous Comments:
------------------------------------------------------------------------
[2014-04-29 14:51:50] enrico_kaelert at kabelmail dot de

@johannes
Which $type you used?
And did you looked into the db to make sure the entries really exists?

@all
btw: something new:
I found out that:
- if you use only 1 INSERT INTO in the query
- and if you add comments to the query 
then the same effect happen: no INSERT made.

So change the query in the test script to: 
# 3. multi insert via beginTransaction() and commit() / rollBack()
(...)
$sql = "
    INSERT INTO testdb.tbl SET name = 'a'; -- this
is my comment
    -- this is a new line comment
";
(...)

Delete the test table if exists and use the $type "regular".
This is only 1 INSERT INTO and should work.
But it doesnt because of the comments(?).

BUT it will work if we destroy the $stmt (by using the $type "alternative").

------------------------------------------------------------------------
[2014-04-29 09:38:32] johannes@php.net

With the ode from 2014-04-24 12:25 UTC I get this result:

Array
(
    [0] => Array
        (
            [id] => 1
            [name] => a
        )

    [1] => Array
        (
            [id] => 2
            [name] => b
        )

    [2] => Array
        (
            [id] => 3
            [name] => c
        )

)

This seems right to me. I tried a handful combinations of MySQL servers & PHP versions. Not on
windows, though (while I can't imagine something Windows specific to be the case)

------------------------------------------------------------------------
[2014-04-24 14:05:31] ab@php.net

Enrico,

don't get me wrong, but brevity is wit. The script is still too excessive, but the explanation
in your latest pastebin is much better, even for such a dull person like me. Lets see.

Thanks

------------------------------------------------------------------------
[2014-04-24 12:25:49] enrico_kaelert at kabelmail dot de

Sorry, but i cant reduce that test script to 20 lines.
I dont wanna wast your or my time.
But i wrote it again as simple as possible: explanation and script at once.

http://pastebin.com/wt2DiNNB
If you dont understand what im doing there .. well, then sorry, i wont do more.
What you do if somebody wants to report a huge security bug? In 20 lines? 
Well, ... . Please dont get me wrong, but you need to spend a bit time to bug reports.

------------------------------------------------------------------------
[2014-04-24 06:25:36] ab@php.net

Hi,

I very appreciate your willingness to help, but still the script is not "10-20 lines
long". Please reduce it as much as possible, it is really hard to understand now what is your
issue and it would take to much time to debug such a big piece of code.

Many thanks.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=66621


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=66621&edit=1


Thread (15 messages)

« previous php.bugs (#185505) next »