]> granicus.if.org Git - php/commitdiff
Make MySQLPDOTest::extractVersion() more liberal
authorChristoph M. Becker <cmbecker69@gmx.de>
Sun, 28 Apr 2019 21:48:27 +0000 (23:48 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Sun, 28 Apr 2019 21:48:27 +0000 (23:48 +0200)
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@.

ext/pdo_mysql/tests/mysql_pdo_test.inc
ext/pdo_mysql/tests/pdo_mysql_exec.phpt

index d6d06be72f4e7d098d2c2465673d265c36e11d2a..65ad7b2d17c2e77c3d67816299a839d24b1c984d 100644 (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;
index acd90904f7e18e8eaabd818dd72f81b14dd9b656..983073782e46d685013fde832d4e89fb527e3de5 100644 (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'])) {