@@ -735,27 +735,9 @@ static const struct pdo_dbh_methods sqlite_methods = {
735
735
static char * make_filename_safe (const char * filename )
736
736
{
737
737
if (* filename && strncasecmp (filename , "file:" , 5 ) == 0 ) {
738
- char * fullpath ;
739
- if (strncasecmp (filename + 5 , "///" , 3 ) == 0 ) {
740
- fullpath = expand_filepath (filename + 7 , NULL );
741
- } else if (strncasecmp (filename + 5 , "//localhost/" , 12 ) == 0 ) {
742
- fullpath = expand_filepath (filename + 16 , NULL );
743
- } else if (strncasecmp (filename + 5 , "//" , 2 ) == 0 ) {
744
- // authority error on sqlite3_open_v2
745
- return filename ;
746
- } else {
747
- fullpath = expand_filepath (filename + 5 , NULL );
748
- }
749
-
750
- if (!fullpath ) {
751
- return NULL ;
752
- }
753
-
754
- if (php_check_open_basedir (fullpath )) {
755
- efree (fullpath );
738
+ if (PG (open_basedir ) && * PG (open_basedir )) {
756
739
return NULL ;
757
740
}
758
- efree (fullpath );
759
741
return estrdup (filename );
760
742
}
761
743
if (* filename && memcmp (filename , ":memory:" , sizeof (":memory:" ))) {
@@ -830,7 +812,10 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{
830
812
831
813
flags = pdo_attr_lval (driver_options , PDO_SQLITE_ATTR_OPEN_FLAGS , SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE );
832
814
833
- i = sqlite3_open_v2 (filename , & H -> db , flags | SQLITE_OPEN_URI , NULL );
815
+ if (!(PG (open_basedir ) && * PG (open_basedir ))) {
816
+ flags |= SQLITE_OPEN_URI ;
817
+ }
818
+ i = sqlite3_open_v2 (filename , & H -> db , flags , NULL );
834
819
835
820
efree (filename );
836
821
0 commit comments