Bug #55154 [Opn->Wfx]: SQLite does not support stream wrappers to access to database file
| From: | scottmac@php.net | Date: | Thu, 07 Jul 2011 15:40:53 +0000 |
| Subject: | Bug #55154 [Opn->Wfx]: SQLite does not support stream wrappers to access to database file | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161689@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55154&edit=1
ID: 55154
Updated by: scottmac@php.net
Reported by: ivan dot enderlin at hoa-project dot net
Summary: SQLite does not support stream wrappers to access to
database file
-Status: Open
+Status: Wont fix
Type: Bug
Package: SQLite related
PHP Version: 5.4SVN-2011-07-07 (SVN)
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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