Edit report at https://bugs.php.net/bug.php?id=55154&edit=1
ID: 55154
User updated by: ivan dot enderlin at hoa-project dot net
Reported by: ivan dot enderlin at hoa-project dot net
Summary: SQLite does not support stream wrappers to access to
database file
-Status: Wont fix
+Status: Closed
Type: Bug
Package: SQLite related
PHP Version: 5.4SVN-2011-07-07 (SVN)
Block user comment: N
Private report: N
New Comment:
I understand. So there is no possible workaround to fix this little issue?
In this case, I change the bug status to âclosedâ.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2011-07-07 11:40:53] [email protected]
The underlying library creates journal files and locking in the same directory
as
the file it's working on. A stream just wouldn't cut it here.
------------------------------------------------------------------------
[2011-07-07 04:24:47] ivan dot enderlin at hoa-project dot net
Description:
------------
It seems like SQLite does not considere stream wrappers to access to database
file (with \SQLite3 class or PDO driver).
Test script:
---------------
<?php
/**
* $ echo "CREATE TABLE t ( x INTEGER PRIMARY KEY ASC, y, z );" |\
* sqlite3 -init 0 Foo.sqlite
*/
class W {
public function stream_open ( $path, $mode, $options, &$openedPath ) {
return fopen('Foo.sqlite', $mode);
}
public function url_stat ( $path, $flags ) {
return stat('Foo.sqlite');
}
}
stream_wrapper_register('sw', 'W');
var_dump(fopen('sw://foo', 'r'));
var_dump(file_exists('sw://foo'));
var_dump(new \SQLite3('Foo.sqlite'));
var_dump(new \SQLite3('sw://foo'));
Expected result:
----------------
resource(7) of type (stream)
bool(true)
object(SQLite3)#1 (0) {
}
object(SQLite3)#2 (0) {
}
Actual result:
--------------
resource(7) of type (stream)
bool(true)
object(SQLite3)#1 (0) {
}
Fatal error: Uncaught exception 'Exception' with message 'Unable to open
database: unable to open database file' in â¦.php:27
Stack trace:
#0 â¦.php(27): SQLite3->__construct('sw://foo')
#1 {main}
thrown in â¦.php on line 27
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55154&edit=1