Doc #61572 [NEW]: Changed SQLite behavior (sqlite_close)
| From: | per at esmannjensen dot dk | Date: | Fri, 30 Mar 2012 16:44:09 +0000 |
| Subject: | Doc #61572 [NEW]: Changed SQLite behavior (sqlite_close) | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-8138@lists.php.net to get a copy of this message | ||
From:
Operating system: Linux, perhaps all
PHP version: 5.3.10
Package: SQLite
Bug Type: Documentation Problem
Bug description:Changed SQLite behavior (sqlite_close)
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 bug report at https://bugs.php.net/bug.php?id=61572&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61572&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61572&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61572&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=61572&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61572&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=61572&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=61572&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=61572&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=61572&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=61572&r=support
Expected behavior: https://bugs.php.net/fix.php?id=61572&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=61572&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=61572&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=61572&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61572&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61572&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=61572&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=61572&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=61572&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=61572&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=61572&r=mysqlcfg