From:             
Operating system: 
PHP version:      5.4SVN-2011-07-07 (SVN)
Package:          SQLite related
Bug Type:         Bug
Bug description:SQLite does not support stream wrappers to access to database 
file

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 bug report at https://bugs.php.net/bug.php?id=55154&edit=1
-- 
Try a snapshot (PHP 5.2):            
https://bugs.php.net/fix.php?id=55154&r=trysnapshot52
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=55154&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=55154&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=55154&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55154&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=55154&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=55154&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=55154&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=55154&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=55154&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=55154&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=55154&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=55154&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=55154&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=55154&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=55154&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=55154&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=55154&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=55154&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=55154&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=55154&r=mysqlcfg
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=55154&r=trysnapshot54

Reply via email to