Bug #70628 [NEW]: Clearing bindings on an SQLite3 statement doesn't work

From: Date: Sat, 03 Oct 2015 13:34:13 +0000
Subject: Bug #70628 [NEW]: Clearing bindings on an SQLite3 statement doesn't work
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196367@lists.php.net to get a copy of this message
From: symos at yahoo dot com Operating system: PHP version: 5.6.14 Package: SQLite related Bug Type: Bug Bug description:Clearing bindings on an SQLite3 statement doesn't work Description: ------------ When inserting multiple rows to SQLite3 using a prepared statement, if you don't bind a parameter for a row then the value from the previous row will be inserted, even if you "clear" and "reset" the statement between lines. The equivalent code in C seems to work as expected as demonstrated here: http://stackoverflow.com/questions/32917795/clearing-bindings-on-an-sqlite3-statement-doesnt-seem-to-work-php/32918127 Therefore this leads me to believe this is a PHP bug. Test script: --------------- $db = new SQLite3('dogsDb.sqlite'); $db->exec("CREATE TABLE Dogs (Id INTEGER PRIMARY KEY, Breed TEXT, Name TEXT, Age INTEGER)"); $sth = $db->prepare("INSERT INTO Dogs (Breed, Name, Age) VALUES (:breed,:name,:age)"); $sth->bindValue(':breed', 'canis', SQLITE3_TEXT); $sth->bindValue(':name', 'jack', SQLITE3_TEXT); $sth->bindValue(':age', 7, SQLITE3_INTEGER); $sth->execute(); $sth->clear(); //this is supposed to clear bindings! $sth->reset(); $sth->bindValue(':breed', 'russel', SQLITE3_TEXT); $sth->bindValue(':age', 3, SQLITE3_INTEGER); $sth->execute(); Expected result: ---------------- Second database row should have a null value for the 'name' column. Actual result: -------------- Second database row has 'jack' value for the 'name' column. -- Edit bug report at https://bugs.php.net/bug.php?id=70628&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70628&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70628&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70628&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70628&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70628&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70628&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70628&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70628&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70628&r=support Expected behavior: https://bugs.php.net/fix.php?id=70628&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70628&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70628&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70628&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70628&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70628&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70628&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70628&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70628&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70628&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70628&r=mysqlcfg

« previous php.bugs (#196367) next »