Bug #78813 [NEW]: SQLite ALTER TABLE query is returning columns

From: Date: Thu, 14 Nov 2019 11:34:50 +0000
Subject: Bug #78813 [NEW]: SQLite ALTER TABLE query is returning columns
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223711@lists.php.net to get a copy of this message
From: deus dot kane at claromentis dot com Operating system: Windows PHP version: 7.2.24 Package: SQLite related Bug Type: Bug Bug description:SQLite ALTER TABLE query is returning columns Description: ------------ Calling SQLite3::query with a resultless query returns a mostly useless result object. Prior to PHP 7.2.24 calling SQLite3Result::numColumns on this result object would return zero, indicating that this was a query with no data to step through. In PHP 7.2.24, calling SQLite3Result::numColumns on this result object returns 1, making it indistingishable from a result object that contains data. In addition, when calling SQLite3Result::columnName with the value 0 returns "1" (as a string). The previous behaviour was relied on by my company when implementing an SQLite driver for our database layer. As we are issuing arbitrary queries, we always called ::query, and then used the fact that a query with no result had zero columns to avoid re-executing the query by stepping through it. Test script: --------------- <?php $db = new SQLite3(":memory:"); $result = $db->query("CREATE TABLE users(id INTEGER PRIMARY KEY)"); $result = $db->query("ALTER TABLE users RENAME TO user_temp"); print($result->numColumns()); Expected result: ---------------- 0 is output to the screen Actual result: -------------- 1 is output to the screen -- Edit bug report at https://bugs.php.net/bug.php?id=78813&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78813&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78813&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78813&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78813&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78813&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78813&r=support Expected behavior: https://bugs.php.net/fix.php?id=78813&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78813&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78813&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78813&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78813&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78813&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78813&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78813&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78813&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78813&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78813&r=mysqlcfg

« previous php.bugs (#223711) next »