Doc #74397 [Opn->Ver]: Filename can also be empty string for in-memory db
| From: | cmb@php.net | Date: | Tue, 11 Apr 2017 14:00:16 +0000 |
| Subject: | Doc #74397 [Opn->Ver]: Filename can also be empty string for in-memory db | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-14608@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74397&edit=1
ID: 74397
Updated by: cmb@php.net
Reported by: aarjan at hotmail dot com
Summary: Filename can also be empty string for in-memory db
-Status: Open
+Status: Verified
Type: Documentation Problem
Package: SQLite related
Operating System: Windows
PHP Version: 7.0.17
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> This will result in a in-memory database.
Not quite. If the database name is an empty string, a private,
temporary on-disk database is created.
However, you're right that this has to be properly documented.
Previous Comments:
------------------------------------------------------------------------
[2017-04-09 15:25:25] aarjan at hotmail dot com
Typo fix in summary
------------------------------------------------------------------------
[2017-04-09 15:22:03] aarjan at hotmail dot com
Description:
------------
---
From manual page: http://www.php.net/sqlite3.construct
---
https://github.com/php/php-src/commit/cc125f277b50e0f90fc8033fe7f47d2446389a15
According to this commit, the filename in the constructor may also be an empty string since v7.0.10.
This will result in a in-memory database. In previous versions of PHP7 (I tested this with v7.0.2)
this would have resulted in a exception.
The documentation is not mentioning this feature.
Test script:
---------------
The unit test below works in v7.0.2, but fails in v7.0.17
class SQLiteConstructorTest extends PHPUnit_Framework_TestCase
{
/**
* @expectedException Exception
*/
public function testDefectDatabaseFile()
{
$database_file = '';
$sqlitedb = new SQLite3($database_file);
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74397&edit=1