From 9751d9afaa3d06a9cd52f1453553feb915d3f6d1 Mon Sep 17 00:00:00 2001 From: Georg Richter Date: Sat, 4 Dec 2004 08:16:04 +0000 Subject: [PATCH] Fixed bug #30890 (testsuite) Fixed bug #28817 (property problems in extended class) --- ext/mysqli/mysqli.c | 7 ++----- ext/mysqli/mysqli_prop.c | 34 +++++++++++++++---------------- ext/mysqli/tests/001.phpt | 25 +++++++---------------- ext/mysqli/tests/002.phpt | 2 +- ext/mysqli/tests/003.phpt | 2 +- ext/mysqli/tests/004.phpt | 2 +- ext/mysqli/tests/005.phpt | 2 +- ext/mysqli/tests/006.phpt | 2 +- ext/mysqli/tests/007.phpt | 2 +- ext/mysqli/tests/008.phpt | 2 +- ext/mysqli/tests/009.phpt | 2 +- ext/mysqli/tests/010.phpt | 2 +- ext/mysqli/tests/011.phpt | 2 +- ext/mysqli/tests/012.phpt | 2 +- ext/mysqli/tests/013.phpt | 2 +- ext/mysqli/tests/014.phpt | 4 ++-- ext/mysqli/tests/015.phpt | 4 ++-- ext/mysqli/tests/016.phpt | 2 +- ext/mysqli/tests/017.phpt | 8 +++++--- ext/mysqli/tests/018.phpt | 2 +- ext/mysqli/tests/019.phpt | 2 +- ext/mysqli/tests/020.phpt | 2 +- ext/mysqli/tests/021.phpt | 2 +- ext/mysqli/tests/022.phpt | 2 +- ext/mysqli/tests/023.phpt | 2 +- ext/mysqli/tests/024.phpt | 2 +- ext/mysqli/tests/025.phpt | 2 +- ext/mysqli/tests/026.phpt | 6 ++---- ext/mysqli/tests/027.phpt | 6 ++---- ext/mysqli/tests/028.phpt | 6 ++---- ext/mysqli/tests/029.phpt | 6 ++---- ext/mysqli/tests/030.phpt | 5 ++--- ext/mysqli/tests/031.phpt | 5 ++--- ext/mysqli/tests/032.phpt | 6 ++---- ext/mysqli/tests/033.phpt | 6 ++---- ext/mysqli/tests/034.phpt | 6 ++---- ext/mysqli/tests/035.phpt | 6 ++---- ext/mysqli/tests/036.phpt | 2 +- ext/mysqli/tests/037.phpt | 2 +- ext/mysqli/tests/038.phpt | 2 +- ext/mysqli/tests/039.phpt | 2 +- ext/mysqli/tests/040.phpt | 2 +- ext/mysqli/tests/041.phpt | 2 +- ext/mysqli/tests/042.phpt | 2 +- ext/mysqli/tests/043.phpt | 2 +- ext/mysqli/tests/044.phpt | 2 +- ext/mysqli/tests/045.phpt | 4 ++-- ext/mysqli/tests/046.phpt | 2 +- ext/mysqli/tests/047.phpt | 2 +- ext/mysqli/tests/048.phpt | 2 +- ext/mysqli/tests/049.phpt | 12 +++++------ ext/mysqli/tests/050.phpt | 2 +- ext/mysqli/tests/051.phpt | 2 +- ext/mysqli/tests/052.phpt | 2 +- ext/mysqli/tests/053.phpt | 2 +- ext/mysqli/tests/054.phpt | 2 +- ext/mysqli/tests/055.phpt | 2 +- ext/mysqli/tests/056.phpt | 2 +- ext/mysqli/tests/057.phpt | 2 +- ext/mysqli/tests/058.phpt | 2 +- ext/mysqli/tests/059.phpt | 2 +- ext/mysqli/tests/060.phpt | 2 +- ext/mysqli/tests/061.phpt | 2 +- ext/mysqli/tests/bug28817.phpt | 37 ++++++++++++++++++++++++++++++++++ ext/mysqli/tests/bug29311.phpt | 8 +++++--- ext/mysqli/tests/bug30967.phpt | 2 +- 66 files changed, 150 insertions(+), 143 deletions(-) create mode 100644 ext/mysqli/tests/bug28817.phpt diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 833d8a5d07..e263f7f41d 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -179,11 +179,6 @@ zval *mysqli_read_property(zval *object, zval *member, int type TSRMLS_DC) ret = FAILURE; obj = (mysqli_object *)zend_objects_get_address(object TSRMLS_CC); - if (!obj->valid) { - retval = EG(uninitialized_zval_ptr); - return(retval); - } - if (member->type != IS_STRING) { tmp_member = *member; zval_copy_ctor(&tmp_member); @@ -194,6 +189,7 @@ zval *mysqli_read_property(zval *object, zval *member, int type TSRMLS_DC) if (obj->prop_handler != NULL) { ret = zend_hash_find(obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &hnd); } + if (ret == SUCCESS) { /* check if mysqli object is still valid */ @@ -223,6 +219,7 @@ zval *mysqli_read_property(zval *object, zval *member, int type TSRMLS_DC) } else { std_hnd = zend_get_std_object_handlers(); retval = std_hnd->read_property(object, member, type TSRMLS_CC); + retval->refcount = 1; } if (member == &tmp_member) { diff --git a/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c index f5792b77a6..2784683718 100644 --- a/ext/mysqli/mysqli_prop.c +++ b/ext/mysqli/mysqli_prop.c @@ -29,6 +29,13 @@ #include "ext/standard/info.h" #include "php_mysqli.h" +#define CHECK_OBJECT() \ + if (!obj->valid) { \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Property access is not allowed yet. Call the default constructor of the object first"); \ + ZVAL_NULL(*retval); \ + return SUCCESS; \ + } \ + #define MYSQLI_GET_MYSQL() \ MYSQL *p = (MYSQL *)((MY_MYSQL *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr)->mysql; @@ -41,9 +48,10 @@ MYSQL_STMT *p = (MYSQL_STMT *)((MY_STMT *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr)- #define MYSQLI_MAP_PROPERTY_FUNC_LONG( __func, __int_func, __get_type, __ret_type)\ int __func(mysqli_object *obj, zval **retval TSRMLS_DC) \ {\ + ALLOC_ZVAL(*retval); \ + CHECK_OBJECT(); \ __ret_type l;\ __get_type;\ - ALLOC_ZVAL(*retval);\ if (!p) {\ ZVAL_NULL(*retval);\ } else {\ @@ -63,8 +71,9 @@ int __func(mysqli_object *obj, zval **retval TSRMLS_DC) \ int __func(mysqli_object *obj, zval **retval TSRMLS_DC)\ {\ char *c;\ + ALLOC_ZVAL(*retval); \ + CHECK_OBJECT(); \ __get_type;\ - ALLOC_ZVAL(*retval);\ if (!p) {\ ZVAL_NULL(*retval);\ } else {\ @@ -95,18 +104,6 @@ int link_client_info_read(mysqli_object *obj, zval **retval TSRMLS_DC) return SUCCESS; } /* }}} */ -/* {{{ property link_test_read */ -int link_test_read(mysqli_object *obj, zval **retval TSRMLS_DC) -{ - long i; - ALLOC_ZVAL(*retval); - array_init(*retval); - - for (i=0; i < 10; i++) - add_index_long(*retval, i, i + 10); - return SUCCESS; -} -/*i }}} */ /* {{{ property link_connect_errno_read */ int link_connect_errno_read(mysqli_object *obj, zval **retval TSRMLS_DC) @@ -146,9 +143,11 @@ MYSQLI_MAP_PROPERTY_FUNC_LONG(link_warning_count_read, mysql_warning_count, MYSQ /* {{{ property result_type_read */ int result_type_read(mysqli_object *obj, zval **retval TSRMLS_DC) { + ALLOC_ZVAL(*retval); + CHECK_OBJECT(); + MYSQL_RES *p = (MYSQL_RES *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr; - ALLOC_ZVAL(*retval); if (!p) { ZVAL_NULL(*retval); } else { @@ -161,9 +160,11 @@ int result_type_read(mysqli_object *obj, zval **retval TSRMLS_DC) /* {{{ property result_lengths_read */ int result_lengths_read(mysqli_object *obj, zval **retval TSRMLS_DC) { + ALLOC_ZVAL(*retval); + CHECK_OBJECT(); + MYSQL_RES *p = (MYSQL_RES *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr; - ALLOC_ZVAL(*retval); if (!p || !p->field_count) { ZVAL_NULL(*retval); } else { @@ -201,7 +202,6 @@ mysqli_property_entry mysqli_link_property_entries[] = { {"affected_rows", link_affected_rows_read, NULL}, {"client_info", link_client_info_read, NULL}, {"client_version", link_client_version_read, NULL}, - {"test", link_test_read, NULL}, {"connect_errno", link_connect_errno_read, NULL}, {"connect_error", link_connect_error_read, NULL}, {"errno", link_errno_read, NULL}, diff --git a/ext/mysqli/tests/001.phpt b/ext/mysqli/tests/001.phpt index 5e483aba8d..8c9dc41f31 100644 --- a/ext/mysqli/tests/001.phpt +++ b/ext/mysqli/tests/001.phpt @@ -2,48 +2,37 @@ mysqli connect --FILE-- --EXPECT-- -string(7) "1111111" +string(5) "11111" diff --git a/ext/mysqli/tests/002.phpt b/ext/mysqli/tests/002.phpt index 7925f84fa8..255944a4ec 100644 --- a/ext/mysqli/tests/002.phpt +++ b/ext/mysqli/tests/002.phpt @@ -5,7 +5,7 @@ mysqli bind_result 1 include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); $rc = mysqli_query($link,"DROP TABLE IF EXISTS test_fetch_null"); diff --git a/ext/mysqli/tests/003.phpt b/ext/mysqli/tests/003.phpt index 906bf28dec..0500ec5577 100644 --- a/ext/mysqli/tests/003.phpt +++ b/ext/mysqli/tests/003.phpt @@ -5,7 +5,7 @@ mysqli connect include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/004.phpt b/ext/mysqli/tests/004.phpt index 179c4b64cf..33815c2f76 100644 --- a/ext/mysqli/tests/004.phpt +++ b/ext/mysqli/tests/004.phpt @@ -5,7 +5,7 @@ mysqli fetch char/text include ("connect.inc"); /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/005.phpt b/ext/mysqli/tests/005.phpt index 982a3950f2..48a0d77983 100644 --- a/ext/mysqli/tests/005.phpt +++ b/ext/mysqli/tests/005.phpt @@ -5,7 +5,7 @@ mysqli fetch char/text long include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/006.phpt b/ext/mysqli/tests/006.phpt index d697e1e82f..87fbc609e5 100644 --- a/ext/mysqli/tests/006.phpt +++ b/ext/mysqli/tests/006.phpt @@ -5,7 +5,7 @@ mysqli fetch long values include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/007.phpt b/ext/mysqli/tests/007.phpt index 2470c20e7e..bd96961886 100644 --- a/ext/mysqli/tests/007.phpt +++ b/ext/mysqli/tests/007.phpt @@ -5,7 +5,7 @@ mysqli fetch short values include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/008.phpt b/ext/mysqli/tests/008.phpt index c0ee735096..a57730bfc8 100644 --- a/ext/mysqli/tests/008.phpt +++ b/ext/mysqli/tests/008.phpt @@ -5,7 +5,7 @@ mysqli fetch tinyint values include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/009.phpt b/ext/mysqli/tests/009.phpt index 042f837849..89f2d6e2e7 100644 --- a/ext/mysqli/tests/009.phpt +++ b/ext/mysqli/tests/009.phpt @@ -5,7 +5,7 @@ mysqli fetch bigint values include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/010.phpt b/ext/mysqli/tests/010.phpt index 4584e0a91f..207144c92b 100644 --- a/ext/mysqli/tests/010.phpt +++ b/ext/mysqli/tests/010.phpt @@ -7,7 +7,7 @@ precision=12 include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/011.phpt b/ext/mysqli/tests/011.phpt index 987ec1d14a..fab8522a17 100644 --- a/ext/mysqli/tests/011.phpt +++ b/ext/mysqli/tests/011.phpt @@ -7,7 +7,7 @@ precision=12 include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/012.phpt b/ext/mysqli/tests/012.phpt index 9af509fefd..5bc766a4ab 100644 --- a/ext/mysqli/tests/012.phpt +++ b/ext/mysqli/tests/012.phpt @@ -7,7 +7,7 @@ precision=12 include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/013.phpt b/ext/mysqli/tests/013.phpt index b095419199..b4f9e4e166 100644 --- a/ext/mysqli/tests/013.phpt +++ b/ext/mysqli/tests/013.phpt @@ -5,7 +5,7 @@ mysqli fetch mixed / mysql_query include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/014.phpt b/ext/mysqli/tests/014.phpt index 8a72c42c7f..162114cdc7 100644 --- a/ext/mysqli/tests/014.phpt +++ b/ext/mysqli/tests/014.phpt @@ -3,7 +3,7 @@ mysqli autocommit/commit/rollback --SKIPIF-- - string(14) "root@localhost" + int(1) [1]=> string(4) "test" [2]=> diff --git a/ext/mysqli/tests/018.phpt b/ext/mysqli/tests/018.phpt index a0a247611d..0fb2864d52 100644 --- a/ext/mysqli/tests/018.phpt +++ b/ext/mysqli/tests/018.phpt @@ -5,7 +5,7 @@ mysqli fetch system variables include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/019.phpt b/ext/mysqli/tests/019.phpt index f7aab7a799..39dd9c83a6 100644 --- a/ext/mysqli/tests/019.phpt +++ b/ext/mysqli/tests/019.phpt @@ -5,7 +5,7 @@ mysqli fetch (bind_param + bind_result) include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); $rc = mysqli_query($link,"DROP TABLE IF EXISTS insert_read"); diff --git a/ext/mysqli/tests/020.phpt b/ext/mysqli/tests/020.phpt index d08930fed9..62c1657733 100644 --- a/ext/mysqli/tests/020.phpt +++ b/ext/mysqli/tests/020.phpt @@ -5,7 +5,7 @@ mysqli bind_param/bind_result date include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/021.phpt b/ext/mysqli/tests/021.phpt index 614f978aaf..0ff22d4da3 100644 --- a/ext/mysqli/tests/021.phpt +++ b/ext/mysqli/tests/021.phpt @@ -5,7 +5,7 @@ mysqli bind_param+bind_result char/text include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/022.phpt b/ext/mysqli/tests/022.phpt index 2fb2bcdb62..888834296c 100644 --- a/ext/mysqli/tests/022.phpt +++ b/ext/mysqli/tests/022.phpt @@ -5,7 +5,7 @@ mysqli bind_param/bind_result char/text long include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/023.phpt b/ext/mysqli/tests/023.phpt index 258f1852d0..5f5e320ab7 100644 --- a/ext/mysqli/tests/023.phpt +++ b/ext/mysqli/tests/023.phpt @@ -5,7 +5,7 @@ mysqli bind_param/bind_prepare fetch long values include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/024.phpt b/ext/mysqli/tests/024.phpt index de0eead6ed..7ea92479d4 100644 --- a/ext/mysqli/tests/024.phpt +++ b/ext/mysqli/tests/024.phpt @@ -5,7 +5,7 @@ mysqli bind_param/bind_result short values include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/025.phpt b/ext/mysqli/tests/025.phpt index 3d643ad872..ba9db661a7 100644 --- a/ext/mysqli/tests/025.phpt +++ b/ext/mysqli/tests/025.phpt @@ -5,7 +5,7 @@ mysqli bind_param/bind_result tinyint values include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/026.phpt b/ext/mysqli/tests/026.phpt index 2c7f9f02bd..9b480bb65d 100644 --- a/ext/mysqli/tests/026.phpt +++ b/ext/mysqli/tests/026.phpt @@ -2,12 +2,10 @@ mysqli bind_param/bind_result with send_long_data --FILE-- select_db("test"); $mysql->query("DROP TABLE IF EXISTS test_fetch_null"); diff --git a/ext/mysqli/tests/049.phpt b/ext/mysqli/tests/049.phpt index 04e705de6e..869220d92e 100644 --- a/ext/mysqli/tests/049.phpt +++ b/ext/mysqli/tests/049.phpt @@ -5,19 +5,17 @@ mysql_fetch_row (OO-Style) include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $mysql = mysqli_connect("localhost", $user, $passwd); + $mysql = mysqli_connect($host, $user, $passwd); $mysql->select_db("test"); $result = $mysql->query("SELECT CURRENT_USER()"); $row = $result->fetch_row(); $result->close(); - - var_dump($row); + + $ok = ($row[0] == $user . "@" . $host); + var_dump($ok); $mysql->close(); ?> --EXPECT-- -array(1) { - [0]=> - string(14) "root@localhost" -} +bool(true) diff --git a/ext/mysqli/tests/050.phpt b/ext/mysqli/tests/050.phpt index 9ab5d346f8..3e8a8a37fb 100644 --- a/ext/mysqli/tests/050.phpt +++ b/ext/mysqli/tests/050.phpt @@ -7,7 +7,7 @@ non freed statement test /************************ * non freed stamement ************************/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); $stmt = mysqli_prepare($link, "SELECT CURRENT_USER()"); mysqli_execute($stmt); diff --git a/ext/mysqli/tests/051.phpt b/ext/mysqli/tests/051.phpt index dde734a1e0..807cc2f275 100644 --- a/ext/mysqli/tests/051.phpt +++ b/ext/mysqli/tests/051.phpt @@ -7,7 +7,7 @@ free statement after close /************************ * free statement after close ************************/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); $stmt1 = mysqli_prepare($link, "SELECT CURRENT_USER()"); mysqli_execute($stmt1); diff --git a/ext/mysqli/tests/052.phpt b/ext/mysqli/tests/052.phpt index 4ae9b12c50..cda1b2c844 100644 --- a/ext/mysqli/tests/052.phpt +++ b/ext/mysqli/tests/052.phpt @@ -7,7 +7,7 @@ call statement after close /************************ * statement call after close ************************/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()"); diff --git a/ext/mysqli/tests/053.phpt b/ext/mysqli/tests/053.phpt index f542d0f099..4bfce10b14 100644 --- a/ext/mysqli/tests/053.phpt +++ b/ext/mysqli/tests/053.phpt @@ -7,7 +7,7 @@ not freed resultset /************************ * non freed resultset ************************/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); $result = mysqli_query($link, "SELECT CURRENT_USER()"); mysqli_close($link); diff --git a/ext/mysqli/tests/054.phpt b/ext/mysqli/tests/054.phpt index eab207db4d..7c9b51fe46 100644 --- a/ext/mysqli/tests/054.phpt +++ b/ext/mysqli/tests/054.phpt @@ -7,7 +7,7 @@ free resultset after close /************************ * free resultset after close ************************/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); $result1 = mysqli_query($link, "SELECT CURRENT_USER()"); mysqli_close($link); diff --git a/ext/mysqli/tests/055.phpt b/ext/mysqli/tests/055.phpt index e777bcfc99..8fa374a6c7 100644 --- a/ext/mysqli/tests/055.phpt +++ b/ext/mysqli/tests/055.phpt @@ -7,7 +7,7 @@ free nothing /************************ * don't free anything ************************/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); $result2 = mysqli_query($link, "SELECT CURRENT_USER()"); $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()"); diff --git a/ext/mysqli/tests/056.phpt b/ext/mysqli/tests/056.phpt index cee7df1e5f..a681ffcf49 100644 --- a/ext/mysqli/tests/056.phpt +++ b/ext/mysqli/tests/056.phpt @@ -11,7 +11,7 @@ extend mysqli } $foo = new foobar(); - $foo->connect("localhost", $user, $passwd); + $foo->connect($host, $user, $passwd); $foo->close(); printf("%s\n", $foo->test()); ?> diff --git a/ext/mysqli/tests/057.phpt b/ext/mysqli/tests/057.phpt index 581201d8ef..fcd07f6f0b 100644 --- a/ext/mysqli/tests/057.phpt +++ b/ext/mysqli/tests/057.phpt @@ -5,7 +5,7 @@ mysqli_get_metadata include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/058.phpt b/ext/mysqli/tests/058.phpt index d46e8d65a8..95bdbc1cbe 100644 --- a/ext/mysqli/tests/058.phpt +++ b/ext/mysqli/tests/058.phpt @@ -5,7 +5,7 @@ multiple binds include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/059.phpt b/ext/mysqli/tests/059.phpt index 80d8a35012..151c3de961 100644 --- a/ext/mysqli/tests/059.phpt +++ b/ext/mysqli/tests/059.phpt @@ -5,7 +5,7 @@ sqlmode + bind include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/060.phpt b/ext/mysqli/tests/060.phpt index f7afaa7e1a..7c753743cd 100644 --- a/ext/mysqli/tests/060.phpt +++ b/ext/mysqli/tests/060.phpt @@ -11,7 +11,7 @@ mysqli_fetch_object with classes } /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd); + $link = mysqli_connect($host, $user, $passwd); mysqli_select_db($link, "test"); diff --git a/ext/mysqli/tests/061.phpt b/ext/mysqli/tests/061.phpt index 438f4a203a..f1c2970011 100644 --- a/ext/mysqli/tests/061.phpt +++ b/ext/mysqli/tests/061.phpt @@ -10,7 +10,7 @@ local infile handler } /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect("localhost", $user, $passwd, "test"); + $link = mysqli_connect($host, $user, $passwd, "test"); /* create temporary file */ $fp = fopen("061.csv", "w"); diff --git a/ext/mysqli/tests/bug28817.phpt b/ext/mysqli/tests/bug28817.phpt new file mode 100644 index 0000000000..9f2aae9563 --- /dev/null +++ b/ext/mysqli/tests/bug28817.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #28817 testcase (properties) +--FILE-- +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); + $mysql->select_db("nonexistingdb"); + + var_dump($mysql->errno > 0); + + $mysql->close(); +?> +--EXPECTF-- +array(2) { + [0]=> + string(3) "foo" + [1]=> + string(3) "bar" +} +NULL +bool(true) diff --git a/ext/mysqli/tests/bug29311.phpt b/ext/mysqli/tests/bug29311.phpt index 82845e16d6..53710cbdc8 100644 --- a/ext/mysqli/tests/bug29311.phpt +++ b/ext/mysqli/tests/bug29311.phpt @@ -7,7 +7,8 @@ constructor test /* class 1 calls parent constructor */ class mysql1 extends mysqli { function __construct() { - parent::__construct("localhost", "root", "", "test"); + global $host, $user, $passwd; + parent::__construct($host, $user, $passwd, "test"); } } @@ -15,7 +16,8 @@ constructor test class mysql2 extends mysqli { function __construct() { - $this->connect("localhost", "root", "", "test"); + global $host, $user, $passwd; + $this->connect($host, $user, $passwd, "test"); } } @@ -26,7 +28,7 @@ constructor test $foo[0] = new mysql1(); $foo[1] = new mysql2(); - $foo[2] = new mysql3("localhost", "root", "", "test"); + $foo[2] = new mysql3($host, $user, $passwd, "test"); for ($i=0; $i < 3; $i++) { diff --git a/ext/mysqli/tests/bug30967.phpt b/ext/mysqli/tests/bug30967.phpt index f441cf0f19..dd40194744 100644 --- a/ext/mysqli/tests/bug30967.phpt +++ b/ext/mysqli/tests/bug30967.phpt @@ -10,7 +10,7 @@ Bug #30967 testcase (properties) class mysql2 extends mysql1 { } - $mysql = new mysql2("localhost", "root", "", "test"); + $mysql = new mysql2($host, "root", "", "test"); $mysql->query("THIS DOES NOT WORK"); printf("%d\n", $mysql->errno); -- 2.50.1