php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #72653 SQLite should allow opening with empty filename
Submitted: 2016-07-22 19:36 UTC Modified: 2016-07-27 17:16 UTC
From: nazar at mokrynskyi dot com Assigned: cmb
Status: Closed Package: SQLite related
PHP Version: 7.0.9 OS:
Private report: No CVE-ID:
 [2016-07-22 19:36 UTC] nazar at mokrynskyi dot com
Description:
------------
SQLite allows to open database with empty filename (https://www.sqlite.org/c3ref/open.html):

> If the filename is an empty string, then a private, temporary on-disk database will be created. This private database will be automatically deleted as soon as the database connection is closed.

This is also true for HHVM implementation: https://github.com/facebook/hhvm/issues/7225

Would be nice to be consistent and add support for this in PHP as well (especially, since underlying interface already have it).

P.S. https://bugs.php.net/bug.php?id=27928 doesn't seem to be relevant here anymore

Test script:
---------------
<?php
new SQLite3('');

Expected result:
----------------
No output

Actual result:
--------------
PHP Fatal error:  Uncaught Exception: Unable to expand filepath in %s:2
Stack trace:
#0 %s(2): SQLite3->__construct('')
#1 {main}
  thrown in %s on line 2

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-24 11:36 UTC] cmb@php.net
-Package: SQLite +Package: SQLite related -Assigned To: +Assigned To: cmb
 [2016-07-24 11:36 UTC] cmb@php.net
As Sqlite3 already supports the :memory: pseudo filename, it would
make sense to also support empty filenames.

BTW: the other bug you're mentioning refers to the SQLite
extension, which is unmaintained since a long time anyway.
 [2016-07-27 17:16 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 [2016-07-27 17:16 UTC] cmb@php.net
The PR has been merged; closing.
 [2016-07-27 17:18 UTC] nazar at mokrynskyi dot com
Thanks for the quick fix!
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Apr 30 01:01:34 2017 UTC