Add pdo_sqlite tests for empty filename and in-memory uri#7662
Add pdo_sqlite tests for empty filename and in-memory uri#7662nikic merged 2 commits intophp:masterfrom
Conversation
|
Hmm, having these tests would mean we rely on that behavior, but we may want to change it. Having XFAIL tests would mean that we consider the current behavior a bug. Not sure what to do here. |
|
You don't think this is working as expected? |
1bd2241 to
fc8b8e2
Compare
| // create with in-memory database | ||
| $db = new PDO('sqlite:file::memory:?cache=shared'); | ||
|
|
||
| var_dump($db->exec('CREATE TABLE test1 (id INT);')); |
There was a problem hiding this comment.
Should this also open a second connection to check that it is actually shared?
There was a problem hiding this comment.
It could. I don't know if php is responsible for all the uri options working though. I was mainly testing the special case filenames.
There was a problem hiding this comment.
Given that we don't directly pass the DSN to SQLite3, that additional check would make sense. It may also make sense to add an INI section with open_basedir=, because if open_basedir is set, file: URIs are not supported by PHP.
There was a problem hiding this comment.
FreeBSD fails for some reason. What is the recommended open_basedir setting and then target directory to use to trigger a fail on all platforms?
There was a problem hiding this comment.
I think you could use open_basedir=. for that.
There was a problem hiding this comment.
I think you could use
open_basedir=.for that.
And write to what directory? If it doesn't restrict and creates a file, does it matter where it goes?
There was a problem hiding this comment.
Found an example test to follow.
Ah, should have checked more thoroughly. So https://bugs.php.net/bug.php?id=76868 would be merely a doc issue. |
97ba1ab to
d927530
Compare
d927530 to
0f22576
Compare
Refs #76868.
It would seem that pdo_sqlite supports empty filename and URIs as well as in-memory URIs. This adds tests to support that.
https://bugs.php.net/bug.php?id=76868
@cmb69 I was following up on the empty filename commit you referenced in ext/sqlite3.