1
0
mirror of https://github.com/php/php-src.git synced 2026-03-29 19:52:20 +02:00

Make MySQLPDOTest::extractVersion() more liberal

MySQL/MariaDB version strings may have suffixes which may contain dots;
for instance, Debian stretch has 5.5.5-10.1.37-MariaDB-0+deb9u1 or
such.  Therefore, we make the version extraction more liberal, and only
require that there are at least three parts separated by dot, and
ignore additional parts.

We also fix an erroneous test expectation, which would be triggered on
CI now, right away.  This patch has been provided by petk@.
This commit is contained in:
Christoph M. Becker
2019-04-28 23:48:27 +02:00
parent 6d8892aacd
commit fc9cdb723b
2 changed files with 2 additions and 2 deletions

View File

@@ -107,7 +107,7 @@ class MySQLPDOTest extends PDOTest {
// stinky string which we need to parse
$parts = explode('.', $version_string);
if (count($parts) != 3)
if (count($parts) < 3)
return -1;
$version = (int)$parts[0] * 10000;

View File

@@ -75,7 +75,7 @@ MySQLPDOTest::skip();
exec_and_count(19, $db, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(255)) BEGIN SELECT VERSION() INTO ver_param; END;', 0);
// we got this far without problems. If there's an issue from now on, its a failure
$ignore_exception = false;
exec_and_count(20, $db, 'CALL p(@version)', 0);
exec_and_count(20, $db, 'CALL p(@version)', 1);
$stmt = $db->query('SELECT @version AS p_version');
$tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (count($tmp) > 1 || !isset($tmp[0]['p_version'])) {