Skip to content

Commit 0ae2e20

Browse files
authored
Merge pull request #4161 from paulbalandan/db-create-fix-memory
Fix strict checking for SQLite3 memory filename
2 parents e8d1031 + bd26d48 commit 0ae2e20

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

system/Commands/Database/CreateDatabase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ public function run(array $params)
102102
$ext = CLI::prompt('Please choose a valid file extension', ['db', 'sqlite']); // @codeCoverageIgnore
103103
}
104104

105-
if (strpos($name, ':memory:') === false)
105+
if ($name !== ':memory:')
106106
{
107107
$name = str_replace(['.db', '.sqlite'], '', $name) . ".{$ext}";
108108
}
109109

110110
$config->{$group}['DBDriver'] = 'SQLite3';
111111
$config->{$group}['database'] = $name;
112112

113-
if (strpos($name, ':memory:') === false)
113+
if ($name !== ':memory:')
114114
{
115115
$dbName = strpos($name, DIRECTORY_SEPARATOR) === false ? WRITEPATH . $name : $name;
116116

@@ -131,7 +131,7 @@ public function run(array $params)
131131
$db->connect();
132132
Factories::reset('config');
133133

134-
if (! is_file($db->getDatabase()) && strpos($name, ':memory:') === false)
134+
if (! is_file($db->getDatabase()) && $name !== ':memory:')
135135
{
136136
// @codeCoverageIgnoreStart
137137
CLI::error('Database creation failed.', 'light_gray', 'red');

0 commit comments

Comments
 (0)