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);
} 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) {
#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;
#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 {\
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 {\
}
/* }}} */
-/* {{{ 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)
{
/* {{{ 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 {
/* {{{ 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);
{"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},
--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);
var_dump($test);
?>
--EXPECT--
-string(7) "1111111"
+string(5) "11111"
--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");
--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");
--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");
--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");
--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");
--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");
--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");
--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");
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");
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");
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");
--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");
--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);
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");
--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);
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");
--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");
--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");
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);
--EXPECT--
array(3) {
[0]=>
- string(14) "root@localhost"
+ int(1)
[1]=>
string(4) "test"
[2]=>
--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");
--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");
--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");
--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");
--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");
--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");
--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");
--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");
--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");
--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);
--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);
--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");
--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);
--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);
--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");
--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);
--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);
--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);
--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");
--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");
--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");
--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");
--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");
--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");
--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");
--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");
--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);
--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'");
$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);
--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");
--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");
--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");
--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)
--TEST--
non freed statement test
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
/************************
* 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);
--TEST--
free statement after close
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
/************************
* 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);
--TEST--
call statement after close
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
/************************
* statement call after close
************************/
- $link = mysqli_connect("localhost", $user, $passwd);
+ $link = mysqli_connect($host, $user, $passwd);
$stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()");
--TEST--
not freed resultset
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
/************************
* 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);
--TEST--
free resultset after close
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
/************************
* 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);
--TEST--
free nothing
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
/************************
* 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()");
--TEST--
extend mysqli
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
}
$foo = new foobar();
- $foo->connect("localhost", $user, $passwd);
+ $foo->connect($host, $user, $passwd);
$foo->close();
printf("%s\n", $foo->test());
?>
--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");
--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");
--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");
--TEST--
mysqli_fetch_object with classes
+--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");
--TEST--
local infile handler
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
}
/*** 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");
--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() {
- parent::__construct("localhost", "root", "", "test");
+ global $host, $user, $passwd;
+ parent::__construct($host, $user, $passwd, "test");
}
}
class mysql2 extends mysqli {
function __construct() {
- $this->connect("localhost", "root", "", "test");
+ global $host, $user, $passwd;
+ $this->connect($host, $user, $passwd, "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++) {
--TEST--
Bug #30967 testcase (properties)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
--FILE--
<?php
include "connect.inc";
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);