summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql
diff options
context:
space:
mode:
authorYussuf Khalil <dev@pp3345.net>2017-04-05 20:57:03 +0200
committerYussuf Khalil <dev@pp3345.net>2017-04-05 20:57:03 +0200
commit27120d4412a7122f27ac1fcd4d91090ce7979647 (patch)
treefbfd1bd3a744e9edee659840fb21294bd507a0a3 /ext/pdo_mysql
parent4ca3468e78c78ed7f3ecb9624c0ecd3fd442790f (diff)
downloadphp-git-27120d4412a7122f27ac1fcd4d91090ce7979647.tar.gz
Fix invalid free of persistent results on error/connection loss in mysqlnd (bug 74376)
Diffstat (limited to 'ext/pdo_mysql')
-rw-r--r--ext/pdo_mysql/tests/bug_74376.phpt27
1 files changed, 27 insertions, 0 deletions
diff --git a/ext/pdo_mysql/tests/bug_74376.phpt b/ext/pdo_mysql/tests/bug_74376.phpt
new file mode 100644
index 0000000000..29b16748ff
--- /dev/null
+++ b/ext/pdo_mysql/tests/bug_74376.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #74376 (Invalid free of persistent results on error/connection loss)
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
+require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
+require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+MySQLPDOTest::skip();
+?>
+--FILE--
+<?php
+require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+
+$attr = getenv('PDOTEST_ATTR');
+$attr = $attr ? unserialize($attr) : [];
+$attr[PDO::ATTR_PERSISTENT] = true;
+$attr[PDO::ATTR_EMULATE_PREPARES] = false;
+
+putenv('PDOTEST_ATTR=' . serialize($attr));
+
+$db = MySQLPDOTest::factory();
+$stmt = $db->query("select (select 1 union select 2)");
+
+print "ok";
+?>
+--EXPECTF--
+ok