-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add pdo_sqlite tests for empty filename and in-memory uri #7662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also open a second connection to check that it is actually shared?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could use open_basedir=.
for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.