Problem/Motivation

In #3089902: "Azure Database for MySQL server" reports wrong database version we added

  protected function getServerVersion(): string {
    static $server_version;
    if (!$server_version) {
      $server_version = $this->connection->query('SELECT VERSION()')->fetchColumn();
    }
    return $server_version;
  }

@neclimdul rightly points out that if a database connects to mutliple mysql databases of different versions this potentially could cause you problems.

Proposed resolution

Make it a private class property. Original this was inlined as a static because having to select the server version from the database and not get it from PDO is entirely caused by proxy sql services reporting incorrect versions and it felt wrong to add class properties to work around there bugs - but now we've introduced bugs of our own :(

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

N/a

CommentFileSizeAuthor
#3 3186999-2.patch1.76 KBalexpott
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Status: Active » Needs review
FileSize
1.76 KB

This was reported by @neclimdul.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Rationale makes sense, I guess the presence of runTestsInSeparateProcesses should be a code smell that there might be some unexpected side effects.

neclimdul’s picture

Yeah, the annotation was the smell then migrate was the concern. You guys rock +1 RTBC. Thanks so much.

  • catch committed 702514c on 9.2.x
    Issue #3186999 by alexpott, neclimdul, longwave: Make the version a...

  • catch committed db92700 on 9.1.x
    Issue #3186999 by alexpott, neclimdul, longwave: Make the version a...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 9.2.x and cherry-picked to 9.1.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.