Doc #61572 [ReO]: Changed SQLite behavior (sqlite_close)
| From: | cmb@php.net | Date: | Mon, 31 Aug 2015 16:39:05 +0000 |
| Subject: | Doc #61572 [ReO]: Changed SQLite behavior (sqlite_close) | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12684@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61572&edit=1
ID: 61572
Updated by: cmb@php.net
Reported by: per at esmannjensen dot dk
Summary: Changed SQLite behavior (sqlite_close)
Status: Re-Opened
Type: Documentation Problem
Package: SQLite
Operating System: Linux, perhaps all
PHP Version: 5.3.10
Block user comment: N
Private report: N
New Comment:
The behavioral change seems to be the result of fixing bug
#42203[1].
[1] <https://github.com/php/php-src/commit/32c03b5>
Previous Comments:
------------------------------------------------------------------------
[2014-02-01 13:28:17] salathe@php.net
Regardless of whether the PHP v5 version is supported or not, there should still be changelog
entries on the appropriate manual page(s).
------------------------------------------------------------------------
[2014-02-01 10:17:40] krakjoe@php.net
This bug is reported for an unsupported version of PHP and is not connected to security.
(In addition, the sqlite extension is superseded by sqlite3)
It is therefore being closed.
If the bug is still present in a stable, supported version of PHP, please do open a new bug report.
Thanks for taking the time to help make PHP better :)
------------------------------------------------------------------------
[2012-03-30 16:44:09] per at esmannjensen dot dk
Description:
------------
In PHP 5.2 the test script below works fine, but in PHP 5.3 it does not work. As
far as I know this difference is not documented.
To make the script work in PHP 5.3, you would have to move the sqlite_close
command to the end of the script or comment it out.
It seems to me that the return handle ($res in the test script) does not survive
sqlite_close in PHP 5.3. But I am not savvy enough to be sure about this.
Test script:
---------------
<?php
$db = sqlite_open('path/to/database');
$sql = "SELECT * FROM mytable";
$res = sqlite_query($sql, $db);
sqlite_close($db);
while ( $thisRow = sqlite_fetch_array($res) )
{
print_r($thisRow);
}
?>
Expected result:
----------------
The documentation should be clear about this difference.
Due to potential concurrency problems in SQLite, developers may have chosen to
close the database handle ASAP in their PHP 5.2 scripts. While upgrading to PHP
5.3 they may need a hint that "ASAP" has changed.
Actual result:
--------------
PHP 5.2: Every row in mytable is printed out via print_r()
PHP 5.3: "Warning: sqlite_fetch_array(): 3 is not a valid sqlite result resource
in /server/path/test-script.php on line 8"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61572&edit=1