drush icon indicating copy to clipboard operation
drush copied to clipboard

Guard against missing PDO MySQL constants

Open RobXYZ opened this issue 3 months ago • 2 comments

I found commands like sql:drop starting throwing errors after updating from 13.6.2 to 13.7 on my web host.

Error: Call to a member function command() on null in Drush\Commands\sql\SqlCommands->validate() (line 244 of /drush/drush/src/Commands/sql/SqlCommands.php).

This seems to be due to undefined PDO::MYSQL_ATTR_* constants. SqlBase::create() swallowed and returned null.

Codex found and wrote this fix so it may not be correct but hopefully points in the right direction.

RobXYZ avatar Dec 02 '25 12:12 RobXYZ

Whats your PHP version?

weitzman avatar Dec 02 '25 12:12 weitzman

PHP 8.3.27

RobXYZ avatar Dec 02 '25 12:12 RobXYZ

I'm not sure that its valid for those constants to be missing. Your mPDO would be busted. Anyway, here is how Drupal core handled this, in case anyone wants to make a different PR. I would merge that approach.

weitzman avatar Dec 12 '25 14:12 weitzman