Author: uwendel
Date: 2007-02-27 16:13:18 +0100 (Tue, 27 Feb 2007)
New Revision: 74
Added:
trunk/ext/mysqli/tests/bug28817.phpt
trunk/ext/mysqli/tests/bug29311.phpt
trunk/ext/mysqli/tests/bug30967.phpt
trunk/ext/mysqli/tests/bug31141.phpt
trunk/ext/mysqli/tests/bug31668.phpt
trunk/ext/mysqli/tests/bug32405.phpt
trunk/ext/mysqli/tests/bug33090.phpt
trunk/ext/mysqli/tests/bug33263.phpt
trunk/ext/mysqli/tests/bug33491.phpt
trunk/ext/mysqli/tests/bug34785.phpt
trunk/ext/mysqli/tests/bug34810.phpt
trunk/ext/mysqli/tests/bug35103.phpt
trunk/ext/mysqli/tests/bug35517.phpt
trunk/ext/mysqli/tests/bug35759.phpt
trunk/ext/mysqli/tests/bug36420.phpt
trunk/ext/mysqli/tests/bug36745.phpt
trunk/ext/mysqli/tests/bug36802.phpt
trunk/ext/mysqli/tests/bug36949.phpt
trunk/ext/mysqli/tests/bug38003.phpt
Log:
Ported ext/mysqli bug/regression tests. All work fine except of #31668. However, it seems
to be only a slightly different behaviour of mysqlnd and not a but that makes it
fail.
Added: trunk/ext/mysqli/tests/bug28817.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug28817.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug28817.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,39 @@
+--TEST--
+Bug #28817 testcase (properties)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+ include "connect.inc";
+
+ class my_mysql extends mysqli {
+ public $p_test;
+
+ function __construct() {
+ $this->p_test[] = "foo";
+ $this->p_test[] = "bar";
+ }
+ }
+
+
+ $mysql = new my_mysql();
+
+ var_dump($mysql->p_test);
+ @var_dump($mysql->errno);
+
+ $mysql->connect($host, $user, $passwd, $db, $port, $socket);
+ $mysql->select_db("nonexistingdb");
+
+ var_dump($mysql->errno > 0);
+
+ $mysql->close();
+?>
+--EXPECTF--
+array(2) {
+ [0]=>
+ %s(3) "foo"
+ [1]=>
+ %s(3) "bar"
+}
+NULL
+bool(true)
Added: trunk/ext/mysqli/tests/bug29311.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug29311.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug29311.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,48 @@
+--TEST--
+constructor test
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+ include "connect.inc";
+
+ /* class 1 calls parent constructor */
+ class mysql1 extends mysqli {
+ function __construct() {
+ global $host, $user, $passwd, $db, $port, $socket;
+ parent::__construct($host, $user, $passwd, $db, $port, $socket);
+ }
+ }
+
+ /* class 2 has an own constructor */
+ class mysql2 extends mysqli {
+
+ function __construct() {
+ global $host, $user, $passwd, $db, $port, $socket;
+ $this->connect($host, $user, $passwd, $db, $port, $socket);
+ }
+ }
+
+ /* class 3 has no constructor */
+ class mysql3 extends mysqli {
+
+ }
+
+ $foo[0] = new mysql1();
+ $foo[1] = new mysql2();
+ $foo[2] = new mysql3($host, $user, $passwd, $db, $port, $socket);
+
+
+ for ($i=0; $i < 3; $i++) {
+ if (($result = $foo[$i]->query("SELECT DATABASE()"))) {
+ $row = $result->fetch_row();
+ printf("%d: %s\n", $i, ($db == $row[0]) ? "test" : "failure");
+ $result->close();
+ }
+ $foo[$i]->close();
+ }
+?>
+--EXPECTF--
+0: test
+1: test
+2: test
Added: trunk/ext/mysqli/tests/bug30967.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug30967.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug30967.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,23 @@
+--TEST--
+Bug #30967 testcase (properties)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+ include "connect.inc";
+
+ class mysql1 extends mysqli {
+ }
+
+ class mysql2 extends mysql1 {
+ }
+
+ $mysql = new mysql2($host, $user, $passwd, $db, $port, $socket);
+
+ $mysql->query("THIS DOES NOT WORK");
+ printf("%d\n", $mysql->errno);
+
+ $mysql->close();
+?>
+--EXPECTF--
+1064
Added: trunk/ext/mysqli/tests/bug31141.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug31141.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug31141.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,29 @@
+--TEST--
+Bug #31141 testcase (properties)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require("connect.inc");
+class Test extends mysqli
+{
+ public $test = array();
+
+ function foo()
+ {
+ $ar_test = array("foo", "bar");
+ $this->test = &$ar_test;
+ }
+}
+
+$my_test = new Test($host, $user, $passwd, $db, $port, $socket);
+$my_test->foo();
+var_dump($my_test->test);
+?>
+--EXPECTF--
+array(2) {
+ [0]=>
+ %s(3) "foo"
+ [1]=>
+ %s(3) "bar"
+}
Added: trunk/ext/mysqli/tests/bug31668.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug31668.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug31668.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,56 @@
+--TEST--
+Bug #31668 multi_query works exactly every other time (multi_query was global, now per
connection)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+ include "connect.inc";
+
+ $mysql = new mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->multi_query('SELECT 1;SELECT 2');
+ do {
+ $res = $mysql->store_result();
+ if ($mysql->errno == 0) {
+ while ($arr = $res->fetch_assoc()) {
+ var_dump($arr);
+ }
+ $res->free();
+ }
+ } while ($mysql->next_result());
+ var_dump($mysql->error, __LINE__);
+ $mysql->close();
+
+ $mysql = new mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->multi_query('SELECT 1;SELECT 2');
+ do {
+ $res = $mysql->store_result();
+ if ($mysql->errno == 0) {
+ while ($arr = $res->fetch_assoc()) {
+ var_dump($arr);
+ }
+ $res->free();
+ }
+ } while ($mysql->next_result());
+ var_dump($mysql->error, __LINE__);
+?>
+--EXPECTF--
+array(1) {
+ [1]=>
+ %s(1) "1"
+}
+array(1) {
+ [2]=>
+ %s(1) "2"
+}
+%s(0) ""
+int(%d)
+array(1) {
+ [1]=>
+ %s(1) "1"
+}
+array(1) {
+ [2]=>
+ %s(1) "2"
+}
+%s(0) ""
+int(%d)
Added: trunk/ext/mysqli/tests/bug32405.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug32405.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug32405.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,41 @@
+--TEST--
+Bug #32405
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+<?php die("skip: PS support not complete"); ?>
+--FILE--
+<?php
+ include ("connect.inc");
+
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ mysqli_select_db($link, $db);
+ mysqli_query($link, "SET sql_mode=''");
+
+ /* two fields are needed. the problem does not occur with 1 field only selected. */
+ $link->query("DROP TABLE IF EXISTS test_users");
+ $link->query("CREATE TABLE test_users(user_id int(10) unsigned NOT NULL
auto_increment, login varchar(50) default '', PRIMARY KEY (user_id))");
+ $link->query('INSERT INTO test_users VALUES (NULL, "user1"), (NULL, "user2"), (NULL,
"user3"), (NULL, "user4")');
+
+
+ if ($stmt = $link->prepare("SELECT SQL_NO_CACHE user_id, login FROM test_users")) {
+ $stmt->execute();
+ $stmt->bind_result($col1, $col2);
+ while ($stmt->fetch()) {
+ var_dump($col1, $col2);
+ }
+ $stmt->close();
+ }
+
+ mysqli_query($link,"DROP TABLE test_users");
+ mysqli_close($link);
+?>
+--EXPECTF--
+int(1)
+%s(5) "user1"
+int(2)
+%s(5) "user2"
+int(3)
+%s(5) "user3"
+int(4)
+%s(5) "user4"
Added: trunk/ext/mysqli/tests/bug33090.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug33090.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug33090.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,22 @@
+--TEST--
+Bug #33090
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+<?php die("skip: PS support not complete"); ?>
+--FILE--
+<?php
+ include ("connect.inc");
+
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ mysqli_select_db($link, $db);
+
+ if (!($link->prepare("this makes no sense"))) {
+ printf("%d\n", $link->errno);
+ printf("%s\n", $link->sqlstate);
+ }
+ $link->close();
+?>
+--EXPECT--
+1064
+42000
Added: trunk/ext/mysqli/tests/bug33263.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug33263.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug33263.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,33 @@
+--TEST--
+bug #33263 (mysqli_real_connect in __construct)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+<?php require_once('skipifemb.inc'); ?>
+<?php die("skip: PS support not complete"); ?>
+--FILE--
+<?php
+
+ include "connect.inc";
+
+ class test extends mysqli
+ {
+ public function __construct($host, $user, $passwd, $db, $port, $socket) {
+ parent::init();
+ parent::real_connect($host, $user, $passwd, $db, $port, $socket);
+ }
+ }
+
+ $mysql = new test($host, $user, $passwd, $db, $port, $socket);
+
+ $stmt = $mysql->prepare("SELECT DATABASE()");
+ $stmt->execute();
+ $stmt->bind_result($db);
+ $stmt->fetch();
+ $stmt->close();
+
+ var_dump($db);
+
+ $mysql->close();
+?>
+--EXPECTF--
+%s(4) "test"
Added: trunk/ext/mysqli/tests/bug33491.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug33491.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug33491.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,26 @@
+--TEST--
+Bug #33491 (extended mysqli class crashes when result is not object)
+--INI--
+error_reporting=4095
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+class DB extends mysqli
+{
+ public function query_single($query) {
+ $result = parent::query($query);
+ $result->fetch_row(); // <- Here be crash
+ }
+}
+
+require_once ("connect.inc");
+
+// Segfault when using the DB class which extends mysqli
+$DB = new DB($host, $user, $passwd, $db, $port, $socket);
+$DB->query_single('SELECT DATE()');
+
+?>
+--EXPECTF--
+Fatal error: Call to a member function fetch_row() on a non-object in %sbug33491.php on
line %d
Added: trunk/ext/mysqli/tests/bug34785.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug34785.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug34785.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,48 @@
+--TEST--
+Bug #34785
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+<?php die("skip: PS support not complete"); ?>
+--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, $db, $port, $socket);
+ 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);
+?>
+--EXPECTF--
+%s(3) "foo"
+%s(3) "bar"
Added: trunk/ext/mysqli/tests/bug34810.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug34810.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug34810.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,39 @@
+--TEST--
+bug #34810 (mysqli::init() and others use wrong $this pointer without checks)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+class DbConnection {
+ public function connect() {
+ include "connect.inc";
+
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ var_dump($link);
+
+ $link = mysqli_init();
+ var_dump($link);
+
+ $mysql = new mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->query("DROP TABLE IF EXISTS test_warnings");
+ $mysql->query("CREATE TABLE test_warnings (a int not null)");
+ $mysql->query("SET sql_mode=''");
+ $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)");
+ var_dump(mysqli_warning::__construct($mysql));
+ }
+}
+
+$db = new DbConnection();
+$db->connect();
+
+echo "Done\n";
+?>
+--EXPECTF--
+object(mysqli)#%d (0) {
+}
+object(mysqli)#%d (0) {
+}
+object(mysqli_warning)#%d (0) {
+}
+Done
Added: trunk/ext/mysqli/tests/bug35103.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug35103.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug35103.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,69 @@
+--TEST--
+bug #35103 Bad handling of unsigned bigint
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+<?php die("skip: PS support not complete"); ?>
+--FILE--
+<?php
+
+$drop = <<<EOSQL
+DROP TABLE test_bint;
+DROP TABLE test_buint;
+EOSQL;
+ include "connect.inc";
+
+ $mysql = new mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->query("DROP TABLE IF EXISTS test_bint");
+ $mysql->query("CREATE TABLE test_bint (a bigint(20) default NULL) ENGINE=MYISAM");
+ $mysql->query("INSERT INTO test_bint VALUES
(9223372036854775807),(-9223372036854775808),(-2147483648),(-2147483649),(-2147483647),(2147483647),(2147483648),(2147483649)");
+
+ $mysql->query("DROP TABLE IF EXISTS test_buint");
+ $mysql->query("CREATE TABLE test_buint (a bigint(20) unsigned default NULL)");
+ $mysql->query("INSERT INTO test_buint VALUES
(18446744073709551615),(9223372036854775807),(9223372036854775808),(2147483647),(2147483649),(4294967295)");
+
+ $stmt = $mysql->prepare("SELECT a FROM test_bint ORDER BY a");
+ $stmt->bind_result($v);
+ $stmt->execute();
+ $i=0;
+ echo "BIG INT SIGNED, TEST\n";
+ while ($i++ < 8) {
+ $stmt->fetch();
+ echo $v, "\n";
+ }
+ $stmt->close();
+
+ echo str_repeat("-", 20), "\n";
+
+ $stmt = $mysql->prepare("SELECT a FROM test_buint ORDER BY a");
+ $stmt->bind_result($v2);
+ $stmt->execute();
+ $j=0;
+ echo "BIG INT UNSIGNED TEST\n";
+ while ($j++ < 6) {
+ $stmt->fetch();
+ echo $v2, "\n";
+ }
+ $stmt->close();
+
+ $mysql->multi_query($drop);
+
+ $mysql->close();
+?>
+--EXPECT--
+BIG INT SIGNED, TEST
+-9223372036854775808
+-2147483649
+-2147483648
+-2147483647
+2147483647
+2147483648
+2147483649
+9223372036854775807
+--------------------
+BIG INT UNSIGNED TEST
+2147483647
+2147483649
+4294967295
+9223372036854775807
+9223372036854775808
+18446744073709551615
Added: trunk/ext/mysqli/tests/bug35517.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug35517.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug35517.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,30 @@
+--TEST--
+Bug #35517 mysqli_stmt_fetch returns NULL
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+<?php die("skip: PS support not complete"); ?>
+--FILE--
+<?php
+ include "connect.inc";
+
+ $mysql = new mysqli($host, $user, $passwd, $db, $port, $socket);
+
+ $mysql->query("CREATE TABLE temp (id INT UNSIGNED NOT NULL)");
+ $mysql->query("INSERT INTO temp (id) VALUES
(3000000897),(3800001532),(3900002281),(3100059612)");
+
+ $stmt = $mysql->prepare("SELECT id FROM temp");
+ $stmt->execute();
+ $stmt->bind_result($id);
+ while ($stmt->fetch()) {
+ var_dump($id);
+ }
+ $stmt->close();
+
+ $mysql->query("DROP TABLE temp");
+ $mysql->close();
+?>
+--EXPECTF--
+%s(10) "3000000897"
+%s(10) "3800001532"
+%s(10) "3900002281"
+%s(10) "3100059612"
Added: trunk/ext/mysqli/tests/bug35759.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug35759.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug35759.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,45 @@
+--TEST--
+bug #35759 : mysqli_stmt_bind_result() makes huge allocation when column empty
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+<?php die("skip: PS support not complete"); ?>
+--FILE--
+<?php
+
+$sql=<<<EOSQL
+CREATE TABLE blobby (
+ a1 MEDIUMBLOB NOT NULL,
+
+
+EOSQL;
+ include "connect.inc";
+ $col_num= 1000;
+
+ $mysql = new mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->query("DROP TABLE IF EXISTS blobby");
+ $create = "CREATE TABLE blobby (a0 MEDIUMBLOB NOT NULL DEFAULT ''";
+ $i= 0;
+ while (++$i < $col_num) {
+ $create .= ", a$i MEDIUMBLOB NOT NULL DEFAULT ''";
+ }
+ $create .= ")";
+
+ $mysql->query($create);
+ $mysql->query("INSERT INTO blobby (a0) VALUES ('')");
+
+ $stmt = $mysql->prepare("SELECT * FROM blobby");
+ $stmt->execute();
+ $stmt->store_result();
+ $params= array_pad(array(), $col_num, "");
+ call_user_func_array(array($stmt, "bind_result"), $params);
+ $stmt->fetch();
+
+ $stmt->close();
+
+ $mysql->query("DROP TABLE blobby");
+
+ $mysql->close();
+ echo "OK\n";
+?>
+--EXPECT--
+OK
Added: trunk/ext/mysqli/tests/bug36420.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug36420.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug36420.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,25 @@
+--TEST--
+bug #36420 (segfault when access result->num_rows after calling result->close())
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+include "connect.inc";
+$mysqli = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+
+$result = $mysqli->query('select 1');
+
+$result->close();
+echo $result->num_rows;
+
+$mysqli->close();
+echo $result->num_rows;
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: main(): Couldn't fetch mysqli_result in %s on line %d
+
+Warning: main(): Couldn't fetch mysqli_result in %s on line %d
+Done
Added: trunk/ext/mysqli/tests/bug36745.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug36745.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug36745.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -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, $db, $port, $socket);
+
+ $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");
+?>
+--EXPECTF--
+%s(%d) "%s"
+Done
Added: trunk/ext/mysqli/tests/bug36802.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug36802.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug36802.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,46 @@
+--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 */
+ if (method_exists($mysql, 'set_charset')) {
+ $x[0] = @$mysql->set_charset('utf8');
+ } else {
+ $x[0] = NULL;
+ }
+ $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)
+}
Added: trunk/ext/mysqli/tests/bug36949.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug36949.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug36949.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,50 @@
+--TEST--
+bug #36949
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+include "connect.inc";
+
+class A {
+
+ private $mysqli;
+
+ public function __construct() {
+ global $user, $host, $passwd, $db, $port, $socket;
+ $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
+ $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL");
+ $row = $result->fetch_object();
+ echo $row->my_time."<br>\n";
+ $result->close();
+ }
+
+ public function __destruct() {
+ $this->mysqli->close();
+ }
+}
+
+class B {
+
+ private $mysqli;
+
+ public function __construct() {
+ global $user, $host, $passwd, $db, $port, $socket;
+ $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
+ $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL");
+ $row = $result->fetch_object();
+ echo $row->my_time."<br>\n";
+ $result->close();
+ }
+
+ public function __destruct() {
+ $this->mysqli->close();
+ }
+}
+
+$A = new A();
+$B = new B();
+?>
+--EXPECTF--
+%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d<br>
+%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d<br>
Added: trunk/ext/mysqli/tests/bug38003.phpt
===================================================================
--- trunk/ext/mysqli/tests/bug38003.phpt 2007-02-27 12:20:18 UTC (rev 73)
+++ trunk/ext/mysqli/tests/bug38003.phpt 2007-02-27 15:13:18 UTC (rev 74)
@@ -0,0 +1,20 @@
+--TEST--
+Bug #38003 (in classes inherited from MySQLi it's possible to call private constructors
from invalid context)
+--SKIPIF--
+<?php if (!extension_loaded("mysqli")) print "skip"; ?>
+--FILE--
+<?php
+
+class DB extends mysqli {
+
+ private function __construct($hostname, $username, $password, $database) {
+ var_dump("DB::__construct() called");
+ }
+}
+
+$DB = new DB();
+
+echo "Done\n";
+?>
+--EXPECTF--
+Fatal error: Call to private DB::__construct() from invalid context in %s on line %d
| Thread |
|---|
| • PHP mysqlnd svn commit: r74 - trunk/ext/mysqli/tests | uwendel | 27 Feb |