Bug #79294 [NEW]: ::columnType() may fail after SQLite3Stmt::reset()

From: Date: Fri, 21 Feb 2020 11:13:32 +0000
Subject: Bug #79294 [NEW]: ::columnType() may fail after SQLite3Stmt::reset()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225660@lists.php.net to get a copy of this message
From: cmb Operating system: * PHP version: 7.3Git-2020-02-21 (Git) Package: SQLite related Bug Type: Bug Bug description:::columnType() may fail after SQLite3Stmt::reset() Description: ------------ As expected, after an SQLite3Result has been fully processed, SQLite3Result::columnType() returns FALSE. If the result is reset by calling SQLite3Result::reset(), ::columnType() yields the expected results again; however, if the statement is reset by calling SQLite3Stmt::reset(), ::columnType() keeps returning FALSE. In other words, whenever SQLite3Result::fetchArray() succeeds (i.e. does not return FALSE), I expect SQLite3Result::columType() to succeed (i.e. not to return FALSE). However, that does not necessarily happen after calling SQLite3Stmt::reset(). Test script: --------------- <?php $db = new SQLite3(':memory:'); $db->exec("CREATE TABLE foo (bar INT)"); $db->exec("INSERT INTO foo VALUES (1)"); $stmt = $db->prepare("SELECT * FROM foo"); $res = $stmt->execute(); var_dump($res->fetchArray() !== false); var_dump($res->columnType(0)); var_dump($res->fetchArray() !== false); var_dump($res->columnType(0)); $stmt->reset(); var_dump($res->fetchArray() !== false); var_dump($res->columnType(0)); $res->reset(); var_dump($res->fetchArray() !== false); var_dump($res->columnType(0)); ?> Expected result: ---------------- bool(true) int(1) bool(false) bool(false) bool(true) int(1) bool(true) int(1) Actual result: -------------- bool(true) int(1) bool(false) bool(false) bool(true) bool(false) bool(true) int(1) -- Edit bug report at https://bugs.php.net/bug.php?id=79294&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79294&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79294&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79294&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79294&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79294&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79294&r=support Expected behavior: https://bugs.php.net/fix.php?id=79294&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79294&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79294&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79294&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79294&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79294&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79294&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79294&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79294&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79294&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79294&r=mysqlcfg

« previous php.bugs (#225660) next »