Skip to content

Commit

Permalink
Fix null param to ucfirst() fatal error when DB information is missin…
Browse files Browse the repository at this point in the history
…g. (#5918)
  • Loading branch information
Supreetam09 committed Mar 24, 2024
1 parent c7e98c2 commit ac2817a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Sql/SqlBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ public static function create(array $options = []): ?SqlBase
public static function getInstance($db_spec, $options): ?self
{
$driver = $db_spec['driver'];
$class_name = 'Drush\Sql\Sql' . ucfirst($driver);
if (class_exists($class_name)) {
$instance = method_exists($class_name, 'make') ? $class_name::make($db_spec, $options) : new $class_name($db_spec, $options);
$class_name = !empty($driver) ? 'Drush\Sql\Sql' . ucfirst($driver) : null;
if ($class_name && class_exists($class_name)) {
$instance = new $class_name($db_spec, $options);
// Inject config
$instance->setConfig(Drush::config());
return $instance;
Expand Down

0 comments on commit ac2817a

Please sign in to comment.