1
0
mirror of https://github.com/php/php-src.git synced 2026-04-01 21:22:13 +02:00
fix for bug #28817 (properties don't work in extended class)
	fix for bug #30890 (testsuite)
This commit is contained in:
Georg Richter
2004-12-04 09:01:34 +00:00
parent 125c9028a7
commit 6db67fe4ff
65 changed files with 240 additions and 143 deletions

View 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);
@@ -223,6 +218,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) {

View File

@@ -29,6 +29,15 @@
#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 +50,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 +73,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 {\
@@ -96,19 +107,6 @@ int link_client_info_read(mysqli_object *obj, zval **retval TSRMLS_DC)
}
/* }}} */
/* {{{ 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)
{
@@ -147,9 +145,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 {
@@ -162,6 +162,9 @@ 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);
@@ -202,7 +205,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},

View File

@@ -1,49 +1,40 @@
--TEST--
mysqli connect
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--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 +43,4 @@ mysqli connect
var_dump($test);
?>
--EXPECT--
string(7) "1111111"
string(5) "11111"

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli bind_result 1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli connect
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli fetch char/text
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli fetch char/text long
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli fetch long values
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli fetch short values
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli fetch tinyint values
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli fetch bigint values
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -2,12 +2,14 @@
mysqli fetch float values
--INI--
precision=12
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -2,12 +2,14 @@
mysqli fetch mixed values
--INI--
precision=12
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -2,12 +2,14 @@
mysqli fetch mixed values 2
--INI--
precision=12
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli fetch mixed / mysql_query
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View 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);
@@ -13,10 +13,12 @@ mysqli autocommit/commit/rollback
printf ("skip innodb support is not installed or enabled.");
}
?>
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
$link = mysqli_connect("localhost", $user, $passwd);
$link = mysqli_connect($host, $user, $passwd);
mysqli_select_db($link, "test");

View 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);
@@ -13,11 +13,13 @@ mysqli autocommit/commit/rollback with myisam
printf ("skip innodb support not installed.");
}
?>
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
$link = mysqli_connect("localhost", $user, $passwd);
$link = mysqli_connect($host, $user, $passwd);
mysqli_select_db($link, "test");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli fetch user variable
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli fetch functions
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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 +16,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 +28,7 @@ mysqli fetch functions
--EXPECT--
array(3) {
[0]=>
string(14) "root@localhost"
int(1)
[1]=>
string(4) "test"
[2]=>

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli fetch system variables
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli fetch (bind_param + bind_result)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli bind_param/bind_result date
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli bind_param+bind_result char/text
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli bind_param/bind_result char/text long
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli bind_param/bind_prepare fetch long values
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli bind_param/bind_result short values
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli bind_param/bind_result tinyint values
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,13 +1,13 @@
--TEST--
mysqli bind_param/bind_result with send_long_data
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--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");

View File

@@ -1,13 +1,13 @@
--TEST--
function test: mysqli_stat
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--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);

View File

@@ -1,13 +1,13 @@
--TEST--
function test: mysqli_character_set_name
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--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);

View File

@@ -1,13 +1,13 @@
--TEST--
function test: mysqli_affected_rows
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--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");

View File

@@ -1,12 +1,13 @@
--TEST--
function test: mysqli_errno
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--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);

View File

@@ -1,12 +1,13 @@
--TEST--
function test: mysqli_error
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--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);

View File

@@ -1,13 +1,13 @@
--TEST--
function test: mysqli_info
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--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");

View File

@@ -1,13 +1,13 @@
--TEST--
function test: mysqli_get_host_info
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--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);

View File

@@ -1,13 +1,13 @@
--TEST--
function test: mysqli_get_proto_info
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--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);

View File

@@ -1,13 +1,13 @@
--TEST--
function test: mysqli_get_server_info
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--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);

View File

@@ -1,12 +1,14 @@
--TEST--
function test: mysqli_insert_id()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,12 +1,14 @@
--TEST--
function test: mysqli_field_count()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,12 +1,14 @@
--TEST--
function test: mysqli_num_fields()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,12 +1,14 @@
--TEST--
function test: mysqli_num_fields() 2
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,12 +1,14 @@
--TEST--
function test: mysqli_num_rows()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,12 +1,14 @@
--TEST--
function test: mysqli_warning_count()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli_fetch_object
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli_bind_param (UPDATE)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli_get_server_version
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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);

View 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'");
@@ -15,12 +15,14 @@ mysqli_bind_result (SHOW)
$stmt->close();
mysqli_close($link);
?>
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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);

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli_stmt_affected_rows (delete)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli_get_metadata
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli bind_result (OO-Style)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,23 +1,23 @@
--TEST--
mysql_fetch_row (OO-Style)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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)

View File

@@ -1,5 +1,7 @@
--TEST--
non freed statement test
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
@@ -7,7 +9,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);

View File

@@ -1,5 +1,7 @@
--TEST--
free statement after close
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
@@ -7,7 +9,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);

View File

@@ -1,5 +1,7 @@
--TEST--
call statement after close
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
@@ -7,7 +9,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()");

View File

@@ -1,5 +1,7 @@
--TEST--
not freed resultset
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
@@ -7,7 +9,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);

View File

@@ -1,5 +1,7 @@
--TEST--
free resultset after close
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
@@ -7,7 +9,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);

View File

@@ -1,5 +1,7 @@
--TEST--
free nothing
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
@@ -7,7 +9,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()");

View File

@@ -1,5 +1,7 @@
--TEST--
extend mysqli
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
@@ -11,7 +13,7 @@ extend mysqli
}
$foo = new foobar();
$foo->connect("localhost", $user, $passwd);
$foo->connect($host, $user, $passwd);
$foo->close();
printf("%s\n", $foo->test());
?>

View File

@@ -1,11 +1,13 @@
--TEST--
mysqli_get_metadata
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
multiple binds
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,11 +1,13 @@
--TEST--
sqlmode + bind
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
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");

View File

@@ -1,5 +1,7 @@
--TEST--
mysqli_fetch_object with classes
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
@@ -11,7 +13,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");

View File

@@ -1,5 +1,7 @@
--TEST--
local infile handler
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
@@ -10,7 +12,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");

View File

@@ -1,5 +1,7 @@
--TEST--
constructor test
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
@@ -7,7 +9,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 +18,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 +30,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++) {

View File

@@ -1,5 +1,7 @@
--TEST--
Bug #30967 testcase (properties)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
@@ -10,7 +12,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);