Skip to content

Commit fc9cdb7

Browse files
committed
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@.
1 parent 6d8892a commit fc9cdb7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ext/pdo_mysql/tests/mysql_pdo_test.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class MySQLPDOTest extends PDOTest {
107107

108108
// stinky string which we need to parse
109109
$parts = explode('.', $version_string);
110-
if (count($parts) != 3)
110+
if (count($parts) < 3)
111111
return -1;
112112

113113
$version = (int)$parts[0] * 10000;

ext/pdo_mysql/tests/pdo_mysql_exec.phpt

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

0 commit comments

Comments
 (0)