]> granicus.if.org Git - php/commitdiff
Fixed bug #30890 (testsuite)
authorGeorg Richter <georg@php.net>
Sat, 4 Dec 2004 08:16:04 +0000 (08:16 +0000)
committerGeorg Richter <georg@php.net>
Sat, 4 Dec 2004 08:16:04 +0000 (08:16 +0000)
Fixed bug #28817 (property problems in extended class)

66 files changed:
ext/mysqli/mysqli.c
ext/mysqli/mysqli_prop.c
ext/mysqli/tests/001.phpt
ext/mysqli/tests/002.phpt
ext/mysqli/tests/003.phpt
ext/mysqli/tests/004.phpt
ext/mysqli/tests/005.phpt
ext/mysqli/tests/006.phpt
ext/mysqli/tests/007.phpt
ext/mysqli/tests/008.phpt
ext/mysqli/tests/009.phpt
ext/mysqli/tests/010.phpt
ext/mysqli/tests/011.phpt
ext/mysqli/tests/012.phpt
ext/mysqli/tests/013.phpt
ext/mysqli/tests/014.phpt
ext/mysqli/tests/015.phpt
ext/mysqli/tests/016.phpt
ext/mysqli/tests/017.phpt
ext/mysqli/tests/018.phpt
ext/mysqli/tests/019.phpt
ext/mysqli/tests/020.phpt
ext/mysqli/tests/021.phpt
ext/mysqli/tests/022.phpt
ext/mysqli/tests/023.phpt
ext/mysqli/tests/024.phpt
ext/mysqli/tests/025.phpt
ext/mysqli/tests/026.phpt
ext/mysqli/tests/027.phpt
ext/mysqli/tests/028.phpt
ext/mysqli/tests/029.phpt
ext/mysqli/tests/030.phpt
ext/mysqli/tests/031.phpt
ext/mysqli/tests/032.phpt
ext/mysqli/tests/033.phpt
ext/mysqli/tests/034.phpt
ext/mysqli/tests/035.phpt
ext/mysqli/tests/036.phpt
ext/mysqli/tests/037.phpt
ext/mysqli/tests/038.phpt
ext/mysqli/tests/039.phpt
ext/mysqli/tests/040.phpt
ext/mysqli/tests/041.phpt
ext/mysqli/tests/042.phpt
ext/mysqli/tests/043.phpt
ext/mysqli/tests/044.phpt
ext/mysqli/tests/045.phpt
ext/mysqli/tests/046.phpt
ext/mysqli/tests/047.phpt
ext/mysqli/tests/048.phpt
ext/mysqli/tests/049.phpt
ext/mysqli/tests/050.phpt
ext/mysqli/tests/051.phpt
ext/mysqli/tests/052.phpt
ext/mysqli/tests/053.phpt
ext/mysqli/tests/054.phpt
ext/mysqli/tests/055.phpt
ext/mysqli/tests/056.phpt
ext/mysqli/tests/057.phpt
ext/mysqli/tests/058.phpt
ext/mysqli/tests/059.phpt
ext/mysqli/tests/060.phpt
ext/mysqli/tests/061.phpt
ext/mysqli/tests/bug28817.phpt [new file with mode: 0644]
ext/mysqli/tests/bug29311.phpt
ext/mysqli/tests/bug30967.phpt

index 833d8a5d075c4944afda623be48c7f8e42c5ed70..e263f7f41de703257bdc554b2c9712e1df310f17 100644 (file)
@@ -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) {
index f5792b77a6667b9d053a0c5a81fef3087f52067e..2784683718a85161e7949515dad55c399d8b16b1 100644 (file)
 #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},
index 5e483aba8db503f28332afa4417866fb427c4c17..8c9dc41f3161674526d6d0b551b05af7631233e5 100644 (file)
@@ -2,48 +2,37 @@
 mysqli connect
 --FILE--
 <?php
+       include "connect.inc";
 
-       $user = "root";
-       $passwd = "";
        $dbname = "test";
        $test = "";
        
-       /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect("127.0.0.1", $user, $passwd);
-       $test .= ($link) ? "1" : "0";
-       mysqli_close($link);
-
-       /*** test mysqli_connect localhost ***/
-       $link = mysqli_connect("localhost", $user, $passwd);
-       $test .= ($link) ? "1" : "0";
-       mysqli_close($link);
-
        /*** test mysqli_connect localhost:port ***/
-       $link = mysqli_connect("localhost", $user, $passwd, "", 3306);
+       $link = mysqli_connect($host, $user, $passwd, "", 3306);
        $test .= ($link) ? "1" : "0";
        mysqli_close($link);
 
        /*** test mysqli_real_connect ***/
        $link = mysqli_init();  
-       $test.= (mysqli_real_connect($link, "localhost", $user, $passwd)) 
+       $test.= (mysqli_real_connect($link, $host, $user, $passwd)) 
                ? "1" : "0";
        mysqli_close($link);
 
        /*** test mysqli_real_connect with db ***/
        $link = mysqli_init();  
-       $test .= (mysqli_real_connect($link, "localhost", $user, $passwd, $dbname)) 
+       $test .= (mysqli_real_connect($link, $host, $user, $passwd, $dbname)) 
                ? "1" : "0";
        mysqli_close($link);
 
        /*** test mysqli_real_connect with port ***/
        $link = mysqli_init();  
-       $test .= (mysqli_real_connect($link, "localhost", $user, $passwd, $dbname, 3306))
+       $test .= (mysqli_real_connect($link, $host, $user, $passwd, $dbname, 3306))
                ? "1":"0";
        mysqli_close($link);
 
        /*** test mysqli_real_connect compressed ***/
        $link = mysqli_init();  
-       $test .= (mysqli_real_connect($link, "localhost", $user, $passwd, $dbname, 0, NULL, MYSQLI_CLIENT_COMPRESS)) 
+       $test .= (mysqli_real_connect($link, $host, $user, $passwd, $dbname, 0, NULL, MYSQLI_CLIENT_COMPRESS)) 
                ? "1" : "0";
        mysqli_close($link);
 
@@ -52,4 +41,4 @@ mysqli connect
        var_dump($test);
 ?>
 --EXPECT--
-string(7) "1111111"
+string(5) "11111"
index 7925f84fa8044f3635f94559394d95d1bdc466ee..255944a4ecba256d3adde78462ef37681df1ee6c 100644 (file)
@@ -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");
index 906bf28dec3f4a636cf9fad2644c0c42ac305d62..0500ec557786bdd50c4736f968641358585c9db7 100644 (file)
@@ -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");
                
index 179c4b64cfd002434c854a0bbcc9b2acb8575bd5..33815c2f76921f3322d3613fee4491f3627f4879 100644 (file)
@@ -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");
 
index 982a3950f29ace971dcf7c71a86d692e52500b5b..48a0d77983f72c1ec22ef21454e234dd92ac4930 100644 (file)
@@ -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");
 
index d697e1e82f0ff3c18292bf5e0b13ac05aa57dbb7..87fbc609e561bb2135204e9df86e3ccea9a185b4 100644 (file)
@@ -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");
 
index 2470c20e7e2686de0d942c48d7e604745346653f..bd9696188698988dfbb2d8f4cda00850497d23eb 100644 (file)
@@ -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");
 
index c0ee735096159488a89f54ce54723a1bb23ae0ff..a57730bfc8e557e9cdb1e07fe6a5c7ab4c3fe57c 100644 (file)
@@ -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");
 
index 042f837849864d0dc4e9ff39f561487ea1ef091f..89f2d6e2e7abc1d02ec716e5deea179e62acd7a1 100644 (file)
@@ -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");
 
index 4584e0a91f442ec1359a65438ee526890093ff9e..207144c92bdfbf5eab880a0c5d8697388f22d50b 100644 (file)
@@ -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");
 
index 987ec1d14a6f18e156271d28b33a4d339e764624..fab8522a1706e6d75127198ca8f02e33468ab154 100644 (file)
@@ -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");
 
index 9af509fefdb0d98d825387702cd8ba9df591927f..5bc766a4abce1c04570b7cd92a33bae368ca2ffb 100644 (file)
@@ -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");
 
index b09541919969285a6e34df0d6621b556cd8edfdf..b4f9e4e16614fd5038a0df3ad0f9dbb323e5e4b9 100644 (file)
@@ -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");
 
index 8a72c42c7fe13c78eec9d4bce5d5f450cfb152f2..162114cdc79dc64f57e6ad191e588610260d2056 100644 (file)
@@ -3,7 +3,7 @@ mysqli autocommit/commit/rollback
 --SKIPIF--
 <?php  
        include "connect.inc";
-       $link = mysqli_connect("localhost", $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd);
        $result = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'");
        $row = mysqli_fetch_row($result);
        mysqli_free_result($result);
@@ -16,7 +16,7 @@ mysqli autocommit/commit/rollback
 --FILE--
 <?php
        include "connect.inc";
-       $link = mysqli_connect("localhost", $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd);
 
        mysqli_select_db($link, "test");
 
index 96864e88541d5382931e2b04121b9458df114042..b9d70e02be9dc76c1b3d01c605575acb62c951dd 100644 (file)
@@ -3,7 +3,7 @@ mysqli autocommit/commit/rollback with myisam
 --SKIPIF--
 <?php  
        include "connect.inc";
-       $link = mysqli_connect("localhost", $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd);
        $result = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'");
        $row = mysqli_fetch_row($result);
        mysqli_free_result($result);
@@ -17,7 +17,7 @@ mysqli autocommit/commit/rollback with myisam
 <?php
        include "connect.inc";
        
-       $link = mysqli_connect("localhost", $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd);
 
        mysqli_select_db($link, "test");
 
index 4d16356a78e726320ac0c951ce28d05eb8c7ad07..0185a8156932b34b4d3ecab17713e55e82e9b675 100644 (file)
@@ -5,7 +5,7 @@ mysqli fetch user variable
        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");
 
index 3447614428fc95c17acae3b753f1519151da24a1..d6c8f7838608f7edb4aa35010af02a1cf5d6ea72 100644 (file)
@@ -5,7 +5,7 @@ mysqli fetch functions
        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");
 
@@ -14,7 +14,9 @@ mysqli fetch functions
        mysqli_execute($stmt);
 
        mysqli_fetch($stmt);
-//     mysqli_stmt_close($stmt);
+       mysqli_stmt_close($stmt);
+
+       $c0 = ($c0 == $user . "@" . $host) ? 1 : 0;
 
        $test = array($c0, $c1, $c2);
 
@@ -24,7 +26,7 @@ mysqli fetch functions
 --EXPECT--
 array(3) {
   [0]=>
-  string(14) "root@localhost"
+  int(1)
   [1]=>
   string(4) "test"
   [2]=>
index a0a247611dcba4158b281553954c5a5de4998bd1..0fb2864d528926e98b2965593b7daac80994fa1c 100644 (file)
@@ -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");
 
index f7aab7a79958449df866aed62446ca8f1a67b147..39dd9c83a662c3b194b6f61b11dadbb453f51e68 100644 (file)
@@ -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");
index d08930fed9ff38addd1f33e29e88264a811dd8d3..62c165773314e21a10e43f3249f2a9ca1cf0a0ff 100644 (file)
@@ -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");
                
index 614f978aafba929a867e318d390213b281f2162e..0ff22d4da3c1f6dc5e57a1408166c863ae7509d8 100644 (file)
@@ -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");
 
index 2fb2bcdb6274dbcff014e33f1c38052440764da8..888834296ceaa5388d3ad888788cbc7f48abe322 100644 (file)
@@ -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");
 
index 258f1852d055237c381b465f2df639637c59ba7b..5f5e320ab7e4a23e684153bfd1002fee3bae4cd1 100644 (file)
@@ -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");
 
index de0eead6ed31e4aa32e098c59e48869659226c65..7ea92479d473d3ba2555ff40cb7b9fa80a9d263b 100644 (file)
@@ -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");
 
index 3d643ad8727e0beb0fe9e55502168bbb4bbbacb8..ba9db661a7382b72599648cbd5a6b5064b991c67 100644 (file)
@@ -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");
 
index 2c7f9f02bdce30a6a33e428eee343095607fb5d6..9b480bb65dc6ffac68f4e22f3efcc6584f8f0b4a 100644 (file)
@@ -2,12 +2,10 @@
 mysqli bind_param/bind_result with send_long_data 
 --FILE--
 <?php
-       $user = "root";
-       $passwd = "";
-
+       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");
 
index 347a8513af91e96b647a23b87681b53defbeb332..2505df530cf011894751977744e156a311b529b1 100644 (file)
@@ -2,12 +2,10 @@
 function test: mysqli_stat
 --FILE--
 <?php
-       $user = "root";
-       $passwd = "";
-
+       include "connect.inc";
        
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect("localhost", $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd);
 
        $status = mysqli_stat($link);
 
index d9e848f2ba098ac5f16b326f6fae0679df6371e9..b6fab50e4403b8be5e1a5e081230a6c0983243d8 100644 (file)
@@ -2,12 +2,10 @@
 function test: mysqli_character_set_name
 --FILE--
 <?php
-       $user = "root";
-       $passwd = "";
-
+       include "connect.inc";
        
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect("localhost", $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd);
 
        $cset = substr(mysqli_character_set_name($link),0,6);
 
index 7680b228e969ef2e6d018965b5c9b7d9f4ddd983..6fea5b889d39dc06c969de98579b0ce9cfee9ce3 100644 (file)
@@ -2,12 +2,10 @@
 function test: mysqli_affected_rows
 --FILE--
 <?php
-       $user = "root";
-       $passwd = "";
-
+       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");
 
index da87218627c912462b17f2815c62eb6cc2fa7e18..9bf7369a22bcef15bda296beac61adc23230d7d9 100644 (file)
@@ -2,11 +2,10 @@
 function test: mysqli_errno
 --FILE--
 <?php
-       $user = "root";
-       $passwd = "";
+       include "connect.inc";
 
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect("localhost", $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd);
        $errno = mysqli_errno($link);
        var_dump($errno);
 
index 61bfb5bb3261f69dfe935a261e7995bd058a7e69..c75bfd42b438162c8d23a3ec12a1f934fef4c9c0 100644 (file)
@@ -2,11 +2,10 @@
 function test: mysqli_error
 --FILE--
 <?php
-       $user = "root";
-       $passwd = "";
+       include "connect.inc";
 
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect("localhost", $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd);
        $error = mysqli_error($link);
        var_dump($error);
 
index 02564834d8313dbee55d9efbf77ab0276d235111..0cb4ee4d091bbf03a3a2556bd966cc7fbd09e7f4 100644 (file)
@@ -2,12 +2,10 @@
 function test: mysqli_info
 --FILE--
 <?php
-       $user = "root";
-       $passwd = "";
-
+       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");
 
index e3d8d159d0c1cfb5bc1297d8d8cb09781c5fdc1e..c9247eae6004ca0c1d7274de3d378d8f5db8b21b 100644 (file)
@@ -2,12 +2,10 @@
 function test: mysqli_get_host_info
 --FILE--
 <?php
-       $user = "root";
-       $passwd = "";
-
+       include "connect.inc";
        
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect("localhost", $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd);
 
        $hinfo = mysqli_get_host_info($link);
 
index e347586a36a567123bc673bb4b96ad5efce88bde..2d176c79fe591a07cef01b035cf3931a8804ddf2 100644 (file)
@@ -2,12 +2,10 @@
 function test: mysqli_get_proto_info
 --FILE--
 <?php
-       $user = "root";
-       $passwd = "";
-
+       include "connect.inc";
        
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect("localhost", $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd);
 
        $pinfo = mysqli_get_proto_info($link);
 
index a02af059d8feb6fc6a3c5aa67e0fe04d615660fc..b402a4859fa181cd03251ac347686f155239f19a 100644 (file)
@@ -2,12 +2,10 @@
 function test: mysqli_get_server_info
 --FILE--
 <?php
-       $user = "root";
-       $passwd = "";
-
+       include "connect.inc";
        
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect("localhost", $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd);
 
        $sinfo = substr(mysqli_get_server_info($link),0,1);
 
index 080c6e32e4eed2560af6640f96d06efcd5962083..95fa182591a878b6f3646917aa9aae9da6410816 100644 (file)
@@ -6,7 +6,7 @@ function test: mysqli_insert_id()
        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");
 
index f8b8a13f1a2714bf1864e77ab2e84c6bd05c49d7..a14d554b2b27299ae119c6867ef1b7fc1f7fe878 100644 (file)
@@ -6,7 +6,7 @@ function test: mysqli_field_count()
        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");
 
index 858b3e3393a7a7b746080677a171b4ca1e225db9..21f9a27d6b4b1b8f9e7f22284e5a89e320c5ca84 100644 (file)
@@ -6,7 +6,7 @@ function test: mysqli_num_fields()
        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");
 
index 6ddb37bc5f7c314f44aec1877eb876d32a3c65b0..ba5915bb978e29617f1084052ea9ee4c15ab6080 100644 (file)
@@ -6,7 +6,7 @@ function test: mysqli_num_fields() 2
        include "connect.inc";
        
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect("localhost", $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd);
 
        mysqli_real_query($link, "SHOW VARIABLES");
 
index 477e2a5274a2bb6ea250fa8c1a9a882c51536136..4d7c4563c130a33ce69f5f124492c26236ef9f69 100644 (file)
@@ -6,7 +6,7 @@ function test: mysqli_num_rows()
        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");
 
index 6fb8ee7e3fbdb41e616791c44b727049677ea062..7bc82f05c8f48103b36ad337e89556dc8ba84040 100644 (file)
@@ -6,7 +6,7 @@ function test: mysqli_warning_count()
        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");
 
index 8db17138c02f287750c96e13bd46bb28e2108861..c1384bbf68dff5367f5be962ac47a285c2b9d9b2 100644 (file)
@@ -5,7 +5,7 @@ mysqli_fetch_object
        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");
 
index 7aae6df9b4a9649d0bb8a7fed139285ad7d7a1c9..1d4b1854ac68cdcca83790c9644e6ab0ad19d9b3 100644 (file)
@@ -5,7 +5,7 @@ mysqli_bind_param (UPDATE)
        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");
 
index 5f72f65e38ece430237656448dd17295476085e1..cb4a272fc56e6cb231d89f9170ed3a5b228d2d21 100644 (file)
@@ -5,7 +5,7 @@ mysqli_get_server_version
        include "connect.inc";
        
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect("localhost", $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd);
 
        $i = mysqli_get_server_version($link);
 
index dc58bcfb089882939f9ae2c6799fb84c0847692f..8e2affd085a9c95ad084079ba7287b24044f7321 100644 (file)
@@ -3,7 +3,7 @@ mysqli_bind_result (SHOW)
 --SKIPIF--
 <?php  
        include "connect.inc";
-       $link = mysqli_connect("localhost", $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd);
 
 
        $stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'");
@@ -20,7 +20,7 @@ mysqli_bind_result (SHOW)
        include "connect.inc";
        
        /*** test mysqli_connect 127.0.0.1 ***/
-       $link = mysqli_connect("localhost", $user, $passwd);
+       $link = mysqli_connect($host, $user, $passwd);
 
        $stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'");
        mysqli_execute($stmt);
index bd6bc0efdb0f37faee07bd25fbcbc61a4f3004f3..6adb908a4ba5facd3d570d0d769e000c384c87ad 100644 (file)
@@ -5,7 +5,7 @@ mysqli_stmt_affected_rows (delete)
        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");
 
index 7862846dc02d132fd95d2426ed28617c37765284..50540aff651d459cf9004b50cff65809bd97ed0d 100644 (file)
@@ -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");
 
index 102bcdfc26a59ba57ff8e7fa4ef87a5c39d55795..ec849e39929b6806f077eee589e9e601877aa385 100644 (file)
@@ -5,7 +5,7 @@ mysqli bind_result (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");              
        $mysql->query("DROP TABLE IF EXISTS test_fetch_null");
index 04e705de6ee66bf485e94004fa3d8000070bdb44..869220d92eab03fab1ed75004dcf59cfb7973859 100644 (file)
@@ -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)
index 9ab5d346f89b4614f4062fa0b1df40b3a5ece323..3e8a8a37fbe80a659688a26ae55f600ed2e52370 100644 (file)
@@ -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);
index dde734a1e0190e13e2091f6b74e912e9be691bd9..807cc2f2751528aed525da2c4064dd9189b9d424 100644 (file)
@@ -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);
index 4ae9b12c503443ceaded3e14f593c2dedee17c95..cda1b2c844db51fedb48993bb518dcdade6b5c28 100644 (file)
@@ -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()");
 
index f542d0f0994892286751837416b63c4824a727a8..4bfce10b14db597dca31d4781f96120f52cd78ad 100644 (file)
@@ -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);
index eab207db4dd9dc2635d6c557ff6cc7d1ce84717c..7c9b51fe461850c94b500a9527e6cb50838c74cb 100644 (file)
@@ -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);
index e777bcfc99403146aebe3391ad504b70ae40e25b..8fa374a6c7a2976db09b6da11702dba00be1fcff 100644 (file)
@@ -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()");
index cee7df1e5fbc2bb803f11279ef7649d7636d92a2..a681ffcf4977d489fbf68b2df12a0beb5d9e4f40 100644 (file)
@@ -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());
 ?>
index 581201d8efd734334716b4efc8b48d453fc3d572..fcd07f6f0bbe6ea87b6493979fb76bd34b78e739 100644 (file)
@@ -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");
 
index d46e8d65a838b3cf83afb4072f99ad4f7a58e7e0..95bdbc1cbe62bcbdef54fae1679705f723c784b1 100644 (file)
@@ -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");
 
index 80d8a3501245255aadbb8a8f2a800069edbbeb47..151c3de96197efa70bbcf93ce4c1412fa4483c9d 100644 (file)
@@ -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");
 
index f7afaa7e1a8daf258b36f6f78073b20cffc67cfd..7c753743cdedbe0da0aef69cb9e27a9a3f800f8b 100644 (file)
@@ -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");
 
index 438f4a203ae42cb3e77d9e56d4f22a2ab8cef9d4..f1c297001195452aff83dc3b5654af74368dfee2 100644 (file)
@@ -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 (file)
index 0000000..9f2aae9
--- /dev/null
@@ -0,0 +1,37 @@
+--TEST--
+Bug #28817 testcase (properties)
+--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);
+       $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)
index 82845e16d6d627c01eb9fcbbc434fa1874ce5dbd..53710cbdc8446f68d921be21c9308cbf9c0955d2 100644 (file)
@@ -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++) {
index f441cf0f190477203755bca23c701d0e13139203..dd40194744274022857229bb2d16cfd52c74c403 100644 (file)
@@ -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);