]> granicus.if.org Git - php/commitdiff
merge from 5.2
authorGeorg Richter <georg@php.net>
Tue, 9 May 2006 13:53:39 +0000 (13:53 +0000)
committerGeorg Richter <georg@php.net>
Tue, 9 May 2006 13:53:39 +0000 (13:53 +0000)
ext/mysqli/tests/bug34785.phpt [new file with mode: 0644]
ext/mysqli/tests/bug36745.phpt [new file with mode: 0644]
ext/mysqli/tests/bug36802.phpt [new file with mode: 0644]

diff --git a/ext/mysqli/tests/bug34785.phpt b/ext/mysqli/tests/bug34785.phpt
new file mode 100644 (file)
index 0000000..a2b9f22
--- /dev/null
@@ -0,0 +1,47 @@
+--TEST--
+Bug #32405
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+       include ("connect.inc");
+
+       class my_stmt extends mysqli_stmt
+       {
+               public function __construct($link, $query) {
+                       parent::__construct($link, $query);
+               }
+       }
+
+       class my_result extends mysqli_result
+       {
+               public function __construct($link, $query) {
+                       parent::__construct($link, $query);
+               }
+       }
+
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $link = mysqli_connect($host, $user, $passwd);
+       mysqli_query($link, "SET sql_mode=''");
+
+       $stmt = new my_stmt($link, "SELECT 'foo' FROM DUAL");
+
+       $stmt->execute();
+       $stmt->bind_result($var);
+       $stmt->fetch();
+
+       $stmt->close();
+       var_dump($var);
+
+       mysqli_real_query($link, "SELECT 'bar' FROM DUAL");
+       $result = new my_result($link, MYSQLI_STORE_RESULT);
+       $row = $result->fetch_row();
+       $result->close();
+
+       var_dump($row[0]);
+
+       mysqli_close($link);
+?>
+--EXPECT--
+string(3) "foo"
+string(3) "bar"
diff --git a/ext/mysqli/tests/bug36745.phpt b/ext/mysqli/tests/bug36745.phpt
new file mode 100644 (file)
index 0000000..7bbfe81
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+bug #36745 : LOAD DATA LOCAL INFILE doesn't return correct error message                                            
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+       include ("connect.inc");
+
+       /*** test mysqli_connect 127.0.0.1 ***/
+       $mysql = mysqli_connect($host, $user, $passwd, "test");
+
+       $mysql->query("DROP TABLE IF EXISTS litest");
+       $mysql->query("CREATE TABLE litest (a VARCHAR(20))");
+
+       $mysql->query("LOAD DATA LOCAL INFILE 'filenotfound' INTO TABLE litest");
+       var_dump($mysql->error);
+
+       $mysql->close();
+       printf("Done");
+?>
+--EXPECT--
+string(31) "Can't find file 'filenotfound'."
+Done
diff --git a/ext/mysqli/tests/bug36802.phpt b/ext/mysqli/tests/bug36802.phpt
new file mode 100644 (file)
index 0000000..69ef56b
--- /dev/null
@@ -0,0 +1,42 @@
+--TEST--
+bug #36802 : crashes with mysql_init                                            
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+       class my_mysqli extends mysqli {
+               function __construct() 
+               {
+               }
+       }
+
+       include "connect.inc";
+
+
+       $mysql = mysqli_init();
+
+       /* following operations should not work */
+       $x[0] = @$mysql->set_charset('utf8');
+       $x[1] = @$mysql->query("SELECT 'foo' FROM DUAL");
+
+       /* following operations should work */ 
+       $x[2] = ($mysql->client_version > 0);
+       $x[3] = $mysql->errno;
+       $mysql->close();
+       
+
+
+       var_dump($x);
+?>
+--EXPECT--
+array(4) {
+  [0]=>
+  NULL
+  [1]=>
+  NULL
+  [2]=>
+  bool(true)
+  [3]=>
+  int(0)
+}