Unverified Commit e3bec40a authored by belgattitude's avatar belgattitude Committed by Luís Cobucci

morozov review, revert regexp constant introduced after lcobucci review ;)

parent 2c2169e0
...@@ -39,10 +39,6 @@ use Doctrine\DBAL\VersionAwarePlatformDriver; ...@@ -39,10 +39,6 @@ use Doctrine\DBAL\VersionAwarePlatformDriver;
*/ */
abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver, VersionAwarePlatformDriver abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver, VersionAwarePlatformDriver
{ {
private const MYSQL_MARIADB_VERSION_REGEXP = '/^(mariadb-)?(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)/';
private const MYSQL_ORACLE_VERSION_REGEXP = '/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?)?/';
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
...@@ -158,7 +154,7 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver, ...@@ -158,7 +154,7 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
*/ */
private function getOracleMysqlVersionNumber(string $versionString) : string private function getOracleMysqlVersionNumber(string $versionString) : string
{ {
if (!preg_match(self::MYSQL_ORACLE_VERSION_REGEXP, $versionString, $versionParts)) { if (!preg_match('/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?)?/', $versionString, $versionParts)) {
throw DBALException::invalidPlatformVersionSpecified( throw DBALException::invalidPlatformVersionSpecified(
$versionString, $versionString,
'<major_version>.<minor_version>.<patch_version>' '<major_version>.<minor_version>.<patch_version>'
...@@ -186,7 +182,7 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver, ...@@ -186,7 +182,7 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
{ {
$version = str_replace('5.5.5-', '', $versionString); $version = str_replace('5.5.5-', '', $versionString);
if (!preg_match(self::MYSQL_MARIADB_VERSION_REGEXP, strtolower($version), $versionParts)) { if (!preg_match('/^(mariadb-)?(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)/', strtolower($version), $versionParts)) {
throw DBALException::invalidPlatformVersionSpecified( throw DBALException::invalidPlatformVersionSpecified(
$version, $version,
'(mariadb-)?<major_version>.<minor_version>.<patch_version>' '(mariadb-)?<major_version>.<minor_version>.<patch_version>'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment