Skip to content

Commit fbab686

Browse files
authored
Improve check for relative sqlite databases (#54513)
Applies the suggestion from @Sekaiichi in #54480. realpath() returns false if the file doesn't exist, so the previous code would have been file_exists(false), which technically doesn't match the file_exists signature.
1 parent a92644b commit fbab686

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/Illuminate/Database/Connectors/SQLiteConnector.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ public function connect(array $config)
2828
return $this->createConnection('sqlite:'.$config['database'], $config, $options);
2929
}
3030

31-
$path = realpath($config['database']);
32-
33-
if (! file_exists($path)) {
34-
$path = realpath(base_path($config['database']));
35-
}
31+
$path = realpath($config['database']) ?: realpath(base_path($config['database']));
3632

3733
// Here we'll verify that the SQLite database exists before going any further
3834
// as the developer probably wants to know if the database exists and this

0 commit comments

Comments
 (0)