Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Discovered via PHPStan in #3178534: Start running PHPStan on Drupal core (level 0):
Line core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
------ ----------------------------------------------------------------------------------
102 Class Drupal\Core\Database\Driver\mysql\StatementInterface not found.
Line 102 of Drupal\Core\Database\Driver\mysql\Connection::handleQueryException() is:
$query_string = ($query instanceof StatementInterface) ? $query->getQueryString() : $query;
StatementInterface does not exist in this namespace, but at Drupal\Core\Database\StatementInterface.
Steps to reproduce
Proposed resolution
Add the missing use statement.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#2 | 3205024.patch | 664 bytes | longwave |
Comments
Comment #2
longwaveComment #3
mondrakeGood catch.
Comment #6
catchNearly asked for test coverage here, but we only use this check to build the error message for an exception, and we've additionally already done #3137883: Deprecate passing a StatementInterface object to Connection::query. So I think we should just go ahead here.
Committed 6d0f2eb and pushed to 9.2.x + cherry-picked to 9.1.x. Thanks!