summaryrefslogtreecommitdiff
path: root/ext/mysql
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2011-01-07 14:22:30 (GMT)
committerAndrey Hristov <andrey@php.net>2011-01-07 14:22:30 (GMT)
commit5549e066f2970d11e4346259057eac2046234fb4 (patch)
tree3c29f226fafd0a8231d307201214fad385ac1560 /ext/mysql
parentabf0ea0110bbcd598badf6bb9eabb052ee841cad (diff)
downloadphp-5549e066f2970d11e4346259057eac2046234fb4.tar.gz
Proper fix for
Bug #53503 mysqli::query returns false after successful LOAD DATA query which fixes als #56349, same behavior but in ext/mysql. Both due to a bug in mysqlnd. Never was a problem with libmysql. Also fixed the 53503's test case as it always reported PASS, even when there should have been a failure.
Diffstat (limited to 'ext/mysql')
-rw-r--r--ext/mysql/tests/bug53649.phpt53
1 files changed, 53 insertions, 0 deletions
diff --git a/ext/mysql/tests/bug53649.phpt b/ext/mysql/tests/bug53649.phpt
new file mode 100644
index 0000000..126f34b
--- /dev/null
+++ b/ext/mysql/tests/bug53649.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Bug #53649 (mysql_query with "load data" unable to save result set)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
+--FILE--
+<?php
+ require_once("connect.inc");
+
+ if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (!mysql_query("DROP TABLE IF EXISTS tlocaldata", $link)) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ if (!mysql_query("CREATE TABLE tlocaldata (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine, $link)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ file_put_contents('bug53649.data', "1\n2\n3\n");
+
+ mysql_query("SELECT 1 FROM DUAL", $link);
+
+ if (!mysql_query("LOAD DATA LOCAL INFILE 'bug53649.data' INTO TABLE tlocaldata", $link)) {
+ echo "bug";
+ } else {
+ echo "done";
+ }
+ mysql_close($link);
+?>
+--CLEAN--
+<?php
+require_once('connect.inc');
+
+if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+}
+
+if (!mysql_query($link, 'DROP TABLE IF EXISTS tlocaldata', $link)) {
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+}
+
+mysql_close($link);
+
+unlink('bug53649.data');
+?>
+--EXPECT--
+done \ No newline at end of file