summaryrefslogtreecommitdiff
path: root/ext/mysqli
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mysqli')
-rw-r--r--ext/mysqli/tests/bug49027.phpt28
-rw-r--r--ext/mysqli/tests/table_real_connect.inc23
2 files changed, 51 insertions, 0 deletions
diff --git a/ext/mysqli/tests/bug49027.phpt b/ext/mysqli/tests/bug49027.phpt
new file mode 100644
index 0000000000..9e5a7554cb
--- /dev/null
+++ b/ext/mysqli/tests/bug49027.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #49027 (mysqli_options() doesn't work when using mysqlnd)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
+--FILE--
+<?php
+ include ("connect.inc");
+
+ $link=mysqli_init();
+ if (!mysqli_options($link, MYSQLI_INIT_COMMAND, "SELECT 1")){
+ echo "Broken 2!\n";
+ }
+ if (!mysqli_options($link, MYSQLI_INIT_COMMAND, "SELECT 13")){
+ echo "Broken 2!\n";
+ }
+
+ require('table_real_connect.inc');
+
+ var_dump($link->query("SELECT 42")->fetch_row());
+?>
+--EXPECTF--
+array(1) {
+ [0]=>
+ %unicode|string%(2) "42"
+}
diff --git a/ext/mysqli/tests/table_real_connect.inc b/ext/mysqli/tests/table_real_connect.inc
new file mode 100644
index 0000000000..ca3c1f1188
--- /dev/null
+++ b/ext/mysqli/tests/table_real_connect.inc
@@ -0,0 +1,23 @@
+<?PHP
+require_once('connect.inc');
+
+if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ exit(1);
+}
+
+if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ exit(1);
+}
+
+if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) {
+ printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ exit(1);
+}
+
+if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')")) {
+ printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link));
+}
+?>