ID: 28235
Comment by: nobody at example dot org
Reported By: simen at lunarlounge dot org
Status: Open
Bug Type: SQLite related
Operating System: Debian/GNU testing
PHP Version: 5.0.0RC2
New Comment:
Never occured to me that this could be a bug, does the OO API handle
this?
function connect(){
try {
if ( !$this->db_handle = @sqlite_open($this->db_name, 0666, $err)
){
if ($this->db_handle===false){
throw new DBEx('0: Could not open/create db or directory');
} else {
throw new DBEx(sqlite_last_error($this->db_handle).': '.
sqlite_error_string(sqlite_last_error($this->db_handle)));
}
} else { return true; }
}
catch (DBEx $ex){ $ex->borkage(); return false; }
}
Previous Comments:
------------------------------------------------------------------------
[2004-04-30 16:41:07] simen at lunarlounge dot org
Description:
------------
The SQLite extension fail to detect when a database file isn't
writable:
Warning: sqlite_query() [function.sqlite-query]: (null) in test.php on
line 12
Reproduce code:
---------------
# touch test.sqlite
# chmod 0600 sqlite
# sqlite test.sqlite
> CREATE TABLE store (id INTEGER PRIMARY KEY, doc TEXT);
$db = sqlite_open('test.sqlite');
$sql = "INSERT INTO store (id, doc) VALUES (1, 'foo')";
$result = sqlite_query($db, $sql);
Expected result:
----------------
Warning: sqlite_query() [function.sqlite-query]: attempt to write a
readonly database in test.php on line 12
Actual result:
--------------
Warning: sqlite_query() [function.sqlite-query]: (null) in test.php on
line 12
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28235&edit=1