summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql/tests/bug_61411.phpt
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-12-15 17:07:27 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-12-17 10:54:34 +0100
commitc18b1aea289e8ed6edb3f6e6a135018976a034c6 (patch)
treeb0e1811aa85920dfd09ce2921a104dcacb7e8305 /ext/pdo_mysql/tests/bug_61411.phpt
parent33e904915ec9f19b697589d7b73c908953671020 (diff)
downloadphp-git-c18b1aea289e8ed6edb3f6e6a135018976a034c6.tar.gz
PDO MySQL: Use native types for results
Previously, PDO MySQL only fetched data as native int/float if native prepared statements were used. This patch updates PDO to have the same behavior for emulated prepared statements, and thus removes the largest remaining discrepancy between these two modes. Note that PDO already has a ATTR_STRINGIFY_FETCHES option to control whether native types are desired or not. The previous output can be restored by enabling this option. Most of the tests make use of that option, because this allows the tests to work under libmysqlclient as well, which currently always returns string results (independently of whether native or emulated PS are used).
Diffstat (limited to 'ext/pdo_mysql/tests/bug_61411.phpt')
-rw-r--r--ext/pdo_mysql/tests/bug_61411.phpt5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/pdo_mysql/tests/bug_61411.phpt b/ext/pdo_mysql/tests/bug_61411.phpt
index 9390e2abff..d80c685cd7 100644
--- a/ext/pdo_mysql/tests/bug_61411.phpt
+++ b/ext/pdo_mysql/tests/bug_61411.phpt
@@ -30,6 +30,7 @@ if (!$attr) {
}
$attr[PDO::ATTR_PERSISTENT] = true;
$attr[PDO::ATTR_EMULATE_PREPARES] = false;
+$attr[PDO::ATTR_STRINGIFY_FETCHES] = true;
putenv('PDOTEST_ATTR='.serialize($attr));
$db = MySQLPDOTest::factory();
@@ -46,8 +47,8 @@ print "done!";
--EXPECT--
array(2) {
[1]=>
- int(1)
+ string(1) "1"
[0]=>
- int(1)
+ string(1) "1"
}
done!