[php-src] Issue #13587: SQLite3Result::fetchArray runs the query again. [O: Bug #64531 ]

From: Date: Mon, 04 Mar 2024 00:30:21 +0000
Subject: [php-src] Issue #13587: SQLite3Result::fetchArray runs the query again. [O: Bug #64531 ]
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246499@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/13587 Author: frikiluser ### Description Already reported 11 years ago. Here: https://bugs.php.net/bug.php?id=64531 The following code: ```php <?php $conn = new SQLite3('Log.sqlite', \SQLITE3_OPEN_READWRITE); $res = $conn->query('CREATE TABLE myTable (id INTEGER PRIMARY KEY AUTOINCREMENT, a INTEGER, b INTEGER, c INTEGER)'); //$res = $conn->query('DELETE FROM myTable'); $res = $conn->query('INSERT INTO myTable VALUES (null, 1, 2, 3)'); // Inserts a row here (the null is an auto-incrementing PK). $res->fetchArray(); // Inserts the *same* row data as above, again (with the next auto-incrementing PK number). $res->fetchArray(); // And yet again... $res = $conn->query('SELECT COUNT(id) FROM myTable'); $data = $res->fetchArray(); var_dump($data[0]); ``` Resulted in this output: ``` int(3) ``` But I expected this output instead: ``` int(1) ``` ### PHP Version PHP 8.2 ### Operating System Debian

« previous php.bugs (#246499) next »