Bug #66621 [NEW]: PDO::commit() bug
From: enrico_kaelert at kabelmail dot de
Operating system: Windows 7 64bit
PHP version: Irrelevant
Package: PDO MySQL
Bug Type: Bug
Bug description:PDO::commit() bug
Description:
------------
Trying to keep it short:
System:
Win7 64bit, xampp (MySQL Server Version: 5.6.14 PHP Version: 5.5.6)
Also tried that on a different system with (i think) PHP Version 5.8
The case:
using PDO to fire more than 1 INSERT INTO via PDO::beginTransaction()
and PDO::commit()
The bug:
if i DO NOT set $stmt to "what ever", then the PDO::commit() has no
effect.
But if i change $stmt to a string, a number or null - anything else but
itself - then all INSERTs are fired up.
Weird to describe.
Just see the test script at "# 3. ..." (line 43) where the "magic"
happens.
To switch between the "working version" and the "bug version" simple
change the
if(1) to if(0) ...
"bug version"
$stmt is a prepared query which was just executed.
Because we did a $dbh->beginTransaction(); we do now fire a
$dbh->commit();
But ... no action has been taken @db - no inserts made.
This only seem to happen if you fire MORE than 1 INSERT at 1 query.
"working version"
The ONLY different here is that we set $stmt to something else.
$stmt is of curse the current prepared and executed query.
Now BEFORE we fire the $dbh->commit() we do: $stmt = 'anything else';
And - its magic - the following $dbh->commit() works :: all INSERTs are
done.
Weird:
If you look at the SELECT (# 4.) you can see that we get
"fake"(?)-results back.
On every run the AUTO_INCREMENT counts up which is real - so those ids
get lost.
Thanks for you time - coulndt do it shorter.
Was looking into that problem for hours today with a friend =)
Test script:
---------------
detailed test script: http://pastebin.com/1QEcnPhM
Expected result:
----------------
explained in the description
Actual result:
--------------
explained in the description
--
Edit bug report at https://bugs.php.net/bug.php?id=66621&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66621&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66621&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66621&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66621&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66621&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66621&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66621&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66621&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66621&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66621&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66621&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66621&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66621&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66621&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66621&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66621&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66621&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66621&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66621&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66621&r=mysqlcfg
Thread (15 messages)
- enrico_kaelert at kabelmail dot de
- enrico_kaelert at kabelmail dot deBug #66621 [Com]: PDO::commit() bug
- ab@php.netBug #66621 [Opn->Fbk]: PDO::commit() bug
- enrico_kaelert at kabelmail dot deBug #66621 [Com]: PDO::commit() bug
- ab@php.netBug #66621 [Fbk]: PDO::commit() bug
- enrico_kaelert at kabelmail dot deBug #66621 [Com]: PDO::commit() bug
- ab@php.netBug #66621 [Fbk]: PDO::commit() bug
- johannes@php.netBug #66621 [Fbk]: PDO::commit() bug
- enrico_kaelert at kabelmail dot deBug #66621 [Com]: PDO::commit() bug
- enrico_kaelert at kabelmail dot deBug #66621 [Com]: PDO::commit() bug
- ab@php.netBug #66621 [Fbk]: PDO::commit() bug
- enrico_kaelert at kabelmail dot deBug #66621 [Com]: PDO::commit() bug
- ab@php.netBug #66621 [Fbk]: PDO::commit() bug
- enrico_kaelert at kabelmail dot deBug #66621 [Com]: PDO::commit() bug
- php-bugs at lists dot php dot netBug #66621 [Fbk->NoF]: PDO::commit() bug