From fd1578c196575c7e120a84ee030bb87c14a199b0 Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Thu, 5 Mar 2015 00:18:40 +0000 Subject: [PATCH] Remove the deprecated MySQL extension. Relevant RFC: https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7 --- UPGRADING | 1 + ext/mysql/CREDITS | 2 - ext/mysql/config.m4 | 168 - ext/mysql/config.w32 | 28 - ext/mysql/mysql.mak | 169 - ext/mysql/mysql_mysqlnd.h | 30 - ext/mysql/package.xml | 64 - ext/mysql/php_mysql.c | 2754 ----------------- ext/mysql/php_mysql.h | 36 - ext/mysql/php_mysql_structs.h | 139 - ext/mysql/tests/001.phpt | 36 - ext/mysql/tests/002.phpt | 62 - ext/mysql/tests/003.phpt | 90 - ext/mysql/tests/bug47438.phpt | 53 - ext/mysql/tests/bug48754.phpt | 100 - ext/mysql/tests/bug51242.phpt | 39 - ext/mysql/tests/bug53649.phpt | 72 - ext/mysql/tests/bug55473.phpt | 99 - ext/mysql/tests/clean_table.inc | 15 - ext/mysql/tests/connect.inc | 82 - ext/mysql/tests/mysql_affected_rows.phpt | 126 - ext/mysql/tests/mysql_client_encoding.phpt | 73 - ext/mysql/tests/mysql_close.phpt | 40 - ext/mysql/tests/mysql_connect.phpt | 128 - ext/mysql/tests/mysql_constants.phpt | 66 - ext/mysql/tests/mysql_create_db.phpt | 59 - ext/mysql/tests/mysql_data_seek.phpt | 79 - ext/mysql/tests/mysql_db_name.phpt | 69 - ext/mysql/tests/mysql_db_query.phpt | 70 - ext/mysql/tests/mysql_deprecated_api.phpt | 79 - ext/mysql/tests/mysql_drop_db.phpt | 56 - ext/mysql/tests/mysql_errno.phpt | 64 - ext/mysql/tests/mysql_error.phpt | 71 - ext/mysql/tests/mysql_escape_string.phpt | 33 - ext/mysql/tests/mysql_fetch_array.phpt | 361 --- ext/mysql/tests/mysql_fetch_assoc.phpt | 106 - ext/mysql/tests/mysql_fetch_field.phpt | 278 -- ext/mysql/tests/mysql_fetch_lengths.phpt | 53 - ext/mysql/tests/mysql_fetch_object.phpt | 153 - ext/mysql/tests/mysql_fetch_row.phpt | 57 - ext/mysql/tests/mysql_field_flags.phpt | 159 - ext/mysql/tests/mysql_field_len.phpt | 60 - ext/mysql/tests/mysql_field_name.phpt | 60 - ext/mysql/tests/mysql_field_seek.phpt | 144 - ext/mysql/tests/mysql_field_table.phpt | 60 - ext/mysql/tests/mysql_field_type.phpt | 60 - ext/mysql/tests/mysql_free_result.phpt | 52 - ext/mysql/tests/mysql_get_client_info.phpt | 25 - ext/mysql/tests/mysql_get_host_info.phpt | 47 - ext/mysql/tests/mysql_get_proto_info.phpt | 35 - ext/mysql/tests/mysql_get_server_info.phpt | 42 - ext/mysql/tests/mysql_info.phpt | 76 - ext/mysql/tests/mysql_insert_id.phpt | 73 - ext/mysql/tests/mysql_list_dbs.phpt | 57 - ext/mysql/tests/mysql_list_fields.phpt | 80 - ext/mysql/tests/mysql_list_processes.phpt | 57 - ext/mysql/tests/mysql_list_tables.phpt | 86 - ext/mysql/tests/mysql_max_links.phpt | 80 - ext/mysql/tests/mysql_max_persistent.phpt | 105 - .../mysql_mysqlnd_read_timeout_long.phpt | 38 - ext/mysql/tests/mysql_num_fields.phpt | 58 - ext/mysql/tests/mysql_num_rows.phpt | 89 - ext/mysql/tests/mysql_pconn_disable.phpt | 61 - ext/mysql/tests/mysql_pconn_kill.phpt | 117 - ext/mysql/tests/mysql_pconn_max_links.phpt | 211 -- ext/mysql/tests/mysql_pconn_reuse.phpt | 75 - ext/mysql/tests/mysql_pconnect.phpt | 97 - ext/mysql/tests/mysql_phpinfo.phpt | 75 - ext/mysql/tests/mysql_ping.phpt | 51 - ext/mysql/tests/mysql_query.phpt | 132 - .../mysql_query_load_data_openbasedir.phpt | 121 - ext/mysql/tests/mysql_real_escape_string.phpt | 44 - .../tests/mysql_reflection_extension.phpt | 105 - .../tests/mysql_reflection_functions.phpt | 387 --- ext/mysql/tests/mysql_result.phpt | 116 - ext/mysql/tests/mysql_select_db.phpt | 74 - ext/mysql/tests/mysql_set_charset.phpt | 62 - ext/mysql/tests/mysql_sql_safe_mode.phpt | 40 - ext/mysql/tests/mysql_stat.phpt | 52 - ext/mysql/tests/mysql_tablename.phpt | 56 - ext/mysql/tests/mysql_thread_id.phpt | 41 - ext/mysql/tests/mysql_trace_mode.phpt | 37 - ext/mysql/tests/mysql_unbuffered_query.phpt | 126 - ext/mysql/tests/setupdefault.inc | 10 - ext/mysql/tests/skipif.inc | 6 - ext/mysql/tests/skipifconnectfailure.inc | 17 - ext/mysql/tests/skipifnotmysqlnd.inc | 5 - ext/mysql/tests/table.inc | 24 - 88 files changed, 1 insertion(+), 9744 deletions(-) delete mode 100644 ext/mysql/CREDITS delete mode 100644 ext/mysql/config.m4 delete mode 100644 ext/mysql/config.w32 delete mode 100644 ext/mysql/mysql.mak delete mode 100644 ext/mysql/mysql_mysqlnd.h delete mode 100644 ext/mysql/package.xml delete mode 100644 ext/mysql/php_mysql.c delete mode 100644 ext/mysql/php_mysql.h delete mode 100644 ext/mysql/php_mysql_structs.h delete mode 100644 ext/mysql/tests/001.phpt delete mode 100644 ext/mysql/tests/002.phpt delete mode 100644 ext/mysql/tests/003.phpt delete mode 100644 ext/mysql/tests/bug47438.phpt delete mode 100644 ext/mysql/tests/bug48754.phpt delete mode 100644 ext/mysql/tests/bug51242.phpt delete mode 100644 ext/mysql/tests/bug53649.phpt delete mode 100644 ext/mysql/tests/bug55473.phpt delete mode 100644 ext/mysql/tests/clean_table.inc delete mode 100644 ext/mysql/tests/connect.inc delete mode 100644 ext/mysql/tests/mysql_affected_rows.phpt delete mode 100644 ext/mysql/tests/mysql_client_encoding.phpt delete mode 100644 ext/mysql/tests/mysql_close.phpt delete mode 100644 ext/mysql/tests/mysql_connect.phpt delete mode 100644 ext/mysql/tests/mysql_constants.phpt delete mode 100644 ext/mysql/tests/mysql_create_db.phpt delete mode 100644 ext/mysql/tests/mysql_data_seek.phpt delete mode 100644 ext/mysql/tests/mysql_db_name.phpt delete mode 100644 ext/mysql/tests/mysql_db_query.phpt delete mode 100644 ext/mysql/tests/mysql_deprecated_api.phpt delete mode 100644 ext/mysql/tests/mysql_drop_db.phpt delete mode 100644 ext/mysql/tests/mysql_errno.phpt delete mode 100644 ext/mysql/tests/mysql_error.phpt delete mode 100644 ext/mysql/tests/mysql_escape_string.phpt delete mode 100644 ext/mysql/tests/mysql_fetch_array.phpt delete mode 100644 ext/mysql/tests/mysql_fetch_assoc.phpt delete mode 100644 ext/mysql/tests/mysql_fetch_field.phpt delete mode 100644 ext/mysql/tests/mysql_fetch_lengths.phpt delete mode 100644 ext/mysql/tests/mysql_fetch_object.phpt delete mode 100644 ext/mysql/tests/mysql_fetch_row.phpt delete mode 100644 ext/mysql/tests/mysql_field_flags.phpt delete mode 100644 ext/mysql/tests/mysql_field_len.phpt delete mode 100644 ext/mysql/tests/mysql_field_name.phpt delete mode 100644 ext/mysql/tests/mysql_field_seek.phpt delete mode 100644 ext/mysql/tests/mysql_field_table.phpt delete mode 100644 ext/mysql/tests/mysql_field_type.phpt delete mode 100644 ext/mysql/tests/mysql_free_result.phpt delete mode 100644 ext/mysql/tests/mysql_get_client_info.phpt delete mode 100644 ext/mysql/tests/mysql_get_host_info.phpt delete mode 100644 ext/mysql/tests/mysql_get_proto_info.phpt delete mode 100644 ext/mysql/tests/mysql_get_server_info.phpt delete mode 100644 ext/mysql/tests/mysql_info.phpt delete mode 100644 ext/mysql/tests/mysql_insert_id.phpt delete mode 100644 ext/mysql/tests/mysql_list_dbs.phpt delete mode 100644 ext/mysql/tests/mysql_list_fields.phpt delete mode 100644 ext/mysql/tests/mysql_list_processes.phpt delete mode 100644 ext/mysql/tests/mysql_list_tables.phpt delete mode 100644 ext/mysql/tests/mysql_max_links.phpt delete mode 100644 ext/mysql/tests/mysql_max_persistent.phpt delete mode 100644 ext/mysql/tests/mysql_mysqlnd_read_timeout_long.phpt delete mode 100644 ext/mysql/tests/mysql_num_fields.phpt delete mode 100644 ext/mysql/tests/mysql_num_rows.phpt delete mode 100644 ext/mysql/tests/mysql_pconn_disable.phpt delete mode 100644 ext/mysql/tests/mysql_pconn_kill.phpt delete mode 100644 ext/mysql/tests/mysql_pconn_max_links.phpt delete mode 100644 ext/mysql/tests/mysql_pconn_reuse.phpt delete mode 100644 ext/mysql/tests/mysql_pconnect.phpt delete mode 100644 ext/mysql/tests/mysql_phpinfo.phpt delete mode 100644 ext/mysql/tests/mysql_ping.phpt delete mode 100644 ext/mysql/tests/mysql_query.phpt delete mode 100644 ext/mysql/tests/mysql_query_load_data_openbasedir.phpt delete mode 100644 ext/mysql/tests/mysql_real_escape_string.phpt delete mode 100644 ext/mysql/tests/mysql_reflection_extension.phpt delete mode 100644 ext/mysql/tests/mysql_reflection_functions.phpt delete mode 100644 ext/mysql/tests/mysql_result.phpt delete mode 100644 ext/mysql/tests/mysql_select_db.phpt delete mode 100644 ext/mysql/tests/mysql_set_charset.phpt delete mode 100644 ext/mysql/tests/mysql_sql_safe_mode.phpt delete mode 100644 ext/mysql/tests/mysql_stat.phpt delete mode 100644 ext/mysql/tests/mysql_tablename.phpt delete mode 100644 ext/mysql/tests/mysql_thread_id.phpt delete mode 100644 ext/mysql/tests/mysql_trace_mode.phpt delete mode 100644 ext/mysql/tests/mysql_unbuffered_query.phpt delete mode 100644 ext/mysql/tests/setupdefault.inc delete mode 100644 ext/mysql/tests/skipif.inc delete mode 100644 ext/mysql/tests/skipifconnectfailure.inc delete mode 100644 ext/mysql/tests/skipifnotmysqlnd.inc delete mode 100644 ext/mysql/tests/table.inc diff --git a/UPGRADING b/UPGRADING index af84ee94fe..12b0519dd6 100644 --- a/UPGRADING +++ b/UPGRADING @@ -461,6 +461,7 @@ Other - sapi/tux - sapi/webjames - ext/mssql +- ext/mysql - ext/sybase_ct For more details see https://wiki.php.net/rfc/removal_of_dead_sapis_and_exts diff --git a/ext/mysql/CREDITS b/ext/mysql/CREDITS deleted file mode 100644 index 15b00a9a8e..0000000000 --- a/ext/mysql/CREDITS +++ /dev/null @@ -1,2 +0,0 @@ -MySQL -Zeev Suraski, Zak Greant, Georg Richter, Andrey Hristov diff --git a/ext/mysql/config.m4 b/ext/mysql/config.m4 deleted file mode 100644 index 70bfd7110b..0000000000 --- a/ext/mysql/config.m4 +++ /dev/null @@ -1,168 +0,0 @@ -dnl -dnl $Id$ -dnl - -AC_DEFUN([MYSQL_LIB_CHK], [ - str="$MYSQL_DIR/$1/lib$MYSQL_LIBNAME.*" - for j in `echo $str`; do - if test -r $j; then - MYSQL_LIB_DIR=$MYSQL_DIR/$1 - break 2 - fi - done -]) - -AC_DEFUN([PHP_MYSQL_SOCKET_SEARCH], [ - for i in \ - /var/run/mysqld/mysqld.sock \ - /var/tmp/mysql.sock \ - /var/run/mysql/mysql.sock \ - /var/lib/mysql/mysql.sock \ - /var/mysql/mysql.sock \ - /usr/local/mysql/var/mysql.sock \ - /Private/tmp/mysql.sock \ - /private/tmp/mysql.sock \ - /tmp/mysql.sock \ - ; do - if test -r $i; then - MYSQL_SOCK=$i - break 2 - fi - done - - if test -n "$MYSQL_SOCK"; then - AC_DEFINE_UNQUOTED(PHP_MYSQL_UNIX_SOCK_ADDR, "$MYSQL_SOCK", [ ]) - AC_MSG_RESULT([$MYSQL_SOCK]) - else - AC_MSG_RESULT([no]) - fi -]) - - -PHP_ARG_WITH(mysql, for MySQL support, -[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base - directory, if no DIR is passed or the value is - mysqlnd the MySQL native driver will be used]) - -PHP_ARG_WITH(mysql-sock, for specified location of the MySQL UNIX socket, -[ --with-mysql-sock[=SOCKPATH] - MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer. - If unspecified, the default locations are searched], no, no) - -if test -z "$PHP_ZLIB_DIR"; then - PHP_ARG_WITH(zlib-dir, for the location of libz, - [ --with-zlib-dir[=DIR] MySQL: Set the path to libz install prefix], no, no) -fi - -if test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL" = "mysqlnd"; then - dnl enables build of mysqnd library - PHP_MYSQLND_ENABLED=yes - -elif test "$PHP_MYSQL" != "no"; then - MYSQL_DIR= - MYSQL_INC_DIR= - - if test -r $PHP_MYSQL/include/mysql/mysql.h; then - MYSQL_DIR=$PHP_MYSQL - MYSQL_INC_DIR=$PHP_MYSQL/include/mysql - break - elif test -r $PHP_MYSQL/include/mysql.h; then - MYSQL_DIR=$PHP_MYSQL - MYSQL_INC_DIR=$PHP_MYSQL/include - break - fi - - if test -z "$MYSQL_DIR"; then - AC_MSG_ERROR([Cannot find MySQL header files under $PHP_MYSQL. -Note that the MySQL client library is not bundled anymore!]) - fi - - if test "$enable_maintainer_zts" = "yes"; then - MYSQL_LIBNAME=mysqlclient_r - else - MYSQL_LIBNAME=mysqlclient - fi - case $host_alias in - *netware*[)] - MYSQL_LIBNAME=mysql - ;; - esac - - dnl for compat with PHP 4 build system - if test -z "$PHP_LIBDIR"; then - PHP_LIBDIR=lib - fi - - for i in $PHP_LIBDIR $PHP_LIBDIR/mysql; do - MYSQL_LIB_CHK($i) - done - - if test -z "$MYSQL_LIB_DIR"; then - MYSQL_LIB_CHK(lib/x86_64-linux-gnu) - fi - if test -z "$MYSQL_LIB_DIR"; then - MYSQL_LIB_CHK(lib/i386-linux-gnu) - fi - - if test -z "$MYSQL_LIB_DIR"; then - AC_MSG_ERROR([Cannot find lib$MYSQL_LIBNAME under $MYSQL_DIR. -Note that the MySQL client library is not bundled anymore!]) - fi - - PHP_CHECK_LIBRARY($MYSQL_LIBNAME, mysql_close, [ ], - [ - if test "$PHP_ZLIB_DIR" != "no"; then - PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR, MYSQL_SHARED_LIBADD) - PHP_CHECK_LIBRARY($MYSQL_LIBNAME, mysql_error, [], [ - AC_MSG_ERROR([mysql configure failed. Please check config.log for more information.]) - ], [ - -L$PHP_ZLIB_DIR/$PHP_LIBDIR -L$MYSQL_LIB_DIR - ]) - MYSQL_LIBS="-L$PHP_ZLIB_DIR/$PHP_LIBDIR -lz" - else - PHP_ADD_LIBRARY(z,, MYSQL_SHARED_LIBADD) - PHP_CHECK_LIBRARY($MYSQL_LIBNAME, mysql_errno, [], [ - AC_MSG_ERROR([Try adding --with-zlib-dir=. Please check config.log for more information.]) - ], [ - -L$MYSQL_LIB_DIR - ]) - MYSQL_LIBS="-lz" - fi - ], [ - -L$MYSQL_LIB_DIR - ]) - - PHP_ADD_LIBRARY_WITH_PATH($MYSQL_LIBNAME, $MYSQL_LIB_DIR, MYSQL_SHARED_LIBADD) - PHP_ADD_INCLUDE($MYSQL_INC_DIR) - - MYSQL_MODULE_TYPE=external - MYSQL_LIBS="-L$MYSQL_LIB_DIR -l$MYSQL_LIBNAME $MYSQL_LIBS" - MYSQL_INCLUDE=-I$MYSQL_INC_DIR - - PHP_SUBST_OLD(MYSQL_MODULE_TYPE) - PHP_SUBST_OLD(MYSQL_LIBS) - PHP_SUBST_OLD(MYSQL_INCLUDE) -fi - -dnl Enable extension -if test "$PHP_MYSQL" != "no"; then - AC_MSG_CHECKING([for MySQL UNIX socket location]) - if test "$PHP_MYSQL_SOCK" != "no" && test "$PHP_MYSQL_SOCK" != "yes"; then - MYSQL_SOCK=$PHP_MYSQL_SOCK - AC_DEFINE_UNQUOTED(PHP_MYSQL_UNIX_SOCK_ADDR, "$MYSQL_SOCK", [ ]) - AC_MSG_RESULT([$MYSQL_SOCK]) - elif test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL_SOCK" = "yes"; then - PHP_MYSQL_SOCKET_SEARCH - else - AC_MSG_RESULT([no]) - fi - - AC_DEFINE(HAVE_MYSQL, 1, [Whether you have MySQL]) - PHP_NEW_EXTENSION(mysql, php_mysql.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) - PHP_SUBST(MYSQL_SHARED_LIBADD) - - if test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL" = "mysqlnd"; then - PHP_ADD_EXTENSION_DEP(mysql, mysqlnd) - AC_DEFINE([MYSQL_USE_MYSQLND], 1, [Whether mysqlnd is enabled]) - fi -fi diff --git a/ext/mysql/config.w32 b/ext/mysql/config.w32 deleted file mode 100644 index 0af94d9623..0000000000 --- a/ext/mysql/config.w32 +++ /dev/null @@ -1,28 +0,0 @@ -// $Id$ -// vim:ft=javascript - -ARG_WITH("mysql", "MySQL support", "no"); - -if (PHP_MYSQL != "no") { - if ((PHP_MYSQL == "yes" || PHP_MYSQL == "mysqlnd")) { - AC_DEFINE('MYSQL_USE_MYSQLND', 1, 'Using MySQL native driver'); - if (!ADD_EXTENSION_DEP('mysql', 'mysqlnd', true)) { - PHP_MYSQL = "no"; - WARNING("mysql not enabled; mysqlnd is not enabled"); - } else { - EXTENSION("mysql", "php_mysql.c", PHP_MYSQL_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); - AC_DEFINE('HAVE_MYSQL', 1, 'Have MySQL library'); - MESSAGE("\tusing mysqlnd build"); - } - } else if (PHP_MYSQL != "") { - if (CHECK_LIB("libmysql.lib", "mysql", PHP_MYSQL) && - CHECK_HEADER_ADD_INCLUDE("mysql.h", "CFLAGS_MYSQL", - PHP_MYSQL + "\\include;" + PHP_PHP_BUILD + "\\include\\mysql;" + PHP_MYSQL)) { - EXTENSION("mysql", "php_mysql.c", PHP_MYSQL_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); - AC_DEFINE('HAVE_MYSQL', 1, 'Have MySQL library'); - MESSAGE("\tusing libmysql"); - } else { - WARNING("mysql not enabled; libraries and headers not found"); - } - } -} diff --git a/ext/mysql/mysql.mak b/ext/mysql/mysql.mak deleted file mode 100644 index 2ed0f82228..0000000000 --- a/ext/mysql/mysql.mak +++ /dev/null @@ -1,169 +0,0 @@ -# Temporarily here -- later may go into some batch file -# which will set this as an environment variable -PROJECT_ROOT = ..\.. - -# Module details -MODULE_NAME = phpmysql -MODULE_DESC = "PHP 4.3 - MySQL Extension" -VMAJ = 3 -VMIN = 0 -VREV = 0 - -#include the common settings -include $(PROJECT_ROOT)/netware/common.mif - -# MYSQL stuff -MYSQL_DIR = P:/APPS/script/sw/mysql - -# Build type defaults to 'release' -ifndef BUILD -BUILD = release -endif - -# Extensions of all input and output files -.SUFFIXES: -.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d - -# Source files -C_SRC = php_mysql.c \ - start.c - -CPP_SRC_NODIR = $(notdir $(CPP_SRC)) -C_SRC_NODIR = $(notdir $(C_SRC)) -SRC_DIR = $(dir $(CPP_SRC) $(C_SRC)) - -# Library files -LIBRARY = $(MYSQL_DIR)/lib/libmysqlclient.lib - -# Destination directories and files -OBJ_DIR = $(BUILD) -FINAL_DIR = $(BUILD) -OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.obj) $(C_SRC_NODIR:.c=.obj)) -DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.d) $(C_SRC_NODIR:.c=.d)) - -# Binary file -ifndef BINARY - BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm -endif - -# Compile flags -C_FLAGS = -c -maxerrors 25 -msgstyle gcc -wchar_t on -bool on -processor Pentium -C_FLAGS += -nostdinc -nosyspath -C_FLAGS += -relax_pointers # To remove type-casting errors -C_FLAGS += -DNETWARE -DZTS -DNEW_LIBC -DUSE_OLD_FUNCTIONS -DCOMPILE_DL_MYSQL=1 -C_FLAGS += -I. -I- -I$(PROJECT_ROOT) -I$(PROJECT_ROOT)/main -C_FLAGS += -I$(PROJECT_ROOT)/ext/standard -I$(PROJECT_ROOT)/netware -C_FLAGS += -I$(PROJECT_ROOT)/zend -I$(PROJECT_ROOT)/tsrm -C_FLAGS += -I$(SDK_DIR)/include -I$(MWCIncludes) -C_FLAGS += -I$(MYSQL_DIR)/include -C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include - - -# Extra stuff based on debug / release builds -ifeq '$(BUILD)' 'debug' - SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym - C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -DDEBUGGING -DDKFBPON - C_FLAGS += -exc cw -DZEND_DEBUG=1 - LD_FLAGS += -sym on -sym codeview4 -osym $(SYM_FILE) - export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib -else - C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off -opt intrinsics - C_FLAGS += -opt level=4 -DZEND_DEBUG=0 - LD_FLAGS += -sym off - export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib -endif - - -# Dependencies -MODULE = LibC \ - phplib -IMPORT = @$(SDK_DIR)/imports/libc.imp \ - @$(SDK_DIR)/imports/ws2nlm.imp \ - @$(MPK_DIR)/import/mpkOrg.imp \ - @$(PROJECT_ROOT)/netware/phplib.imp -EXPORT = ($(MODULE_NAME)) get_module -API = OutputToScreen - -# Virtual paths -vpath %.cpp . -vpath %.c . ..\..\netware -vpath %.obj $(OBJ_DIR) - - -all: prebuild project - -.PHONY: all - -prebuild: - @if not exist $(OBJ_DIR) md $(OBJ_DIR) - -project: $(BINARY) - @echo Build complete. - -$(OBJ_DIR)/%.d: %.cpp - @echo Building Dependencies for $( $(basename $@).def -ifdef API - @echo Import $(API) >> $(basename $@).def -endif - @echo Module $(MODULE) >> $(basename $@).def -ifdef EXPORT - @echo Export $(EXPORT) >> $(basename $@).def -endif - @echo AutoUnload >> $(basename $@).def -ifeq '$(BUILD)' 'debug' - @echo Debug >> $(basename $@).def -endif - @echo Flag_On 0x00000008 >> $(basename $@).def - @echo Start _LibCPrelude >> $(basename $@).def - @echo Exit _LibCPostlude >> $(basename $@).def - - $(MPKTOOL) $(XDCFLAGS) $(basename $@).xdc - @echo xdcdata $(basename $@).xdc >> $(basename $@).def - - @echo Linking $@... - @echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link - @echo $(LIBRARY) $(OBJECTS) >> $(basename $@).link - @$(LINK) @$(basename $@).link - - -.PHONY: clean -clean: cleanobj cleanbin - -.PHONY: cleand -cleand: - @echo Deleting all dependency files... - -@del "$(OBJ_DIR)\*.d" - -.PHONY: cleanobj -cleanobj: - @echo Deleting all object files... - -@del "$(OBJ_DIR)\*.obj" - -.PHONY: cleanbin -cleanbin: - @echo Deleting binary files... - -@del "$(FINAL_DIR)\$(MODULE_NAME).nlm" - @echo Deleting MAP, DEF files, etc.... - -@del "$(FINAL_DIR)\$(MODULE_NAME).map" - -@del "$(FINAL_DIR)\$(MODULE_NAME).def" - -@del "$(FINAL_DIR)\$(MODULE_NAME).link" -ifeq '$(BUILD)' 'debug' - -@del $(FINAL_DIR)\$(MODULE_NAME).sym -endif diff --git a/ext/mysql/mysql_mysqlnd.h b/ext/mysql/mysql_mysqlnd.h deleted file mode 100644 index 29ac9838f2..0000000000 --- a/ext/mysql/mysql_mysqlnd.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ - | Copyright (c) 2006-2009 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Georg Richter | - | Andrey Hristov | - | Ulf Wendel | - +----------------------------------------------------------------------+ - -*/ - -#ifndef MYSQL_MYSQLND_H -#define MYSQL_MYSQLND_H - -#include "ext/mysqlnd/mysqlnd_libmysql_compat.h" - -/* Here comes non-libmysql API to have less ifdefs in mysqli */ -#define mysql_result_is_unbuffered(r) ((r)->unbuf) - -#endif diff --git a/ext/mysql/package.xml b/ext/mysql/package.xml deleted file mode 100644 index 79fd6ba909..0000000000 --- a/ext/mysql/package.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - mysql - MySQL database access functions - - - georg - Georg Richter - georg@php.net - lead - - - zak - Zak Greant - zak@php.net - developer - - - zeev - Zeev Suraski - zeev@php.net - developer - - - -These functions allow you to access MySQL database servers. - - PHP - - stable - 1.0 - 2005-09-04 - -This is the MySQL driver, taken from the PHP 5.1 release. -It can also be built against PHP 4. - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c deleted file mode 100644 index 1275c9a576..0000000000 --- a/ext/mysql/php_mysql.c +++ /dev/null @@ -1,2754 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Zeev Suraski | - | Zak Greant | - | Georg Richter | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ - -/* TODO: - * - * ? Safe mode implementation - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "php.h" -#include "php_globals.h" -#include "ext/standard/info.h" -#include "ext/standard/php_string.h" -#include "ext/standard/basic_functions.h" - -#include "zend_exceptions.h" - -#if HAVE_MYSQL - -#ifdef PHP_WIN32 -# include -# define signal(a, b) NULL -#elif defined(NETWARE) -# include -# define signal(a, b) NULL -#else -# if HAVE_SIGNAL_H -# include -# endif -# if HAVE_SYS_TYPES_H -# include -# endif -# include -# include -# if HAVE_ARPA_INET_H -# include -# endif -#endif - -#include "php_ini.h" -#include "php_mysql_structs.h" - -/* True globals, no need for thread safety */ -static int le_result, le_link, le_plink; - -#ifdef HAVE_MYSQL_REAL_CONNECT -# ifdef HAVE_ERRMSG_H -# include -# endif -#endif - -#define SAFE_STRING(s) ((s)?(s):"") - -#if MYSQL_VERSION_ID > 32199 || defined(MYSQL_USE_MYSQLND) -# define mysql_row_length_type zend_ulong -# define HAVE_MYSQL_ERRNO -#else -# define mysql_row_length_type unsigned int -# ifdef mysql_errno -# define HAVE_MYSQL_ERRNO -# endif -#endif - -#if MYSQL_VERSION_ID >= 32032 || defined(MYSQL_USE_MYSQLND) -#define HAVE_GETINFO_FUNCS -#endif - -#if MYSQL_VERSION_ID > 32133 || defined(FIELD_TYPE_TINY) -#define MYSQL_HAS_TINY -#endif - -#if MYSQL_VERSION_ID >= 32200 -#define MYSQL_HAS_YEAR -#endif - -#define MYSQL_ASSOC 1<<0 -#define MYSQL_NUM 1<<1 -#define MYSQL_BOTH (MYSQL_ASSOC|MYSQL_NUM) - -#define MYSQL_USE_RESULT 0 -#define MYSQL_STORE_RESULT 1 - -#if MYSQL_VERSION_ID < 32224 -#define PHP_MYSQL_VALID_RESULT(mysql) \ - (mysql_num_fields(mysql)>0) -#else -#define PHP_MYSQL_VALID_RESULT(mysql) \ - (mysql_field_count(mysql)>0) -#endif - -ZEND_DECLARE_MODULE_GLOBALS(mysql) -static PHP_GINIT_FUNCTION(mysql); - -typedef struct _php_mysql_conn { - MYSQL *conn; - zend_resource *active_result_res; - int multi_query; -} php_mysql_conn; - - -#if MYSQL_VERSION_ID >= 40101 -#define MYSQL_DISABLE_MQ if (mysql->multi_query) { \ - mysql_set_server_option(mysql->conn, MYSQL_OPTION_MULTI_STATEMENTS_OFF); \ - mysql->multi_query = 0; \ -} -#else -#define MYSQL_DISABLE_MQ -#endif - -/* {{{ arginfo */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_connect, 0, 0, 0) - ZEND_ARG_INFO(0, hostname) - ZEND_ARG_INFO(0, username) - ZEND_ARG_INFO(0, password) - ZEND_ARG_INFO(0, new) - ZEND_ARG_INFO(0, flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_pconnect, 0, 0, 0) - ZEND_ARG_INFO(0, hostname) - ZEND_ARG_INFO(0, username) - ZEND_ARG_INFO(0, password) - ZEND_ARG_INFO(0, flags) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo__optional_mysql_link, 0, 0, 0) - ZEND_ARG_INFO(0, link_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_select_db, 0, 0, 1) - ZEND_ARG_INFO(0, database_name) - ZEND_ARG_INFO(0, link_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo__void_mysql_arg, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_set_charset, 0, 0, 1) - ZEND_ARG_INFO(0, charset_name) - ZEND_ARG_INFO(0, link_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_query, 0, 0, 1) - ZEND_ARG_INFO(0, query) - ZEND_ARG_INFO(0, link_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_db_query, 0, 0, 2) - ZEND_ARG_INFO(0, database_name) - ZEND_ARG_INFO(0, query) - ZEND_ARG_INFO(0, link_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_list_fields, 0, 0, 2) - ZEND_ARG_INFO(0, database_name) - ZEND_ARG_INFO(0, table_name) - ZEND_ARG_INFO(0, link_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_escape_string, 0, 0, 1) - ZEND_ARG_INFO(0, string) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_real_escape_string, 0, 0, 1) - ZEND_ARG_INFO(0, string) - ZEND_ARG_INFO(0, link_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_result, 0, 0, 2) - ZEND_ARG_INFO(0, result) - ZEND_ARG_INFO(0, row) - ZEND_ARG_INFO(0, field) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo__result_mysql_arg, 0, 0, 1) - ZEND_ARG_INFO(0, result) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_fetch_object, 0, 0, 1) - ZEND_ARG_INFO(0, result) - ZEND_ARG_INFO(0, class_name) - ZEND_ARG_INFO(0, ctor_params) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_fetch_array, 0, 0, 1) - ZEND_ARG_INFO(0, result) - ZEND_ARG_INFO(0, result_type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_data_seek, 0, 0, 2) - ZEND_ARG_INFO(0, result) - ZEND_ARG_INFO(0, row_number) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_fetch_field, 0, 0, 1) - ZEND_ARG_INFO(0, result) - ZEND_ARG_INFO(0, field_offset) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_field_seek, 0, 0, 2) - ZEND_ARG_INFO(0, result) - ZEND_ARG_INFO(0, field_offset) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mysql_field_name, 0, 0, 2) - ZEND_ARG_INFO(0, result) - ZEND_ARG_INFO(0, field_index) -ZEND_END_ARG_INFO() -/* }}} */ - -/* {{{ mysql_functions[] - */ -static const zend_function_entry mysql_functions[] = { - PHP_FE(mysql_connect, arginfo_mysql_connect) - PHP_FE(mysql_pconnect, arginfo_mysql_pconnect) - PHP_FE(mysql_close, arginfo__optional_mysql_link) - PHP_FE(mysql_select_db, arginfo_mysql_select_db) -#ifndef NETWARE /* The below two functions not supported on NetWare */ -#if MYSQL_VERSION_ID < 40000 - PHP_DEP_FE(mysql_create_db, arginfo_mysql_select_db) - PHP_DEP_FE(mysql_drop_db, arginfo_mysql_select_db) -#endif -#endif /* NETWARE */ - PHP_FE(mysql_query, arginfo_mysql_query) - PHP_FE(mysql_unbuffered_query, arginfo_mysql_query) - PHP_DEP_FE(mysql_db_query, arginfo_mysql_db_query) - PHP_DEP_FE(mysql_list_dbs, arginfo__optional_mysql_link) - PHP_DEP_FE(mysql_list_tables, arginfo_mysql_select_db) - PHP_FE(mysql_list_fields, arginfo_mysql_list_fields) - PHP_FE(mysql_list_processes, arginfo__optional_mysql_link) - PHP_FE(mysql_error, arginfo__optional_mysql_link) -#ifdef HAVE_MYSQL_ERRNO - PHP_FE(mysql_errno, arginfo__optional_mysql_link) -#endif - PHP_FE(mysql_affected_rows, arginfo__optional_mysql_link) - PHP_FE(mysql_insert_id, arginfo__optional_mysql_link) - PHP_FE(mysql_result, arginfo_mysql_result) - PHP_FE(mysql_num_rows, arginfo__result_mysql_arg) - PHP_FE(mysql_num_fields, arginfo__result_mysql_arg) - PHP_FE(mysql_fetch_row, arginfo__result_mysql_arg) - PHP_FE(mysql_fetch_array, arginfo_mysql_fetch_array) - PHP_FE(mysql_fetch_assoc, arginfo__result_mysql_arg) - PHP_FE(mysql_fetch_object, arginfo_mysql_fetch_object) - PHP_FE(mysql_data_seek, arginfo_mysql_data_seek) - PHP_FE(mysql_fetch_lengths, arginfo__result_mysql_arg) - PHP_FE(mysql_fetch_field, arginfo_mysql_fetch_field) - PHP_FE(mysql_field_seek, arginfo_mysql_field_seek) - PHP_FE(mysql_free_result, arginfo__result_mysql_arg) - PHP_FE(mysql_field_name, arginfo_mysql_field_name) - PHP_FE(mysql_field_table, arginfo_mysql_field_seek) - PHP_FE(mysql_field_len, arginfo_mysql_field_seek) - PHP_FE(mysql_field_type, arginfo_mysql_field_seek) - PHP_FE(mysql_field_flags, arginfo_mysql_field_seek) - PHP_FE(mysql_escape_string, arginfo_mysql_escape_string) - PHP_FE(mysql_real_escape_string, arginfo_mysql_real_escape_string) - PHP_FE(mysql_stat, arginfo__optional_mysql_link) - PHP_FE(mysql_thread_id, arginfo__optional_mysql_link) - PHP_FE(mysql_client_encoding, arginfo__optional_mysql_link) - PHP_FE(mysql_ping, arginfo__optional_mysql_link) -#ifdef HAVE_GETINFO_FUNCS - PHP_FE(mysql_get_client_info, arginfo__void_mysql_arg) - PHP_FE(mysql_get_host_info, arginfo__optional_mysql_link) - PHP_FE(mysql_get_proto_info, arginfo__optional_mysql_link) - PHP_FE(mysql_get_server_info, arginfo__optional_mysql_link) -#endif - - PHP_FE(mysql_info, arginfo__optional_mysql_link) -#ifdef MYSQL_HAS_SET_CHARSET - PHP_FE(mysql_set_charset, arginfo_mysql_set_charset) -#endif - /* for downwards compatibility */ - PHP_DEP_FALIAS(mysql, mysql_db_query, arginfo_mysql_db_query) - PHP_DEP_FALIAS(mysql_fieldname, mysql_field_name, arginfo_mysql_field_name) - PHP_DEP_FALIAS(mysql_fieldtable, mysql_field_table, arginfo_mysql_field_seek) - PHP_DEP_FALIAS(mysql_fieldlen, mysql_field_len, arginfo_mysql_field_seek) - PHP_DEP_FALIAS(mysql_fieldtype, mysql_field_type, arginfo_mysql_field_seek) - PHP_DEP_FALIAS(mysql_fieldflags, mysql_field_flags, arginfo_mysql_field_seek) - PHP_DEP_FALIAS(mysql_selectdb, mysql_select_db, arginfo_mysql_select_db) -#ifndef NETWARE /* The below two functions not supported on NetWare */ -#if MYSQL_VERSION_ID < 40000 - PHP_DEP_FALIAS(mysql_createdb, mysql_create_db, arginfo_mysql_select_db) - PHP_DEP_FALIAS(mysql_dropdb, mysql_drop_db, arginfo_mysql_select_db) -#endif -#endif /* NETWARE */ - PHP_DEP_FALIAS(mysql_freeresult, mysql_free_result, arginfo__result_mysql_arg) - PHP_DEP_FALIAS(mysql_numfields, mysql_num_fields, arginfo__result_mysql_arg) - PHP_DEP_FALIAS(mysql_numrows, mysql_num_rows, arginfo__result_mysql_arg) - PHP_DEP_FALIAS(mysql_listdbs, mysql_list_dbs, arginfo__optional_mysql_link) - PHP_DEP_FALIAS(mysql_listtables,mysql_list_tables, arginfo_mysql_select_db) - PHP_DEP_FALIAS(mysql_listfields, mysql_list_fields, arginfo_mysql_list_fields) - PHP_FALIAS(mysql_db_name, mysql_result, arginfo_mysql_result) - PHP_DEP_FALIAS(mysql_dbname, mysql_result, arginfo_mysql_result) - PHP_FALIAS(mysql_tablename, mysql_result, arginfo_mysql_result) - PHP_FALIAS(mysql_table_name, mysql_result, arginfo_mysql_result) - PHP_FE_END -}; -/* }}} */ - -/* Dependancies */ -static const zend_module_dep mysql_deps[] = { -#if defined(MYSQL_USE_MYSQLND) - ZEND_MOD_REQUIRED("mysqlnd") -#endif - ZEND_MOD_END -}; - -/* {{{ mysql_module_entry - */ -zend_module_entry mysql_module_entry = { -#if ZEND_MODULE_API_NO >= 20050922 - STANDARD_MODULE_HEADER_EX, NULL, - mysql_deps, -#elif ZEND_MODULE_API_NO >= 20010901 - STANDARD_MODULE_HEADER, -#endif - "mysql", - mysql_functions, - ZEND_MODULE_STARTUP_N(mysql), - PHP_MSHUTDOWN(mysql), - PHP_RINIT(mysql), - PHP_RSHUTDOWN(mysql), - PHP_MINFO(mysql), - "1.0", - PHP_MODULE_GLOBALS(mysql), - PHP_GINIT(mysql), - NULL, - NULL, - STANDARD_MODULE_PROPERTIES_EX -}; -/* }}} */ - -#ifdef COMPILE_DL_MYSQL -#ifdef ZTS -ZEND_TSRMLS_CACHE_DEFINE(); -#endif -ZEND_GET_MODULE(mysql) -#endif - -void timeout(int sig); - -#define CHECK_LINK(link) { if (link == NULL) { php_error_docref(NULL, E_WARNING, "A link to the server could not be established"); RETURN_FALSE; } } - -#if defined(MYSQL_USE_MYSQLND) -#define PHPMY_UNBUFFERED_QUERY_CHECK() \ -{ \ - if (mysql->active_result_res) { \ - do { \ - MYSQL_RES *_mysql_result; \ - _mysql_result = (MYSQL_RES *)mysql->active_result_res->ptr; \ - if (_mysql_result && \ - mysql->active_result_res->type == le_result) { \ - if (mysql_result_is_unbuffered(_mysql_result) && \ - !mysql_eof(_mysql_result)) { \ - php_error_docref(NULL, E_NOTICE, \ - "Function called without first fetching all " \ - "rows from a previous unbuffered query"); \ - } \ - zend_list_close(mysql->active_result_res); \ - mysql->active_result_res = NULL; \ - } \ - } while(0); \ - } \ -} -#else -#define PHPMY_UNBUFFERED_QUERY_CHECK() \ -{ \ - if (mysql->active_result_res) { \ - do { \ - MYSQL_RES *mysql_result; \ - mysql_result = (MYSQL_RES *) mysql->active_result_res->ptr; \ - if (mysql_result && \ - mysql->active_result_res->type == le_result) { \ - if (!mysql_eof(mysql_result)) { \ - php_error_docref(NULL, E_NOTICE, \ - "Function called without first fetching " \ - "all rows from a previous unbuffered query"); \ - while (mysql_fetch_row(mysql_result)); \ - } \ - zend_list_close(mysql->active_result_res); \ - mysql->active_result_res = NULL; \ - } \ - } while(0); \ - } \ -} -#endif - -/* {{{ _free_mysql_result - * This wrapper is required since mysql_free_result() returns an integer, and - * thus, cannot be used directly - */ -static void _free_mysql_result(zend_resource *rsrc) -{ - MYSQL_RES *mysql_result = (MYSQL_RES *)rsrc->ptr; - - mysql_free_result(mysql_result); - MySG(result_allocated)--; -} -/* }}} */ - -/* {{{ php_mysql_set_default_link - */ -static void php_mysql_set_default_link(zend_resource *link) -{ - if (MySG(default_link) != NULL) { - zend_list_delete(MySG(default_link)); - } - ++GC_REFCOUNT(link); - MySG(default_link) = link; -} -/* }}} */ - -/* {{{ php_mysql_select_db -*/ -static int php_mysql_select_db(php_mysql_conn *mysql, char *db) -{ - PHPMY_UNBUFFERED_QUERY_CHECK(); - - if (mysql_select_db(mysql->conn, db) != 0) { - return 0; - } else { - return 1; - } -} -/* }}} */ - -/* {{{ _close_mysql_link - */ -static void _close_mysql_link(zend_resource *rsrc) -{ - php_mysql_conn *link = (php_mysql_conn *)rsrc->ptr; - void (*handler)(int); - - handler = signal(SIGPIPE, SIG_IGN); - mysql_close(link->conn); - signal(SIGPIPE, handler); - efree(link); - MySG(num_links)--; -} -/* }}} */ - -/* {{{ _close_mysql_plink - */ -static void _close_mysql_plink(zend_resource *rsrc) -{ - php_mysql_conn *link = (php_mysql_conn *)rsrc->ptr; - void (*handler) (int); - - handler = signal(SIGPIPE, SIG_IGN); - mysql_close(link->conn); - signal(SIGPIPE, handler); - - free(link); - MySG(num_persistent)--; - MySG(num_links)--; -} -/* }}} */ - -/* {{{ PHP_INI_MH - */ -static PHP_INI_MH(OnMySQLPort) -{ - if (new_value != NULL) { /* default port */ - MySG(default_port) = atoi(new_value->val); - } else { - MySG(default_port) = -1; - } - - return SUCCESS; -} -/* }}} */ - -/* {{{ PHP_INI */ -PHP_INI_BEGIN() - STD_PHP_INI_BOOLEAN("mysql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong, allow_persistent, zend_mysql_globals, mysql_globals) - STD_PHP_INI_ENTRY_EX("mysql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_persistent, zend_mysql_globals, mysql_globals, display_link_numbers) - STD_PHP_INI_ENTRY_EX("mysql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_links, zend_mysql_globals, mysql_globals, display_link_numbers) - STD_PHP_INI_ENTRY("mysql.default_host", NULL, PHP_INI_ALL, OnUpdateString, default_host, zend_mysql_globals, mysql_globals) - STD_PHP_INI_ENTRY("mysql.default_user", NULL, PHP_INI_ALL, OnUpdateString, default_user, zend_mysql_globals, mysql_globals) - STD_PHP_INI_ENTRY("mysql.default_password", NULL, PHP_INI_ALL, OnUpdateString, default_password, zend_mysql_globals, mysql_globals) - PHP_INI_ENTRY("mysql.default_port", NULL, PHP_INI_ALL, OnMySQLPort) -#ifdef MYSQL_UNIX_ADDR - STD_PHP_INI_ENTRY("mysql.default_socket", MYSQL_UNIX_ADDR,PHP_INI_ALL,OnUpdateStringUnempty, default_socket, zend_mysql_globals, mysql_globals) -#else - STD_PHP_INI_ENTRY("mysql.default_socket", NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_socket, zend_mysql_globals, mysql_globals) -#endif - STD_PHP_INI_ENTRY("mysql.connect_timeout", "60", PHP_INI_ALL, OnUpdateLong, connect_timeout, zend_mysql_globals, mysql_globals) - STD_PHP_INI_BOOLEAN("mysql.trace_mode", "0", PHP_INI_ALL, OnUpdateLong, trace_mode, zend_mysql_globals, mysql_globals) - STD_PHP_INI_BOOLEAN("mysql.allow_local_infile", "1", PHP_INI_SYSTEM, OnUpdateLong, allow_local_infile, zend_mysql_globals, mysql_globals) -PHP_INI_END() -/* }}} */ - -/* {{{ PHP_GINIT_FUNCTION - */ -static PHP_GINIT_FUNCTION(mysql) -{ -#if defined(COMPILE_DL_MYSQL) && defined(ZTS) - ZEND_TSRMLS_CACHE_UPDATE(); -#endif - mysql_globals->num_persistent = 0; - mysql_globals->default_socket = NULL; - mysql_globals->default_host = NULL; - mysql_globals->default_user = NULL; - mysql_globals->default_password = NULL; - mysql_globals->connect_errno = 0; - mysql_globals->connect_error = NULL; - mysql_globals->connect_timeout = 0; - mysql_globals->trace_mode = 0; - mysql_globals->allow_local_infile = 1; - mysql_globals->result_allocated = 0; -} -/* }}} */ - -#ifdef MYSQL_USE_MYSQLND -#include "ext/mysqlnd/mysqlnd_reverse_api.h" -static MYSQLND *mysql_convert_zv_to_mysqlnd(zval *zv) -{ - php_mysql_conn *mysql; - - if (Z_TYPE_P(zv) != IS_RESOURCE) { - /* Might be nicer to check resource type, too, but ext/mysql is the only one using resources so emitting an error is not to bad, while usually this hook should be silent */ - return NULL; - } - - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(zv), "MySQL-Link", le_link, le_plink))) { - return NULL; - } - - return mysql->conn; -} - -static MYSQLND_REVERSE_API mysql_reverse_api = { - &mysql_module_entry, - mysql_convert_zv_to_mysqlnd -}; -#endif - -/* {{{ PHP_MINIT_FUNCTION - */ -ZEND_MODULE_STARTUP_D(mysql) -{ - REGISTER_INI_ENTRIES(); - le_result = zend_register_list_destructors_ex(_free_mysql_result, NULL, "mysql result", module_number); - le_link = zend_register_list_destructors_ex(_close_mysql_link, NULL, "mysql link", module_number); - le_plink = zend_register_list_destructors_ex(NULL, _close_mysql_plink, "mysql link persistent", module_number); - mysql_module_entry.type = type; - - REGISTER_LONG_CONSTANT("MYSQL_ASSOC", MYSQL_ASSOC, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQL_NUM", MYSQL_NUM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQL_BOTH", MYSQL_BOTH, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQL_CLIENT_COMPRESS", CLIENT_COMPRESS, CONST_CS | CONST_PERSISTENT); -#if MYSQL_VERSION_ID >= 40000 - REGISTER_LONG_CONSTANT("MYSQL_CLIENT_SSL", CLIENT_SSL, CONST_CS | CONST_PERSISTENT); -#endif - REGISTER_LONG_CONSTANT("MYSQL_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT); - -#ifndef MYSQL_USE_MYSQLND -#if MYSQL_VERSION_ID >= 40000 - if (mysql_server_init(0, NULL, NULL)) { - return FAILURE; - } -#endif -#endif - -#ifdef MYSQL_USE_MYSQLND - mysqlnd_reverse_api_register_api(&mysql_reverse_api); -#endif - - return SUCCESS; -} -/* }}} */ - -/* {{{ PHP_MSHUTDOWN_FUNCTION - */ -PHP_MSHUTDOWN_FUNCTION(mysql) -{ -#ifndef MYSQL_USE_MYSQLND -#if MYSQL_VERSION_ID >= 40000 -#ifdef PHP_WIN32 - unsigned long client_ver = mysql_get_client_version(); - /* - Can't call mysql_server_end() multiple times prior to 5.0.46 on Windows. - PHP bug#41350 MySQL bug#25621 - */ - if ((client_ver >= 50046 && client_ver < 50100) || client_ver > 50122) { - mysql_server_end(); - } -#else - mysql_server_end(); -#endif -#endif -#endif - - UNREGISTER_INI_ENTRIES(); - return SUCCESS; -} -/* }}} */ - -/* {{{ PHP_RINIT_FUNCTION - */ -PHP_RINIT_FUNCTION(mysql) -{ -#if !defined(MYSQL_USE_MYSQLND) && defined(ZTS) && MYSQL_VERSION_ID >= 40000 - if (mysql_thread_init()) { - return FAILURE; - } -#endif - MySG(default_link) = NULL; - MySG(num_links) = MySG(num_persistent); - /* Reset connect error/errno on every request */ - MySG(connect_error) = NULL; - MySG(connect_errno) =0; - MySG(result_allocated) = 0; - - return SUCCESS; -} -/* }}} */ - -#if defined(A0) && defined(MYSQL_USE_MYSQLND) -static int php_mysql_persistent_helper(zval *el) -{ - zend_resource *le = (zend_resource *)Z_PTR_P(el); - if (le->type == le_plink) { - mysqlnd_end_psession(((php_mysql_conn *) le->ptr)->conn); - } - return ZEND_HASH_APPLY_KEEP; -} /* }}} */ -#endif - - -/* {{{ PHP_RSHUTDOWN_FUNCTION - */ -PHP_RSHUTDOWN_FUNCTION(mysql) -{ -#if !defined(MYSQL_USE_MYSQLND) && defined(ZTS) && MYSQL_VERSION_ID >= 40000 - mysql_thread_end(); -#endif - - if (MySG(trace_mode)) { - if (MySG(result_allocated)){ - php_error_docref("function.mysql-free-result", E_WARNING, "%pu result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query()", MySG(result_allocated)); - } - } - - if (MySG(connect_error)!=NULL) { - efree(MySG(connect_error)); - } - -#if defined(A0) && defined(MYSQL_USE_MYSQLND) - zend_hash_apply(&EG(persistent_list), (apply_func_t) php_mysql_persistent_helper); -#endif - - return SUCCESS; -} -/* }}} */ - -/* {{{ PHP_MINFO_FUNCTION - */ -PHP_MINFO_FUNCTION(mysql) -{ - char buf[32]; - - php_info_print_table_start(); - php_info_print_table_header(2, "MySQL Support", "enabled"); - snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MySG(num_persistent)); - php_info_print_table_row(2, "Active Persistent Links", buf); - snprintf(buf, sizeof(buf), ZEND_LONG_FMT, MySG(num_links)); - php_info_print_table_row(2, "Active Links", buf); - php_info_print_table_row(2, "Client API version", mysql_get_client_info()); -#if !defined (PHP_WIN32) && !defined (NETWARE) && !defined(MYSQL_USE_MYSQLND) - php_info_print_table_row(2, "MYSQL_MODULE_TYPE", PHP_MYSQL_TYPE); - php_info_print_table_row(2, "MYSQL_SOCKET", MYSQL_UNIX_ADDR); - php_info_print_table_row(2, "MYSQL_INCLUDE", PHP_MYSQL_INCLUDE); - php_info_print_table_row(2, "MYSQL_LIBS", PHP_MYSQL_LIBS); -#endif - - php_info_print_table_end(); - - DISPLAY_INI_ENTRIES(); - -} -/* }}} */ - -/* {{{ php_mysql_do_connect - */ -#define MYSQL_DO_CONNECT_CLEANUP() \ - if (free_host) { \ - efree(host); \ - } - -#define MYSQL_DO_CONNECT_RETURN_FALSE() \ - MYSQL_DO_CONNECT_CLEANUP(); \ - RETURN_FALSE; - -#ifdef MYSQL_USE_MYSQLND -#define MYSQL_PORT 0 -#endif - -static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) -{ - char *user = NULL, *passwd = NULL; - char *host_and_port = NULL, *socket = NULL; - char *tmp = NULL, *host = NULL; - size_t user_len = 0, passwd_len = 0, host_len = 0; - int port = MYSQL_PORT; - zend_long client_flags = 0; - php_mysql_conn *mysql = NULL; -#if MYSQL_VERSION_ID <= 32230 - void (*handler) (int); -#endif - zend_long connect_timeout; - zend_string *hashed_details = NULL; - zend_bool free_host = 0, new_link = 0; - - php_error_docref(NULL, - E_DEPRECATED, - "The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead"); - -#if !defined(MYSQL_USE_MYSQLND) - if ((MYSQL_VERSION_ID / 100) != (mysql_get_client_version() / 100)) { - php_error_docref(NULL, E_WARNING, - "Headers and client library minor version mismatch. Headers:%d Library:%ld", - MYSQL_VERSION_ID, mysql_get_client_version()); - } -#endif - - connect_timeout = MySG(connect_timeout); - - socket = MySG(default_socket); - - if (MySG(default_port) < 0) { -#if !defined(PHP_WIN32) && !defined(NETWARE) - struct servent *serv_ptr; - char *env; - - MySG(default_port) = MYSQL_PORT; - if ((serv_ptr = getservbyname("mysql", "tcp"))) { - MySG(default_port) = (uint)ntohs((ushort)serv_ptr->s_port); - } - if ((env = getenv("MYSQL_TCP_PORT"))) { - MySG(default_port) = (uint)atoi(env); - } -#else - MySG(default_port) = MYSQL_PORT; -#endif - } - - if (PG(sql_safe_mode)) { - if (ZEND_NUM_ARGS()>0) { - php_error_docref(NULL, E_NOTICE, "SQL safe mode in effect - ignoring host/user/password information"); - } - user = php_get_current_user(); - hashed_details = zend_string_alloc(sizeof("mysql___") + strlen(user) - 1, 0); - snprintf(hashed_details->val, hashed_details->len + 1, "mysql__%s_", user); - client_flags = CLIENT_INTERACTIVE; - } else { - /* mysql_pconnect does not support new_link parameter */ - if (persistent) { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!s!l", &host_and_port, &host_len, - &user, &user_len, &passwd, &passwd_len, - &client_flags)==FAILURE) { - return; - } - } else { - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!s!bl", &host_and_port, &host_len, - &user, &user_len, &passwd, &passwd_len, - &new_link, &client_flags)==FAILURE) { - return; - } - } - - if (!host_and_port) { - host_and_port = MySG(default_host); - } - if (!user) { - user = MySG(default_user); - } - if (!passwd) { - passwd = MySG(default_password); - passwd_len = passwd? strlen(passwd):0; - } - - /* disable local infile option for open_basedir */ -#if PHP_API_VERSION < 20100412 - if (((PG(open_basedir) && PG(open_basedir)[0] != '\0') || PG(safe_mode)) && (client_flags & CLIENT_LOCAL_FILES)) { -#else - if ((PG(open_basedir) && PG(open_basedir)[0] != '\0') && (client_flags & CLIENT_LOCAL_FILES)) { -#endif - client_flags ^= CLIENT_LOCAL_FILES; - } - -#ifdef CLIENT_MULTI_RESULTS - client_flags |= CLIENT_MULTI_RESULTS; /* compatibility with 5.2, see bug#50416 */ -#endif -#ifdef CLIENT_MULTI_STATEMENTS - client_flags &= ~CLIENT_MULTI_STATEMENTS; /* don't allow multi_queries via connect parameter */ -#endif - hashed_details = zend_string_alloc(sizeof("mysql____") + (host_and_port? strlen(host_and_port) : 0) - + (user? strlen(user) : 0) + (passwd? strlen(passwd) : 0) + MAX_LENGTH_OF_LONG - 1, 0); - hashed_details->len = snprintf(hashed_details->val, hashed_details->len + 1, "mysql_%s_%s_%s_" ZEND_LONG_FMT, SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd), client_flags); - } - - /* We cannot use mysql_port anymore in windows, need to use - * mysql_real_connect() to set the port. - */ - if (host_and_port && (tmp = strchr(host_and_port, ':'))) { - host = estrndup(host_and_port, tmp-host_and_port); - free_host = 1; - tmp++; - if (tmp[0] != '/') { - port = atoi(tmp); - if ((tmp=strchr(tmp, ':'))) { - tmp++; - socket=tmp; - } - } else { - socket = tmp; - } - } else { - host = host_and_port; - port = MySG(default_port); - } - -#if MYSQL_VERSION_ID < 32200 - mysql_port = port; -#endif - - if (!MySG(allow_persistent)) { - persistent = 0; - } - - if (persistent) { - zend_resource *le; - zend_string *phashed; - - /* try to find if we already have this link in our persistent list */ - if ((le = zend_hash_find_ptr(&EG(persistent_list), hashed_details)) == NULL) { /* we don't */ - zval new_le; - - if (MySG(max_links) != -1 && MySG(num_links) >= MySG(max_links)) { - php_error_docref(NULL, E_WARNING, "Too many open links (%pd)", MySG(num_links)); - zend_string_release(hashed_details); - MYSQL_DO_CONNECT_RETURN_FALSE(); - } - - if (MySG(max_persistent) != -1 && MySG(num_persistent) >= MySG(max_persistent)) { - php_error_docref(NULL, E_WARNING, "Too many open persistent links (%pd)", MySG(num_persistent)); - zend_string_release(hashed_details); - MYSQL_DO_CONNECT_RETURN_FALSE(); - } - /* create the link */ - mysql = (php_mysql_conn *)malloc(sizeof(php_mysql_conn)); - if (!mysql) { - php_error_docref(NULL, E_ERROR, - "Out of memory while allocating memory for a persistent link"); - } - mysql->active_result_res = NULL; -#ifdef CLIENT_MULTI_STATEMENTS - mysql->multi_query = client_flags & CLIENT_MULTI_STATEMENTS? 1:0; -#else - mysql->multi_query = 0; -#endif - -#ifndef MYSQL_USE_MYSQLND - mysql->conn = mysql_init(NULL); -#else - mysql->conn = mysqlnd_init(MYSQLND_CLIENT_KNOWS_RSET_COPY_DATA, persistent); -#endif - - if (connect_timeout != -1) { - mysql_options(mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout); - } -#ifndef MYSQL_USE_MYSQLND - if (mysql_real_connect(mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL) -#else - if (mysqlnd_connect(mysql->conn, host, user, passwd, passwd_len, NULL, 0, port, socket, client_flags, MYSQLND_CLIENT_KNOWS_RSET_COPY_DATA) == NULL) -#endif - { - /* Populate connect error globals so that the error functions can read them */ - if (MySG(connect_error) != NULL) { - efree(MySG(connect_error)); - } - - MySG(connect_error) = estrdup(mysql_error(mysql->conn)); - php_error_docref(NULL, E_WARNING, "%s", MySG(connect_error)); -#if defined(HAVE_MYSQL_ERRNO) - MySG(connect_errno) = mysql_errno(mysql->conn); -#endif - free(mysql); - zend_string_release(hashed_details); - MYSQL_DO_CONNECT_RETURN_FALSE(); - } - mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile)); - - /* hash it up */ - ZVAL_NEW_PERSISTENT_RES(&new_le, -1, mysql, le_plink); - - /* avoid bogus memleak report */ - phashed = zend_string_init(hashed_details->val, hashed_details->len, 1); - if (zend_hash_update(&EG(persistent_list), phashed, &new_le) == NULL) { - zend_string_release(phashed); - free(mysql); - zend_string_release(hashed_details); - MYSQL_DO_CONNECT_RETURN_FALSE(); - } - zend_string_release(phashed); - MySG(num_persistent)++; - MySG(num_links)++; - } else { /* The link is in our list of persistent connections */ - if (le->type != le_plink) { - MYSQL_DO_CONNECT_RETURN_FALSE(); - } - mysql = (php_mysql_conn *)le->ptr; - mysql->active_result_res = NULL; -#ifdef CLIENT_MULTI_STATEMENTS - mysql->multi_query = client_flags & CLIENT_MULTI_STATEMENTS? 1:0; -#else - mysql->multi_query = 0; -#endif - /* ensure that the link did not die */ -#if defined(A0) && MYSQL_USE_MYSQLND - mysqlnd_end_psession(mysql->conn); -#endif - if (mysql_ping(mysql->conn)) { - if (mysql_errno(mysql->conn) == 2006) { -#ifndef MYSQL_USE_MYSQLND - if (mysql_real_connect(mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL) -#else - if (mysqlnd_connect(mysql->conn, host, user, passwd, passwd_len, NULL, 0, port, socket, client_flags, MYSQLND_CLIENT_KNOWS_RSET_COPY_DATA) == NULL) -#endif - { - php_error_docref(NULL, E_WARNING, "Link to server lost, unable to reconnect"); - zend_hash_del(&EG(persistent_list), hashed_details); - zend_string_release(hashed_details); - MYSQL_DO_CONNECT_RETURN_FALSE(); - } - mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile)); - } - } else { -#ifdef MYSQL_USE_MYSQLND - mysqlnd_restart_psession(mysql->conn); -#endif - } - } - ZVAL_RES(return_value, zend_register_resource(mysql, le_plink)); - } else { /* non persistent */ - zend_resource *index_ptr; - zval new_index_ptr; - - /* first we check the hash for the hashed_details key. if it exists, - * it should point us to the right offset where the actual mysql link sits. - * if it doesn't, open a new mysql link, add it to the resource list, - * and add a pointer to it with hashed_details as the key. - */ - if (!new_link && (index_ptr = zend_hash_find_ptr(&EG(regular_list), hashed_details))) { - zend_resource *link; - - if (index_ptr->type != le_index_ptr) { - MYSQL_DO_CONNECT_RETURN_FALSE(); - } - - link = (zend_resource *)index_ptr->ptr; - if (link && (link->type == le_link || link->type == le_plink)) { - GC_REFCOUNT(link)++; - ZVAL_RES(return_value, link); - php_mysql_set_default_link(link); - zend_string_release(hashed_details); - MYSQL_DO_CONNECT_CLEANUP(); - return; - } else { - zend_hash_del(&EG(regular_list), hashed_details); - } - } - - if (MySG(max_links) != -1 && MySG(num_links) >= MySG(max_links)) { - php_error_docref(NULL, E_WARNING, "Too many open links (%pd)", MySG(num_links)); - zend_string_release(hashed_details); - MYSQL_DO_CONNECT_RETURN_FALSE(); - } - - mysql = (php_mysql_conn *) emalloc(sizeof(php_mysql_conn)); - mysql->active_result_res = NULL; -#ifdef CLIENT_MULTI_STATEMENTS - mysql->multi_query = 1; -#endif - -#ifndef MYSQL_USE_MYSQLND - mysql->conn = mysql_init(NULL); -#else - mysql->conn = mysqlnd_init(MYSQLND_CLIENT_KNOWS_RSET_COPY_DATA, persistent); -#endif - if (!mysql->conn) { - MySG(connect_error) = estrdup("OOM"); - php_error_docref(NULL, E_WARNING, "OOM"); - zend_string_release(hashed_details); - efree(mysql); - MYSQL_DO_CONNECT_RETURN_FALSE(); - } - - if (connect_timeout != -1) { - mysql_options(mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout); - } - -#ifndef MYSQL_USE_MYSQLND - if (mysql_real_connect(mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL) -#else - if (mysqlnd_connect(mysql->conn, host, user, passwd, passwd_len, NULL, 0, port, socket, client_flags, MYSQLND_CLIENT_KNOWS_RSET_COPY_DATA) == NULL) -#endif - { - /* Populate connect error globals so that the error functions can read them */ - if (MySG(connect_error) != NULL) { - efree(MySG(connect_error)); - } - MySG(connect_error) = estrdup(mysql_error(mysql->conn)); - php_error_docref(NULL, E_WARNING, "%s", MySG(connect_error)); -#if defined(HAVE_MYSQL_ERRNO) - MySG(connect_errno) = mysql_errno(mysql->conn); -#endif - /* free mysql structure */ -#ifdef MYSQL_USE_MYSQLND - mysqlnd_close(mysql->conn, MYSQLND_CLOSE_DISCONNECTED); -#endif - zend_string_release(hashed_details); - efree(mysql); - MYSQL_DO_CONNECT_RETURN_FALSE(); - } - mysql_options(mysql->conn, MYSQL_OPT_LOCAL_INFILE, (char *)&MySG(allow_local_infile)); - - /* add it to the list */ - ZVAL_RES(return_value, zend_register_resource(mysql, le_link)); - - /* add it to the hash */ - ZVAL_NEW_RES(&new_index_ptr, -1, Z_RES_P(return_value), le_index_ptr); - if (zend_hash_update(&EG(regular_list), hashed_details, &new_index_ptr) == NULL) { - zval_ptr_dtor(return_value); - zend_string_release(hashed_details); - MYSQL_DO_CONNECT_RETURN_FALSE(); - } - Z_ADDREF_P(return_value); - MySG(num_links)++; - } - - zend_string_release(hashed_details); - php_mysql_set_default_link(Z_RES_P(return_value)); - MYSQL_DO_CONNECT_CLEANUP(); -} -/* }}} */ - -/* {{{ php_mysql_get_default_link - */ -static zend_resource *php_mysql_get_default_link(INTERNAL_FUNCTION_PARAMETERS) -{ - if (MySG(default_link) == NULL) { /* no link opened yet, implicitly open one */ - ZEND_NUM_ARGS() = 0; - php_mysql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); - } - return MySG(default_link); -} -/* }}} */ - -/* {{{ proto resource mysql_connect([string hostname[:port][:/path/to/socket] [, string username [, string password [, bool new [, int flags]]]]]) - Opens a connection to a MySQL Server */ -PHP_FUNCTION(mysql_connect) -{ - php_mysql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto resource mysql_pconnect([string hostname[:port][:/path/to/socket] [, string username [, string password [, int flags]]]]) - Opens a persistent connection to a MySQL Server */ -PHP_FUNCTION(mysql_pconnect) -{ - php_mysql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - -/* {{{ proto bool mysql_close([int link_identifier]) - Close a MySQL connection */ -PHP_FUNCTION(mysql_close) -{ - zend_resource *res; - zval *mysql_link = NULL; - php_mysql_conn *mysql; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &mysql_link) == FAILURE) { - return; - } - - if (mysql_link) { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } else { - if (!MySG(default_link)) { - zend_fetch_resource2_ex(NULL, "MySQL-Link", le_link, le_plink); /* trigger a warning to be consistent */ - RETURN_FALSE; - } - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(MySG(default_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - res = mysql_link ? Z_RES_P(mysql_link) : MySG(default_link); - PHPMY_UNBUFFERED_QUERY_CHECK(); - if (res) { -#ifdef MYSQL_USE_MYSQLND - if (res->type == le_plink) { - mysqlnd_end_psession(mysql->conn); - } -#endif - if (res == MySG(default_link)) { - zend_list_delete(res); - MySG(default_link) = NULL; - } - if (mysql_link) { - /* we have at least 3 additional references to this resource ??? */ - if (GC_REFCOUNT(res) <= 3) { - zend_list_close(res); - } - } - } - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool mysql_select_db(string database_name [, int link_identifier]) - Selects a MySQL database */ -PHP_FUNCTION(mysql_select_db) -{ - char *db; - size_t db_len; - php_mysql_conn *mysql; - zval *mysql_link = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|r", &db, &db_len, &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - if (php_mysql_select_db(mysql, db)) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } -} -/* }}} */ - -#ifdef HAVE_GETINFO_FUNCS - -/* {{{ proto string mysql_get_client_info(void) - Returns a string that represents the client library version */ -PHP_FUNCTION(mysql_get_client_info) -{ - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - RETURN_STRING((char *)mysql_get_client_info()); -} -/* }}} */ - -/* {{{ proto string mysql_get_host_info([int link_identifier]) - Returns a string describing the type of connection in use, including the server host name */ -PHP_FUNCTION(mysql_get_host_info) -{ - zval *mysql_link = NULL; - php_mysql_conn *mysql; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - RETURN_STRING((char *)mysql_get_host_info(mysql->conn)); -} -/* }}} */ - -/* {{{ proto int mysql_get_proto_info([int link_identifier]) - Returns the protocol version used by current connection */ -PHP_FUNCTION(mysql_get_proto_info) -{ - zval *mysql_link = NULL; - php_mysql_conn *mysql; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - RETURN_LONG(mysql_get_proto_info(mysql->conn)); -} -/* }}} */ - -/* {{{ proto string mysql_get_server_info([int link_identifier]) - Returns a string that represents the server version number */ -PHP_FUNCTION(mysql_get_server_info) -{ - zval *mysql_link = NULL; - php_mysql_conn *mysql; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - RETURN_STRING((char *)mysql_get_server_info(mysql->conn)); -} -/* }}} */ - -/* {{{ proto string mysql_info([int link_identifier]) - Returns a string containing information about the most recent query */ -PHP_FUNCTION(mysql_info) -{ - char *str; - zval *mysql_link = NULL; - php_mysql_conn *mysql; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - if ((str = (char *)mysql_info(mysql->conn))) { - RETURN_STRING(str); - } else { - RETURN_FALSE; - } -} -/* }}} */ - -/* {{{ proto int mysql_thread_id([int link_identifier]) - Returns the thread id of current connection */ -PHP_FUNCTION(mysql_thread_id) -{ - zval *mysql_link = NULL; - php_mysql_conn *mysql; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - RETURN_LONG((zend_long) mysql_thread_id(mysql->conn)); -} -/* }}} */ - -/* {{{ proto string mysql_stat([int link_identifier]) - Returns a string containing status information */ -PHP_FUNCTION(mysql_stat) -{ - php_mysql_conn *mysql; - zval *mysql_link = NULL; -#ifndef MYSQL_USE_MYSQLND - char *stat; -#else - zend_string *stat; -#endif - - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - PHPMY_UNBUFFERED_QUERY_CHECK(); -#ifndef MYSQL_USE_MYSQLND - if ((stat = (char *)mysql_stat(mysql->conn))) { - RETURN_STRING(stat); -#else - if (mysqlnd_stat(mysql->conn, &stat) == PASS) { - RETURN_STR(stat); -#endif - } else { - RETURN_FALSE; - } -} -/* }}} */ - -/* {{{ proto string mysql_client_encoding([int link_identifier]) - Returns the default character set for the current connection */ -PHP_FUNCTION(mysql_client_encoding) -{ - php_mysql_conn *mysql; - zval *mysql_link = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - RETURN_STRING((char *)mysql_character_set_name(mysql->conn)); -} -/* }}} */ -#endif - -#ifdef MYSQL_HAS_SET_CHARSET -/* {{{ proto bool mysql_set_charset(string csname [, int link_identifier]) - sets client character set */ -PHP_FUNCTION(mysql_set_charset) -{ - char *csname; - size_t csname_len; - php_mysql_conn *mysql; - zval *mysql_link = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|r", &csname, &csname_len, &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - if (!mysql_set_character_set(mysql->conn, csname)) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } -} -/* }}} */ -#endif - -#ifndef NETWARE /* The below two functions not supported on NetWare */ -#if MYSQL_VERSION_ID < 40000 -/* {{{ proto bool mysql_create_db(string database_name [, int link_identifier]) - Create a MySQL database */ -PHP_FUNCTION(mysql_create_db) -{ - char *db; - size_t db_len; - php_mysql_conn *mysql; - zval *mysql_link = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|r", &db, &db_len, &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - PHPMY_UNBUFFERED_QUERY_CHECK(); - - if (mysql_create_db(mysql->conn, db)==0) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } -} -/* }}} */ - -/* {{{ proto bool mysql_drop_db(string database_name [, int link_identifier]) - Drops (delete) a MySQL database */ -PHP_FUNCTION(mysql_drop_db) -{ - char *db; - size_t db_len; - php_mysql_conn *mysql; - zval *mysql_link = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|r", &db, &db_len, &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - if (mysql_drop_db(mysql->conn, db) == 0) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } -} -/* }}} */ -#endif -#endif /* NETWARE */ - -/* {{{ php_mysql_do_query_general - */ -static void php_mysql_do_query_general(php_mysql_conn *mysql, char *query, int query_len, char *db, int use_store, zval *return_value) -{ - MYSQL_RES *mysql_result; - - if (db) { - if (!php_mysql_select_db(mysql, db)) { - RETURN_FALSE; - } - } - - PHPMY_UNBUFFERED_QUERY_CHECK(); - - MYSQL_DISABLE_MQ; - -#ifndef MYSQL_USE_MYSQLND - /* check explain */ - if (MySG(trace_mode)) { - if (!strncasecmp("select", query, 6)){ - MYSQL_ROW row; - - char *newquery; - int newql = spprintf(&newquery, 0, "EXPLAIN %s", query); - mysql_real_query(mysql->conn, newquery, newql); - efree (newquery); - if (mysql_errno(mysql->conn)) { - php_error_docref("http://www.mysql.com/doc", E_WARNING, "%s", mysql_error(mysql->conn)); - RETURN_FALSE; - } - else { - mysql_result = mysql_use_result(mysql->conn); - while ((row = mysql_fetch_row(mysql_result))) { - if (!strcmp("ALL", row[1])) { - php_error_docref("http://www.mysql.com/doc", E_WARNING, "Your query requires a full tablescan (table %s, %s rows affected). Use EXPLAIN to optimize your query.", row[0], row[6]); - } else if (!strcmp("INDEX", row[1])) { - php_error_docref("http://www.mysql.com/doc", E_WARNING, "Your query requires a full indexscan (table %s, %s rows affected). Use EXPLAIN to optimize your query.", row[0], row[6]); - } - } - mysql_free_result(mysql_result); - } - } - } /* end explain */ -#endif - - /* mysql_query is binary unsafe, use mysql_real_query */ -#if MYSQL_VERSION_ID > 32199 - if (mysql_real_query(mysql->conn, query, query_len)!=0) { - /* check possible error */ - if (MySG(trace_mode)){ - if (mysql_errno(mysql->conn)){ - php_error_docref("http://www.mysql.com/doc", E_WARNING, "%s", mysql_error(mysql->conn)); - } - } - RETURN_FALSE; - } -#else - if (mysql_query(mysql->conn, query)!=0) { - /* check possible error */ - if (MySG(trace_mode)){ - if (mysql_errno(mysql->conn)){ - php_error_docref("http://www.mysql.com/doc", E_WARNING, "%s", mysql_error(mysql->conn)); - } - } - RETURN_FALSE; - } -#endif - if(use_store == MYSQL_USE_RESULT) { - mysql_result = mysql_use_result(mysql->conn); - } else { - mysql_result = mysql_store_result(mysql->conn); - } - if (!mysql_result) { - if (PHP_MYSQL_VALID_RESULT(mysql->conn)) { /* query should have returned rows */ - php_error_docref(NULL, E_WARNING, "Unable to save result set"); - RETURN_FALSE; - } else { - RETURN_TRUE; - } - } - MySG(result_allocated)++; - ZVAL_RES(return_value, zend_register_resource(mysql_result, le_result)); - - if (use_store == MYSQL_USE_RESULT) { - mysql->active_result_res = Z_RES_P(return_value); - Z_ADDREF_P(return_value); - } -} -/* }}} */ - -/* {{{ php_mysql_do_query - */ -static void php_mysql_do_query(INTERNAL_FUNCTION_PARAMETERS, int use_store) -{ - char *query; - size_t query_len; - zval *mysql_link = NULL; - php_mysql_conn *mysql; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|r", &query, &query_len, &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - php_mysql_do_query_general(mysql, query, query_len, NULL, use_store, return_value); -} -/* }}} */ - -/* {{{ proto resource mysql_query(string query [, int link_identifier]) - Sends an SQL query to MySQL */ -PHP_FUNCTION(mysql_query) -{ - php_mysql_do_query(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_STORE_RESULT); -} -/* }}} */ - -/* {{{ proto resource mysql_unbuffered_query(string query [, int link_identifier]) - Sends an SQL query to MySQL, without fetching and buffering the result rows */ -PHP_FUNCTION(mysql_unbuffered_query) -{ - php_mysql_do_query(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_USE_RESULT); -} -/* }}} */ - -/* {{{ proto resource mysql_db_query(string database_name, string query [, int link_identifier]) - Sends an SQL query to MySQL */ -PHP_FUNCTION(mysql_db_query) -{ - char *db, *query; - size_t db_len, query_len; - php_mysql_conn *mysql; - zval *mysql_link = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|r", &db, &db_len, &query, &query_len, &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - php_error_docref(NULL, E_DEPRECATED, "This function is deprecated; use mysql_query() instead"); - - php_mysql_do_query_general(mysql, query, query_len, db, MYSQL_STORE_RESULT, return_value); -} -/* }}} */ - -/* {{{ proto resource mysql_list_dbs([int link_identifier]) - List databases available on a MySQL server */ -PHP_FUNCTION(mysql_list_dbs) -{ - php_mysql_conn *mysql; - MYSQL_RES *mysql_result; - zval *mysql_link = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - php_error_docref(NULL, E_DEPRECATED, "This function is deprecated; use mysql_query() with SHOW DATABASES instead"); - - PHPMY_UNBUFFERED_QUERY_CHECK(); - - if ((mysql_result = mysql_list_dbs(mysql->conn, NULL))==NULL) { - php_error_docref(NULL, E_WARNING, "Unable to save MySQL query result"); - RETURN_FALSE; - } - - MySG(result_allocated)++; - ZVAL_RES(return_value, zend_register_resource(mysql_result, le_result)); -} -/* }}} */ - -/* {{{ proto resource mysql_list_tables(string database_name [, int link_identifier]) - List tables in a MySQL database */ -PHP_FUNCTION(mysql_list_tables) -{ - char *db; - size_t db_len; - php_mysql_conn *mysql; - zval *mysql_link = NULL; - MYSQL_RES *mysql_result; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|r", &db, &db_len, &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - if (!php_mysql_select_db(mysql, db)) { - RETURN_FALSE; - } - - PHPMY_UNBUFFERED_QUERY_CHECK(); - - if ((mysql_result = mysql_list_tables(mysql->conn, NULL))==NULL) { - php_error_docref(NULL, E_WARNING, "Unable to save MySQL query result"); - RETURN_FALSE; - } - MySG(result_allocated)++; - ZVAL_RES(return_value, zend_register_resource(mysql_result, le_result)); -} -/* }}} */ - -/* {{{ proto resource mysql_list_fields(string database_name, string table_name [, int link_identifier]) - List MySQL result fields */ -PHP_FUNCTION(mysql_list_fields) -{ - char *db, *table; - size_t db_len, table_len; - zval *mysql_link = NULL; - php_mysql_conn *mysql; - MYSQL_RES *mysql_result; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|r", &db, &db_len, &table, &table_len, &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - if (!php_mysql_select_db(mysql, db)) { - RETURN_FALSE; - } - - PHPMY_UNBUFFERED_QUERY_CHECK(); - - if ((mysql_result=mysql_list_fields(mysql->conn, table, NULL))==NULL) { - php_error_docref(NULL, E_WARNING, "Unable to save MySQL query result"); - RETURN_FALSE; - } - MySG(result_allocated)++; - ZVAL_RES(return_value, zend_register_resource(mysql_result, le_result)); -} -/* }}} */ - -/* {{{ proto resource mysql_list_processes([int link_identifier]) - Returns a result set describing the current server threads */ -PHP_FUNCTION(mysql_list_processes) -{ - php_mysql_conn *mysql; - zval *mysql_link = NULL; - MYSQL_RES *mysql_result; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - PHPMY_UNBUFFERED_QUERY_CHECK(); - - mysql_result = mysql_list_processes(mysql->conn); - if (mysql_result == NULL) { - php_error_docref(NULL, E_WARNING, "Unable to save MySQL query result"); - RETURN_FALSE; - } - - MySG(result_allocated)++; - ZVAL_RES(return_value, zend_register_resource(mysql_result, le_result)); -} -/* }}} */ - -/* {{{ proto string mysql_error([int link_identifier]) - Returns the text of the error message from previous MySQL operation */ -PHP_FUNCTION(mysql_error) -{ - php_mysql_conn *mysql; - zval *mysql_link = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - if (MySG(default_link) == NULL) { - if (MySG(connect_error) != NULL){ - RETURN_STRING(MySG(connect_error)); - } else { - RETURN_FALSE; - } - } - mysql = (php_mysql_conn*)MySG(default_link)->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - RETURN_STRING((char *)mysql_error(mysql->conn)); -} -/* }}} */ - -/* {{{ proto int mysql_errno([int link_identifier]) - Returns the number of the error message from previous MySQL operation */ -#ifdef HAVE_MYSQL_ERRNO -PHP_FUNCTION(mysql_errno) -{ - php_mysql_conn *mysql; - zval *mysql_link = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - if (MySG(default_link) == NULL) { - if (MySG(connect_error) != NULL){ - RETURN_LONG(MySG(connect_errno)); - } else { - RETURN_FALSE; - } - } - mysql = (php_mysql_conn*)MySG(default_link)->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - RETURN_LONG(mysql_errno(mysql->conn)); -} -#endif -/* }}} */ - -/* {{{ proto int mysql_affected_rows([int link_identifier]) - Gets number of affected rows in previous MySQL operation */ -PHP_FUNCTION(mysql_affected_rows) -{ - php_mysql_conn *mysql; - zval *mysql_link = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - /* conversion from int64 to long happing here */ - RETURN_LONG((zend_long)mysql_affected_rows(mysql->conn)); -} -/* }}} */ - -/* {{{ proto string mysql_escape_string(string to_be_escaped) - Escape string for mysql query */ -PHP_FUNCTION(mysql_escape_string) -{ - char *str; - size_t str_len; - zend_string *escaped_str; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &str_len) == FAILURE) { - return; - } - - /* assume worst case situation, which is 2x of the original string. - * we don't realloc() down to the real size since it'd most probably not - * be worth it - */ - escaped_str = zend_string_alloc(str_len * 2, 0); - escaped_str->len = mysql_escape_string(escaped_str->val, str, str_len); - - php_error_docref("function.mysql-real-escape-string", E_DEPRECATED, "This function is deprecated; use mysql_real_escape_string() instead."); - RETURN_STR(escaped_str); -} -/* }}} */ - -/* {{{ proto string mysql_real_escape_string(string to_be_escaped [, int link_identifier]) - Escape special characters in a string for use in a SQL statement, taking into account the current charset of the connection */ -PHP_FUNCTION(mysql_real_escape_string) -{ - char *str; - size_t str_len; - zend_string *new_str; - php_mysql_conn *mysql; - zval *mysql_link = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|r", &str, &str_len, &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - /* assume worst case situation, which is 2x of the original string. - * we don't realloc() down to the real size since it'd most probably not - * be worth it - */ - new_str = zend_string_alloc(str_len * 2, 0); - new_str->len = mysql_real_escape_string(mysql->conn, new_str->val, str, str_len); - - RETURN_NEW_STR(new_str); -} -/* }}} */ - -/* {{{ proto int mysql_insert_id([int link_identifier]) - Gets the ID generated from the previous INSERT operation */ -PHP_FUNCTION(mysql_insert_id) -{ - php_mysql_conn *mysql; - zval *mysql_link = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &mysql_link) == FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - /* conversion from int64 to long happing here */ - RETURN_LONG((zend_long)mysql_insert_id(mysql->conn)); -} -/* }}} */ - -/* {{{ proto mixed mysql_result(resource result, int row [, mixed field]) - Gets result data */ -PHP_FUNCTION(mysql_result) -{ - zval *result, *field=NULL; - zend_long row; - MYSQL_RES *mysql_result; -#ifndef MYSQL_USE_MYSQLND - MYSQL_ROW sql_row; - mysql_row_length_type *sql_row_lengths; -#endif - int field_offset=0; - -/* -johannes TODO: -Do 2 zend_parse_parameters calls instead of type "z" and switch below -Q: String or long first? -*/ - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|z", &result, &row, &field) == FAILURE) { - return; - } - - if ((mysql_result = (MYSQL_RES*)zend_fetch_resource(Z_RES_P(result), "MySQL result", le_result)) == NULL) { - RETURN_FALSE; - } - - if (row < 0 || row >= (int)mysql_num_rows(mysql_result)) { - php_error_docref(NULL, E_WARNING, "Unable to jump to row %pd on MySQL result index %d", row, Z_RES_P(result)->handle); - RETURN_FALSE; - } - mysql_data_seek(mysql_result, row); - - if (field) { - switch (Z_TYPE_P(field)) { - case IS_STRING: { - int i = 0; - const MYSQL_FIELD *tmp_field; - char *table_name, *field_name, *tmp; - - if ((tmp = strchr(Z_STRVAL_P(field), '.'))) { - table_name = estrndup(Z_STRVAL_P(field), tmp-Z_STRVAL_P(field)); - field_name = estrdup(tmp + 1); - } else { - table_name = NULL; - field_name = estrndup(Z_STRVAL_P(field),Z_STRLEN_P(field)); - } - mysql_field_seek(mysql_result, 0); - while ((tmp_field = mysql_fetch_field(mysql_result))) { - if ((!table_name || - !strncasecmp(tmp_field->table, table_name, tmp_field->table_length)) && - !strncasecmp(tmp_field->name, field_name, tmp_field->name_length)) { - field_offset = i; - break; - } - i++; - } - if (!tmp_field) { /* no match found */ - php_error_docref(NULL, E_WARNING, "%s%s%s not found in MySQL result index %d", - (table_name?table_name:""), (table_name?".":""), field_name, Z_RES_P(result)->handle); - efree(field_name); - if (table_name) { - efree(table_name); - } - RETURN_FALSE; - } - efree(field_name); - if (table_name) { - efree(table_name); - } - } - break; - default: - convert_to_long_ex(field); - field_offset = Z_LVAL_P(field); - if (field_offset < 0 || field_offset >= (int)mysql_num_fields(mysql_result)) { - php_error_docref(NULL, E_WARNING, "Bad column offset specified"); - RETURN_FALSE; - } - break; - } - } - -#ifndef MYSQL_USE_MYSQLND - if ((sql_row = mysql_fetch_row(mysql_result)) == NULL - || (sql_row_lengths=mysql_fetch_lengths(mysql_result)) == NULL) { /* shouldn't happen? */ - RETURN_FALSE; - } - if (sql_row[field_offset]) { - RETVAL_STRINGL(sql_row[field_offset], sql_row_lengths[field_offset]); - } else { - RETURN_NULL(); - } -#else - mysqlnd_result_fetch_field_data(mysql_result, field_offset, return_value); -#endif -} -/* }}} */ - -/* {{{ proto int mysql_num_rows(resource result) - Gets number of rows in a result */ -PHP_FUNCTION(mysql_num_rows) -{ - zval *result; - MYSQL_RES *mysql_result; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &result) == FAILURE) { - return; - } - - if ((mysql_result = (MYSQL_RES*)zend_fetch_resource(Z_RES_P(result), "MySQL result", le_result)) == NULL) { - RETURN_FALSE; - } - - /* conversion from int64 to long happing here */ - RETURN_LONG((zend_long) mysql_num_rows(mysql_result)); -} -/* }}} */ - -/* {{{ proto int mysql_num_fields(resource result) - Gets number of fields in a result */ -PHP_FUNCTION(mysql_num_fields) -{ - zval *result; - MYSQL_RES *mysql_result; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &result) == FAILURE) { - return; - } - - if ((mysql_result = (MYSQL_RES*)zend_fetch_resource(Z_RES_P(result), "MySQL result", le_result)) == NULL) { - RETURN_FALSE; - } - - RETURN_LONG(mysql_num_fields(mysql_result)); -} -/* }}} */ - -/* {{{ php_mysql_fetch_hash - */ -static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_type, int expected_args, int into_object) -{ - MYSQL_RES *mysql_result; - zval *res, *ctor_params = NULL; - zend_class_entry *ce = NULL; -#ifndef MYSQL_USE_MYSQLND - int i; - MYSQL_FIELD *mysql_field; - MYSQL_ROW mysql_row; - mysql_row_length_type *mysql_row_lengths; -#endif - - if (into_object) { - zend_string *class_name = NULL; - -#ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|Sz", &res, &class_name, &ctor_params) == FAILURE) { - return; - } -#else - ZEND_PARSE_PARAMETERS_START(1, 3) - Z_PARAM_ZVAL(res) - Z_PARAM_OPTIONAL - Z_PARAM_STR(class_name) - Z_PARAM_ZVAL(ctor_params) - ZEND_PARSE_PARAMETERS_END(); -#endif - - if (ZEND_NUM_ARGS() < 2) { - ce = zend_standard_class_def; - } else { - ce = zend_fetch_class(class_name, ZEND_FETCH_CLASS_AUTO); - } - if (!ce) { - php_error_docref(NULL, E_WARNING, "Could not find class '%s'", class_name->val); - return; - } - result_type = MYSQL_ASSOC; - } else { -#ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &res, &result_type) == FAILURE) { - return; - } -#else - ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_RESOURCE(res) - Z_PARAM_OPTIONAL - Z_PARAM_LONG(result_type) - ZEND_PARSE_PARAMETERS_END(); -#endif - if (!result_type) { - /* result_type might have been set outside, so only overwrite when not set */ - result_type = MYSQL_BOTH; - } - } - - if (result_type & ~MYSQL_BOTH) { - php_error_docref(NULL, E_WARNING, "The result type should be either MYSQL_NUM, MYSQL_ASSOC or MYSQL_BOTH"); - result_type = MYSQL_BOTH; - } - - if ((mysql_result = (MYSQL_RES*)zend_fetch_resource_ex(res, "MySQL result", le_result)) == NULL) { - RETURN_FALSE; - } - -#ifndef MYSQL_USE_MYSQLND - if ((mysql_row = mysql_fetch_row(mysql_result)) == NULL || - (mysql_row_lengths = mysql_fetch_lengths(mysql_result)) == NULL) { - RETURN_FALSE; - } - - array_init(return_value); - - mysql_field_seek(mysql_result, 0); - for (mysql_field = mysql_fetch_field(mysql_result), i = 0; - mysql_field; - mysql_field = mysql_fetch_field(mysql_result), i++) - { - if (mysql_row[i]) { - zval data; - - ZVAL_STRINGL(&data, mysql_row[i], mysql_row_lengths[i]); - - if (result_type & MYSQL_NUM) { - add_index_zval(return_value, i, &data); - } - if (result_type & MYSQL_ASSOC) { - if (result_type & MYSQL_NUM) { - Z_ADDREF_P(&data); - } - add_assoc_zval(return_value, mysql_field->name, &data); - } - } else { - /* NULL value. */ - if (result_type & MYSQL_NUM) { - add_index_null(return_value, i); - } - - if (result_type & MYSQL_ASSOC) { - add_assoc_null(return_value, mysql_field->name); - } - } - } -#else - mysqlnd_fetch_into(mysql_result, ((result_type & MYSQL_NUM)? MYSQLND_FETCH_NUM:0) | ((result_type & MYSQL_ASSOC)? MYSQLND_FETCH_ASSOC:0), return_value, MYSQLND_MYSQL); -#endif - - /* mysqlnd might return FALSE if no more rows */ - if (into_object && Z_TYPE_P(return_value) != IS_FALSE) { - zval dataset; - zend_fcall_info fci; - zend_fcall_info_cache fcc; - zval retval; - - ZVAL_COPY_VALUE(&dataset, return_value); - object_and_properties_init(return_value, ce, NULL); - if (!ce->default_properties_count && !ce->__set) { - ALLOC_HASHTABLE(Z_OBJ_P(return_value)->properties); - *Z_OBJ_P(return_value)->properties = *Z_ARRVAL(dataset); - efree(Z_ARR(dataset)); - } else { - zend_merge_properties(return_value, Z_ARRVAL(dataset)); - zval_dtor(&dataset); - } - - if (ce->constructor) { - fci.size = sizeof(fci); - fci.function_table = &ce->function_table; - ZVAL_UNDEF(&fci.function_name); - fci.symbol_table = NULL; - fci.object = Z_OBJ_P(return_value); - fci.retval = &retval; - fci.params = NULL; - fci.param_count = 0; - fci.no_separation = 1; - - if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) { - if (zend_fcall_info_args(&fci, ctor_params) == FAILURE) { - /* Two problems why we throw exceptions here: PHP is typeless - * and hence passing one argument that's not an array could be - * by mistake and the other way round is possible, too. The - * single value is an array. Also we'd have to make that one - * argument passed by reference. - */ - zend_throw_exception(zend_exception_get_default(), "Parameter ctor_params must be an array", 0); - return; - } - } - - fcc.initialized = 1; - fcc.function_handler = ce->constructor; - fcc.calling_scope = EG(scope); - fcc.called_scope = Z_OBJCE_P(return_value); - fcc.object = Z_OBJ_P(return_value); - - if (zend_call_function(&fci, &fcc) == FAILURE) { - zend_throw_exception_ex(zend_exception_get_default(), 0, "Could not execute %s::%s()", ce->name->val, ce->constructor->common.function_name->val); - } else { - if (!Z_ISUNDEF(retval)) { - zval_ptr_dtor(&retval); - } - } - if (fci.params) { - efree(fci.params); - } - } else if (ctor_params) { - zend_throw_exception_ex(zend_exception_get_default(), 0, "Class %s does not have a constructor hence you cannot use ctor_params", ce->name->val); - } - } - -} -/* }}} */ - -/* {{{ proto array mysql_fetch_row(resource result) - Gets a result row as an enumerated array */ -PHP_FUNCTION(mysql_fetch_row) -{ - php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_NUM, 1, 0); -} -/* }}} */ - -/* {{{ proto object mysql_fetch_object(resource result [, string class_name [, NULL|array ctor_params]]) - Fetch a result row as an object */ -PHP_FUNCTION(mysql_fetch_object) -{ - php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_ASSOC, 2, 1); - - if (Z_TYPE_P(return_value) == IS_ARRAY) { - object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, Z_ARRVAL_P(return_value)); - } -} -/* }}} */ - -/* {{{ proto array mysql_fetch_array(resource result [, int result_type]) - Fetch a result row as an array (associative, numeric or both) */ -PHP_FUNCTION(mysql_fetch_array) -{ - php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0, 2, 0); -} -/* }}} */ - -/* {{{ proto array mysql_fetch_assoc(resource result) - Fetch a result row as an associative array */ -PHP_FUNCTION(mysql_fetch_assoc) -{ - php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQL_ASSOC, 1, 0); -} -/* }}} */ - -/* {{{ proto bool mysql_data_seek(resource result, int row_number) - Move internal result pointer */ -PHP_FUNCTION(mysql_data_seek) -{ - zval *result; - zend_long offset; - MYSQL_RES *mysql_result; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &result, &offset)) { - return; - } - - if ((mysql_result = zend_fetch_resource(Z_RES_P(result), "MySQL result", le_result)) == NULL) { - RETURN_FALSE; - } - - if (offset < 0 || offset >= (int)mysql_num_rows(mysql_result)) { - php_error_docref(NULL, E_WARNING, "Offset %pd is invalid for MySQL result index %d (or the query data is unbuffered)", offset, Z_RES_P(result)->handle); - RETURN_FALSE; - } - mysql_data_seek(mysql_result, offset); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto array mysql_fetch_lengths(resource result) - Gets max data size of each column in a result */ -PHP_FUNCTION(mysql_fetch_lengths) -{ - zval *result; - MYSQL_RES *mysql_result; - mysql_row_length_type *lengths; - int num_fields; - int i; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &result) == FAILURE) { - return; - } - - if ((mysql_result = (MYSQL_RES *)zend_fetch_resource(Z_RES_P(result), "MySQL result", le_result)) == NULL) { - RETURN_FALSE; - } - - if ((lengths=mysql_fetch_lengths(mysql_result))==NULL) { - RETURN_FALSE; - } - array_init(return_value); - num_fields = mysql_num_fields(mysql_result); - - for (i=0; i 50002 || defined(MYSQL_USE_MYSQLND) - case MYSQL_TYPE_BIT: -#endif -#ifdef MYSQL_HAS_TINY - case FIELD_TYPE_TINY: -#endif - case FIELD_TYPE_SHORT: - case FIELD_TYPE_LONG: - case FIELD_TYPE_LONGLONG: - case FIELD_TYPE_INT24: - return "int"; - break; - case FIELD_TYPE_FLOAT: - case FIELD_TYPE_DOUBLE: - case FIELD_TYPE_DECIMAL: -#ifdef FIELD_TYPE_NEWDECIMAL - case FIELD_TYPE_NEWDECIMAL: -#endif - return "real"; - break; - case FIELD_TYPE_TIMESTAMP: - return "timestamp"; - break; -#ifdef MYSQL_HAS_YEAR - case FIELD_TYPE_YEAR: - return "year"; - break; -#endif - case FIELD_TYPE_DATE: -#ifdef FIELD_TYPE_NEWDATE - case FIELD_TYPE_NEWDATE: -#endif - return "date"; - break; - case FIELD_TYPE_TIME: - return "time"; - break; - case FIELD_TYPE_SET: - return "set"; - break; - case FIELD_TYPE_ENUM: - return "enum"; - break; -#ifdef FIELD_TYPE_GEOMETRY - case FIELD_TYPE_GEOMETRY: - return "geometry"; - break; -#endif - case FIELD_TYPE_DATETIME: - return "datetime"; - break; - case FIELD_TYPE_TINY_BLOB: - case FIELD_TYPE_MEDIUM_BLOB: - case FIELD_TYPE_LONG_BLOB: - case FIELD_TYPE_BLOB: - return "blob"; - break; - case FIELD_TYPE_NULL: - return "null"; - break; - default: - return "unknown"; - break; - } -} -/* }}} */ - -/* {{{ proto object mysql_fetch_field(resource result [, int field_offset]) - Gets column information from a result and return as an object */ -PHP_FUNCTION(mysql_fetch_field) -{ - zval *result; - zend_long field=0; - MYSQL_RES *mysql_result; - const MYSQL_FIELD *mysql_field; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &result, &field) == FAILURE) { - return; - } - - if ((mysql_result = (MYSQL_RES *)zend_fetch_resource(Z_RES_P(result), "MySQL result", le_result)) == NULL) { - RETURN_FALSE; - } - - if (ZEND_NUM_ARGS() > 1) { - if (field<0 || field >= (int)mysql_num_fields(mysql_result)) { - php_error_docref(NULL, E_WARNING, "Bad field offset"); - RETURN_FALSE; - } - mysql_field_seek(mysql_result, field); - } - if ((mysql_field = mysql_fetch_field(mysql_result)) == NULL) { - RETURN_FALSE; - } - object_init(return_value); - -#if MYSQL_USE_MYSQLND - add_property_str(return_value, "name", zend_string_copy(mysql_field->sname)); -#else - add_property_stringl(return_value, "name", (mysql_field->name?mysql_field->name:""), mysql_field->name_length); -#endif - add_property_stringl(return_value, "table", (mysql_field->table?mysql_field->table:""), mysql_field->table_length); - add_property_stringl(return_value, "def", (mysql_field->def?mysql_field->def:""), mysql_field->def_length); - add_property_long(return_value, "max_length", mysql_field->max_length); - add_property_long(return_value, "not_null", IS_NOT_NULL(mysql_field->flags)?1:0); - add_property_long(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0); - add_property_long(return_value, "multiple_key", (mysql_field->flags&MULTIPLE_KEY_FLAG?1:0)); - add_property_long(return_value, "unique_key", (mysql_field->flags&UNIQUE_KEY_FLAG?1:0)); - add_property_long(return_value, "numeric", IS_NUM(mysql_field->type)?1:0); - add_property_long(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0); - add_property_string(return_value, "type", php_mysql_get_field_name(mysql_field->type)); - add_property_long(return_value, "unsigned", (mysql_field->flags&UNSIGNED_FLAG?1:0)); - add_property_long(return_value, "zerofill", (mysql_field->flags&ZEROFILL_FLAG?1:0)); -} -/* }}} */ - -/* {{{ proto bool mysql_field_seek(resource result, int field_offset) - Sets result pointer to a specific field offset */ -PHP_FUNCTION(mysql_field_seek) -{ - zval *result; - zend_long offset; - MYSQL_RES *mysql_result; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &result, &offset) == FAILURE) { - return; - } - - if ((mysql_result = (MYSQL_RES *)zend_fetch_resource(Z_RES_P(result), "MySQL result", le_result)) == NULL) { - RETURN_FALSE; - } - - if (offset < 0 || offset >= (int)mysql_num_fields(mysql_result)) { - php_error_docref(NULL, E_WARNING, "Field %pd is invalid for MySQL result index %d", offset, Z_RES_P(result)->handle); - RETURN_FALSE; - } - mysql_field_seek(mysql_result, offset); - RETURN_TRUE; -} -/* }}} */ - -#define PHP_MYSQL_FIELD_NAME 1 -#define PHP_MYSQL_FIELD_TABLE 2 -#define PHP_MYSQL_FIELD_LEN 3 -#define PHP_MYSQL_FIELD_TYPE 4 -#define PHP_MYSQL_FIELD_FLAGS 5 - -/* {{{ php_mysql_field_info - */ -static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) -{ - zval *result; - zend_long field; - MYSQL_RES *mysql_result; - const MYSQL_FIELD *mysql_field = {0}; - char buf[512]; - int len; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &result, &field) == FAILURE) { - return; - } - - if ((mysql_result = (MYSQL_RES *)zend_fetch_resource(Z_RES_P(result), "MySQL result", le_result)) == NULL) { - RETURN_FALSE; - } - - if (field < 0 || field >= (int)mysql_num_fields(mysql_result)) { - php_error_docref(NULL, E_WARNING, "Field %pd is invalid for MySQL result index %d", field, Z_RES_P(result)->handle); - RETURN_FALSE; - } - mysql_field_seek(mysql_result, field); - if ((mysql_field=mysql_fetch_field(mysql_result))==NULL) { - RETURN_FALSE; - } - - switch (entry_type) { - case PHP_MYSQL_FIELD_NAME: -#ifdef MYSQL_USE_MYSQLND - RETVAL_STR(zend_string_copy(mysql_field->sname)); -#else - RETVAL_STRING(mysql_field->name); -#endif - break; - case PHP_MYSQL_FIELD_TABLE: - RETVAL_STRING(mysql_field->table); - break; - case PHP_MYSQL_FIELD_LEN: - RETVAL_LONG(mysql_field->length); - break; - case PHP_MYSQL_FIELD_TYPE: - RETVAL_STRING(php_mysql_get_field_name(mysql_field->type)); - break; - case PHP_MYSQL_FIELD_FLAGS: - memcpy(buf, "", sizeof("")); -#ifdef IS_NOT_NULL - if (IS_NOT_NULL(mysql_field->flags)) { - strcat(buf, "not_null "); - } -#endif -#ifdef IS_PRI_KEY - if (IS_PRI_KEY(mysql_field->flags)) { - strcat(buf, "primary_key "); - } -#endif -#ifdef UNIQUE_KEY_FLAG - if (mysql_field->flags&UNIQUE_KEY_FLAG) { - strcat(buf, "unique_key "); - } -#endif -#ifdef MULTIPLE_KEY_FLAG - if (mysql_field->flags&MULTIPLE_KEY_FLAG) { - strcat(buf, "multiple_key "); - } -#endif -#ifdef IS_BLOB - if (IS_BLOB(mysql_field->flags)) { - strcat(buf, "blob "); - } -#endif -#ifdef UNSIGNED_FLAG - if (mysql_field->flags&UNSIGNED_FLAG) { - strcat(buf, "unsigned "); - } -#endif -#ifdef ZEROFILL_FLAG - if (mysql_field->flags&ZEROFILL_FLAG) { - strcat(buf, "zerofill "); - } -#endif -#ifdef BINARY_FLAG - if (mysql_field->flags&BINARY_FLAG) { - strcat(buf, "binary "); - } -#endif -#ifdef ENUM_FLAG - if (mysql_field->flags&ENUM_FLAG) { - strcat(buf, "enum "); - } -#endif -#ifdef SET_FLAG - if (mysql_field->flags&SET_FLAG) { - strcat(buf, "set "); - } -#endif -#ifdef AUTO_INCREMENT_FLAG - if (mysql_field->flags&AUTO_INCREMENT_FLAG) { - strcat(buf, "auto_increment "); - } -#endif -#ifdef TIMESTAMP_FLAG - if (mysql_field->flags&TIMESTAMP_FLAG) { - strcat(buf, "timestamp "); - } -#endif - len = strlen(buf); - /* remove trailing space, if present */ - if (len && buf[len-1] == ' ') { - buf[len-1] = 0; - len--; - } - - RETVAL_STRINGL(buf, len); - break; - - default: - RETURN_FALSE; - } -} -/* }}} */ - -/* {{{ proto string mysql_field_name(resource result, int field_index) - Gets the name of the specified field in a result */ -PHP_FUNCTION(mysql_field_name) -{ - php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_NAME); -} -/* }}} */ - -/* {{{ proto string mysql_field_table(resource result, int field_offset) - Gets name of the table the specified field is in */ -PHP_FUNCTION(mysql_field_table) -{ - php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_TABLE); -} -/* }}} */ - -/* {{{ proto int mysql_field_len(resource result, int field_offset) - Returns the length of the specified field */ -PHP_FUNCTION(mysql_field_len) -{ - php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_LEN); -} -/* }}} */ - -/* {{{ proto string mysql_field_type(resource result, int field_offset) - Gets the type of the specified field in a result */ -PHP_FUNCTION(mysql_field_type) -{ - php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_TYPE); -} -/* }}} */ - -/* {{{ proto string mysql_field_flags(resource result, int field_offset) - Gets the flags associated with the specified field in a result */ -PHP_FUNCTION(mysql_field_flags) -{ - php_mysql_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_MYSQL_FIELD_FLAGS); -} -/* }}} */ - -/* {{{ proto bool mysql_free_result(resource result) - Free result memory */ -PHP_FUNCTION(mysql_free_result) -{ - zval *result; - MYSQL_RES *mysql_result; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &result) == FAILURE) { - return; - } - - if ((mysql_result = (MYSQL_RES *)zend_fetch_resource(Z_RES_P(result), "MySQL result", le_result)) == NULL) { - RETURN_FALSE; - } - - zend_list_close(Z_RES_P(result)); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool mysql_ping([int link_identifier]) - Ping a server connection. If no connection then reconnect. */ -PHP_FUNCTION(mysql_ping) -{ - php_mysql_conn *mysql; - zval *mysql_link = NULL; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &mysql_link)==FAILURE) { - return; - } - - if (!mysql_link) { - zend_resource *res = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - CHECK_LINK(res); - mysql = (php_mysql_conn*)res->ptr; - } else { - if (!(mysql = (php_mysql_conn *)zend_fetch_resource2(Z_RES_P(mysql_link), "MySQL-Link", le_link, le_plink))) { - RETURN_FALSE; - } - } - - PHPMY_UNBUFFERED_QUERY_CHECK(); - - RETURN_BOOL(!mysql_ping(mysql->conn)); -} -/* }}} */ - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/ext/mysql/php_mysql.h b/ext/mysql/php_mysql.h deleted file mode 100644 index cffb3cd21d..0000000000 --- a/ext/mysql/php_mysql.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -/* $Id$ */ - -#ifndef PHP_MYSQL_H -#define PHP_MYSQL_H - -#if HAVE_MYSQL - -extern zend_module_entry mysql_module_entry; -#define mysql_module_ptr &mysql_module_entry - -#else -#define mysql_module_ptr NULL -#endif - -#define phpext_mysql_ptr mysql_module_ptr - -#endif /* PHP_MYSQL_H */ diff --git a/ext/mysql/php_mysql_structs.h b/ext/mysql/php_mysql_structs.h deleted file mode 100644 index e1c9326008..0000000000 --- a/ext/mysql/php_mysql_structs.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Zeev Suraski | - | Andrey Hristov | - +----------------------------------------------------------------------+ -*/ - - -/* $Id$ */ - -#ifndef PHP_MYSQL_STRUCTS_H -#define PHP_MYSQL_STRUCTS_H - -#ifdef ZTS -#include "TSRM.h" -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#if defined(MYSQL_USE_MYSQLND) -#include "ext/mysqlnd/mysqlnd.h" -#include "mysql_mysqlnd.h" -#else -#include -#endif - -#ifdef PHP_MYSQL_UNIX_SOCK_ADDR -#ifdef MYSQL_UNIX_ADDR -#undef MYSQL_UNIX_ADDR -#endif -#define MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR -#endif - -#if (MYSQL_VERSION_ID >= 40113 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50007 || defined(MYSQL_USE_MYSQLND) -#define MYSQL_HAS_SET_CHARSET -#endif - -PHP_MINIT_FUNCTION(mysql); -PHP_RINIT_FUNCTION(mysql); -PHP_MSHUTDOWN_FUNCTION(mysql); -PHP_RSHUTDOWN_FUNCTION(mysql); -PHP_MINFO_FUNCTION(mysql); - -PHP_FUNCTION(mysql_connect); -PHP_FUNCTION(mysql_pconnect); -PHP_FUNCTION(mysql_close); -PHP_FUNCTION(mysql_select_db); -#if MYSQL_VERSION_ID < 40000 -PHP_FUNCTION(mysql_create_db); -PHP_FUNCTION(mysql_drop_db); -#endif -PHP_FUNCTION(mysql_query); -PHP_FUNCTION(mysql_unbuffered_query); -PHP_FUNCTION(mysql_db_query); -PHP_FUNCTION(mysql_list_dbs); -PHP_FUNCTION(mysql_list_tables); -PHP_FUNCTION(mysql_list_fields); -PHP_FUNCTION(mysql_list_processes); -PHP_FUNCTION(mysql_error); -PHP_FUNCTION(mysql_errno); -PHP_FUNCTION(mysql_affected_rows); -PHP_FUNCTION(mysql_insert_id); -PHP_FUNCTION(mysql_result); -PHP_FUNCTION(mysql_num_rows); -PHP_FUNCTION(mysql_num_fields); -PHP_FUNCTION(mysql_fetch_row); -PHP_FUNCTION(mysql_fetch_array); -PHP_FUNCTION(mysql_fetch_assoc); -PHP_FUNCTION(mysql_fetch_object); -PHP_FUNCTION(mysql_data_seek); -PHP_FUNCTION(mysql_fetch_lengths); -PHP_FUNCTION(mysql_fetch_field); -PHP_FUNCTION(mysql_field_seek); -PHP_FUNCTION(mysql_free_result); -PHP_FUNCTION(mysql_field_name); -PHP_FUNCTION(mysql_field_table); -PHP_FUNCTION(mysql_field_len); -PHP_FUNCTION(mysql_field_type); -PHP_FUNCTION(mysql_field_flags); -PHP_FUNCTION(mysql_escape_string); -PHP_FUNCTION(mysql_real_escape_string); -PHP_FUNCTION(mysql_get_client_info); -PHP_FUNCTION(mysql_get_host_info); -PHP_FUNCTION(mysql_get_proto_info); -PHP_FUNCTION(mysql_get_server_info); -PHP_FUNCTION(mysql_info); -PHP_FUNCTION(mysql_stat); -PHP_FUNCTION(mysql_thread_id); -PHP_FUNCTION(mysql_client_encoding); -PHP_FUNCTION(mysql_ping); -#ifdef MYSQL_HAS_SET_CHARSET -PHP_FUNCTION(mysql_set_charset); -#endif - -ZEND_BEGIN_MODULE_GLOBALS(mysql) - zend_resource *default_link; - zend_long num_links,num_persistent; - zend_long max_links,max_persistent; - zend_long allow_persistent; - zend_long default_port; - char *default_host, *default_user, *default_password; - char *default_socket; - char *connect_error; - zend_long connect_errno; - zend_long connect_timeout; - zend_long result_allocated; - zend_long trace_mode; - zend_long allow_local_infile; -ZEND_END_MODULE_GLOBALS(mysql) - -#ifdef ZTS -# define MySG(v) ZEND_TSRMG(mysql_globals_id, zend_mysql_globals *, v) -# ifdef COMPILE_DL_MYSQL -ZEND_TSRMLS_CACHE_EXTERN(); -# endif -#else -# define MySG(v) (mysql_globals.v) -#endif - - -#endif /* PHP_MYSQL_STRUCTS_H */ diff --git a/ext/mysql/tests/001.phpt b/ext/mysql/tests/001.phpt deleted file mode 100644 index 8782fd1252..0000000000 --- a/ext/mysql/tests/001.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -mysql connect ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -%unicode|string%(2) "11" -done! diff --git a/ext/mysql/tests/002.phpt b/ext/mysql/tests/002.phpt deleted file mode 100644 index 8f53f4d724..0000000000 --- a/ext/mysql/tests/002.phpt +++ /dev/null @@ -1,62 +0,0 @@ ---TEST-- -mysql_fetch_array ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -resource(%d) of type (mysql link) -bool(true) -bool(true) -bool(true) -resource(%d) of type (mysql result) -array(3) { - [%u|b%"col1"]=> - %unicode|string%(1) "1" - [%u|b%"col2"]=> - %unicode|string%(3) "foo" - [%u|b%"col3"]=> - %unicode|string%(3) "bar" -} -array(3) { - [%u|b%"col1"]=> - %unicode|string%(1) "2" - [%u|b%"col2"]=> - %unicode|string%(3) "foo" - [%u|b%"col3"]=> - %unicode|string%(3) "bar" -} -done! diff --git a/ext/mysql/tests/003.phpt b/ext/mysql/tests/003.phpt deleted file mode 100644 index 365abc20e9..0000000000 --- a/ext/mysql/tests/003.phpt +++ /dev/null @@ -1,90 +0,0 @@ ---TEST-- -mysql_fetch_object ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -==stdClass== -object(stdClass)#%d (1) { - [%u|b%"a"]=> - %unicode|string%(3) "one" -} -object(stdClass)#%d (1) { - [%u|b%"a"]=> - %unicode|string%(3) "two" -} -object(stdClass)#%d (1) { - [%u|b%"a"]=> - %unicode|string%(5) "three" -} -==class24== -class24::__construct -object(class24)#%d (1) { - [%u|b%"a"]=> - %unicode|string%(3) "one" -} -class24::__construct -object(class24)#%d (1) { - [%u|b%"a"]=> - %unicode|string%(3) "two" -} -class24::__construct -object(class24)#%d (1) { - [%u|b%"a"]=> - %unicode|string%(5) "three" -} -done! diff --git a/ext/mysql/tests/bug47438.phpt b/ext/mysql/tests/bug47438.phpt deleted file mode 100644 index fa7b3e6a2b..0000000000 --- a/ext/mysql/tests/bug47438.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -Bug #47438 (mysql_fetch_field ignores zero offset) ---SKIPIF-- - ---FILE-- -name . "\n"; - $i++; -} - -mysql_query("DROP TABLE IF EXISTS test_47438", $link); - -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -0.a -1.b -2.c diff --git a/ext/mysql/tests/bug48754.phpt b/ext/mysql/tests/bug48754.phpt deleted file mode 100644 index b461db3320..0000000000 --- a/ext/mysql/tests/bug48754.phpt +++ /dev/null @@ -1,100 +0,0 @@ ---TEST-- -Bug #48754 (mysql_close() crash php when no handle specified) ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Explicit connection on close - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -Expect same thread id for $link and default conn: bool(true) -resource(%d) of type (mysql link) -resource(%d) of type (Unknown) - -Warning: mysql_close(): no MySQL-Link resource supplied in %s on line %d - -Closing default link - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -Expect same thread id for $link and default conn but not the previous: bool(true) -resource(%d) of type (mysql link) -resource(%d) of type (mysql link) -resource(%d) of type (Unknown) - -Explicit resource and pconnect - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -resource(%d) of type (mysql link persistent) -resource(%d) of type (Unknown) - -Warning: mysql_close(): no MySQL-Link resource supplied in %s on line %d - -Default link and pconnect - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -resource(%d) of type (mysql link persistent) -resource(%d) of type (mysql link persistent) -resource(%d) of type (Unknown) diff --git a/ext/mysql/tests/bug51242.phpt b/ext/mysql/tests/bug51242.phpt deleted file mode 100644 index 6801d3021f..0000000000 --- a/ext/mysql/tests/bug51242.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -Bug #51242 (Empty mysql.default_port does not default to 3306 anymore, but 0) ---INI-- -mysql.default_port= -mysql.default_socket=/this/does/not/really/need/to/exist ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -resource(%d) of type (mysql link) diff --git a/ext/mysql/tests/bug53649.phpt b/ext/mysql/tests/bug53649.phpt deleted file mode 100644 index 7ccdf08e5f..0000000000 --- a/ext/mysql/tests/bug53649.phpt +++ /dev/null @@ -1,72 +0,0 @@ ---TEST-- -Bug #53649 (mysql_query with "load data" unable to save result set) ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done diff --git a/ext/mysql/tests/bug55473.phpt b/ext/mysql/tests/bug55473.phpt deleted file mode 100644 index 7d149dc6fd..0000000000 --- a/ext/mysql/tests/bug55473.phpt +++ /dev/null @@ -1,99 +0,0 @@ ---TEST-- -Bug #5547 (mysql_pconnect leaks file descriptors on reconnect) ---SKIPIF-- - ---INI-- -mysql.max_persistent=30 -mysql.allow_persistent=1 ---FILE-- - ---EXPECTF-- -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_ping(): MySQL server has gone away in %s on line %d -[003] reconnect 0 - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -[005] Setting openened files... - -Warning: mysql_ping(): MySQL server has gone away in %s on line %d -[003] reconnect 1 - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -[007] Opened files as expected - -Warning: mysql_ping(): MySQL server has gone away in %s on line %d -[003] reconnect 2 - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -[007] Opened files as expected - -Warning: mysql_ping(): MySQL server has gone away in %s on line %d -[003] reconnect 3 - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -[007] Opened files as expected -done! diff --git a/ext/mysql/tests/clean_table.inc b/ext/mysql/tests/clean_table.inc deleted file mode 100644 index e53245b43f..0000000000 --- a/ext/mysql/tests/clean_table.inc +++ /dev/null @@ -1,15 +0,0 @@ - \ No newline at end of file diff --git a/ext/mysql/tests/connect.inc b/ext/mysql/tests/connect.inc deleted file mode 100644 index 0df5bc3aa0..0000000000 --- a/ext/mysql/tests/connect.inc +++ /dev/null @@ -1,82 +0,0 @@ - diff --git a/ext/mysql/tests/mysql_affected_rows.phpt b/ext/mysql/tests/mysql_affected_rows.phpt deleted file mode 100644 index 2449ac416e..0000000000 --- a/ext/mysql/tests/mysql_affected_rows.phpt +++ /dev/null @@ -1,126 +0,0 @@ ---TEST-- -mysql_affected_rows() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_client_encoding.phpt b/ext/mysql/tests/mysql_client_encoding.phpt deleted file mode 100644 index c10303b55a..0000000000 --- a/ext/mysql/tests/mysql_client_encoding.phpt +++ /dev/null @@ -1,73 +0,0 @@ ---TEST-- -mysql_client_encoding() ---SKIPIF-- - ---FILE-- -') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - function_exists('is_unicode')) { -// unicode mode - if (!is_unicode($default_link_enc) || !is_unicode($link_enc)) { - printf("[010] No unicode returned!\n"); - var_dump($default_link_enc); - var_dump($link_enc); - } -} - -mysql_close($link); - -if (false !== ($tmp = @mysql_client_encoding($link))) - printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - -print "done!"; -?> ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_close.phpt b/ext/mysql/tests/mysql_close.phpt deleted file mode 100644 index e676511961..0000000000 --- a/ext/mysql/tests/mysql_close.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -mysql_close() ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_connect.phpt b/ext/mysql/tests/mysql_connect.phpt deleted file mode 100644 index 2b73092375..0000000000 --- a/ext/mysql/tests/mysql_connect.phpt +++ /dev/null @@ -1,128 +0,0 @@ ---TEST-- -mysql_connect() ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_connect(): Access denied for user '%s'@'%s' (using password: YES) in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_constants.phpt b/ext/mysql/tests/mysql_constants.phpt deleted file mode 100644 index e68774503c..0000000000 --- a/ext/mysql/tests/mysql_constants.phpt +++ /dev/null @@ -1,66 +0,0 @@ ---TEST-- -Constants exported by ext/mysql ---SKIPIF-- - ---FILE-- - true, - 'MYSQL_NUM' => true, - 'MYSQL_BOTH' => true, - 'MYSQL_CLIENT_COMPRESS' => true, - 'MYSQL_CLIENT_INTERACTIVE' => true, - 'MYSQL_CLIENT_IGNORE_SPACE' => true, -); - -$version = mysql_get_server_info($link); -if (!preg_match('@(\d+)\.(\d+)\.(\d+)@ism', $version, $matches)) - printf("[001] Cannot get server version\n"); -$version = ($matches[1] * 100) + ($matches[2] * 10) + $matches[3]; - -if ($version > 400) { - $expected_constants = array_merge($expected_constants, array( - "MYSQL_CLIENT_SSL" => true, - )); -} - - -$unexpected_constants = array(); - -foreach ($constants as $group => $consts) { - foreach ($consts as $name => $value) { - if (stristr($name, 'mysql') && !preg_match("/^mysql([^_]+)_/iu", $name)) { - $name = strtoupper($name); - if (isset($expected_constants[$name])) { - unset($expected_constants[$name]); - } else { - $unexpected_constants[$name] = $name; - } - } - } -} - -if (!empty($unexpected_constants)) { - printf("Dumping list of unexpected constants\n"); - var_dump($unexpected_constants); -} - -if (!empty($expected_constants)) { - printf("Dumping list of missing constants\n"); - var_dump($expected_constants); -} - -print "done!"; -?> ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_create_db.phpt b/ext/mysql/tests/mysql_create_db.phpt deleted file mode 100644 index 0b6d58a09e..0000000000 --- a/ext/mysql/tests/mysql_create_db.phpt +++ /dev/null @@ -1,59 +0,0 @@ ---TEST-- -mysql_create_db() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_data_seek.phpt b/ext/mysql/tests/mysql_data_seek.phpt deleted file mode 100644 index 268e145842..0000000000 --- a/ext/mysql/tests/mysql_data_seek.phpt +++ /dev/null @@ -1,79 +0,0 @@ ---TEST-- -mysql_data_seek() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_data_seek(): Offset 4 is invalid for MySQL result index %d (or the query data is unbuffered) in %s on line %d - -Warning: mysql_data_seek(): Offset -1 is invalid for MySQL result index %d (or the query data is unbuffered) in %s on line %d - -Warning: mysql_data_seek(): Offset 3 is invalid for MySQL result index %d (or the query data is unbuffered) in %s on line %d - -Warning: mysql_data_seek(): supplied resource is not a valid MySQL result resource in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_db_name.phpt b/ext/mysql/tests/mysql_db_name.phpt deleted file mode 100644 index ba8334aaff..0000000000 --- a/ext/mysql/tests/mysql_db_name.phpt +++ /dev/null @@ -1,69 +0,0 @@ ---TEST-- -mysql_db_name() ---SKIPIF-- - ---FILE-- -') == 1 && - version_compare(PHP_VERSION, '6.9.9', '<=') == 1); -for ($i = 0; $i < $num; $i++) { - if ('' === ($dbname = mysql_db_name($res, $i))) - printf("[%03d] Got empty database name! [%d] %s\n", - (($i * 2) + 1) + 6, mysql_errno($link), mysql_error($link)); - - if ($unicode && !is_unicode($dbname)) { - printf("[%03d] Expecting unicode string! [%d] %s\n", - (($i * 2) + 2) + 6, mysql_errno($link), mysql_error($link)); - var_inspect($dbname); - } -} - -mysql_free_result($res); - -if (false !== ($tmp = mysql_db_name($res, $num))) - printf("[999] Expecting boolean/false, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysql_errno($link), mysql_error($link)); - -mysql_close($link); - -print "done!\n"; -?> ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_db_name(): Unable to jump to row -1 on MySQL result index %d in %s on line %d - -Warning: mysql_db_name(): Unable to jump to row %d on MySQL result index %d in %s on line %d - -Warning: mysql_db_name(): supplied resource is not a valid MySQL result resource in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_db_query.phpt b/ext/mysql/tests/mysql_db_query.phpt deleted file mode 100644 index dc556f449e..0000000000 --- a/ext/mysql/tests/mysql_db_query.phpt +++ /dev/null @@ -1,70 +0,0 @@ ---TEST-- -mysql_db_query() ---SKIPIF-- - ---FILE-- -') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($row['label'])) { - printf("[006] No unicode returned! [%d] %s\n", mysql_errno($link), mysql_error($link)); - var_inspect($row); -} - -mysql_free_result($res); - - -if (!$res = @mysql_db_query($db, 'SELECT id, label FROM test ORDER BY id LIMIT 1')) - printf("[007] [%d] %s\n", mysql_errno(), mysql_error()); - -$row = mysql_fetch_assoc($res); -if (1 != $row['id']) - printf("[008] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']); - -if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($row['label'])) { - printf("[009] No unicode returned! [%d] %s\n", mysql_errno(), mysql_error()); - var_inspect($row); -} - -mysql_free_result($res); -mysql_close($link); - -print "done!\n"; -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_deprecated_api.phpt b/ext/mysql/tests/mysql_deprecated_api.phpt deleted file mode 100644 index 8844617c66..0000000000 --- a/ext/mysql/tests/mysql_deprecated_api.phpt +++ /dev/null @@ -1,79 +0,0 @@ ---TEST-- -Check if deprecated API calls bail out ---SKIPIF-- - ---INI-- -mysql.trace_mode=1 -error_reporting=E_ALL | E_NOTICE | E_STRICT ---FILE-- -= 0) { - $error = NULL; - ob_start(); - if (!$res = mysql_db_query($db, "SELECT * FROM test", $link)) - $error .= sprintf("[001] [%d] %s\n", mysql_errno($link), mysql_error($link)); - else - mysql_free_result($res); - $output = ob_get_contents(); - ob_end_clean(); - - if (!stristr($output, 'deprecated')) { - printf("[002] mysql_db_query has been deprecated in 5.3.0\n"); - } - - /* - Deprecated since 2002 or the like but documented to be deprecated since 5.3. - In 5.3 and before the deprecation message was bound to mysql.trace_mode=1. - In 5.3.99 the warning will always be thrown, independent of the mysql.trace_mode - setting. - */ - $error = NULL; - ob_start(); - if (!$query = mysql_escape_string("charsets will be ignored")) - $error .= sprintf("[005] [%d] %s\n", mysql_errno($link), mysql_error($link)); - $output = ob_get_contents(); - ob_end_clean(); - - if (!stristr($output, 'deprecated')) { - printf("[006] mysql_escape_string has been deprecated in 5.3.0\n"); - } - -} - -if (version_compare(PHP_VERSION, '5.3.99') >= 0) { - $error = NULL; - ob_start(); - if (!$res = mysql_list_dbs($link)) - $error .= sprintf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link)); - else - mysql_free_result($res); - $output = ob_get_contents(); - ob_end_clean(); - - if (!stristr($output, 'deprecated')) { - printf("[004] mysql_db_query has been deprecated in 5.3.0\n"); - } -} - - - -print "done!"; -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_drop_db.phpt b/ext/mysql/tests/mysql_drop_db.phpt deleted file mode 100644 index 3281b8a333..0000000000 --- a/ext/mysql/tests/mysql_drop_db.phpt +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -mysql_drop_db() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_errno.phpt b/ext/mysql/tests/mysql_errno.phpt deleted file mode 100644 index 83aa7327bd..0000000000 --- a/ext/mysql/tests/mysql_errno.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -mysql_errno() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -int(0) -int(%d) - -Warning: mysql_errno(): supplied resource is not a valid MySQL-Link resource in %s on line %d -bool(false) -done! diff --git a/ext/mysql/tests/mysql_error.phpt b/ext/mysql/tests/mysql_error.phpt deleted file mode 100644 index 9b0729d0c0..0000000000 --- a/ext/mysql/tests/mysql_error.phpt +++ /dev/null @@ -1,71 +0,0 @@ ---TEST-- -mysql_error() ---SKIPIF-- - ---FILE-- -') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($tmp)) { - printf("[007] Expecting Unicode error message!\n"); - var_inspect($tmp); -} - -mysql_close($link); - -var_dump(mysql_error($link)); - -if ($link = @mysql_connect($host . '_unknown', $user . '_unknown', $passwd, true)) { - printf("[008] Can connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host . '_unknown', $user . '_unknown', $db, $port, $socket); -} -if ('' == mysql_error()) - printf("[009] Connect error should have been set\n"); - -print "done!"; -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_error(): supplied resource is not a valid MySQL-Link resource in %s on line %d -bool(false) -done! diff --git a/ext/mysql/tests/mysql_escape_string.phpt b/ext/mysql/tests/mysql_escape_string.phpt deleted file mode 100644 index 8e70da69c9..0000000000 --- a/ext/mysql/tests/mysql_escape_string.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -mysql_escape_string() ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -%unicode|string%(31) "Am I a unicode string in PHP 6?" -%unicode|string%(2) "\\" -%unicode|string%(2) "\"" -%unicode|string%(2) "\'" -%unicode|string%(2) "\n" -%unicode|string%(2) "\r" -%unicode|string%(8) "foo\0bar" -done! diff --git a/ext/mysql/tests/mysql_fetch_array.phpt b/ext/mysql/tests/mysql_fetch_array.phpt deleted file mode 100644 index 1b1852d932..0000000000 --- a/ext/mysql/tests/mysql_fetch_array.phpt +++ /dev/null @@ -1,361 +0,0 @@ ---TEST-- -mysql_fetch_array() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -[005] -array(4) { - [0]=> - %unicode|string%(1) "1" - [%u|b%"id"]=> - %unicode|string%(1) "1" - [1]=> - %unicode|string%(1) "a" - [%u|b%"label"]=> - %unicode|string%(1) "a" -} -[006] -array(2) { - [0]=> - %unicode|string%(1) "2" - [1]=> - %unicode|string%(1) "b" -} -[007] -array(4) { - [0]=> - %unicode|string%(1) "3" - [%u|b%"id"]=> - %unicode|string%(1) "3" - [1]=> - %unicode|string%(1) "c" - [%u|b%"label"]=> - %unicode|string%(1) "c" -} -[008] -array(2) { - [%u|b%"id"]=> - %unicode|string%(1) "4" - [%u|b%"label"]=> - %unicode|string%(1) "d" -} -[009] -array(4) { - [0]=> - %unicode|string%(1) "5" - [%u|b%"id"]=> - %unicode|string%(1) "5" - [1]=> - %unicode|string%(1) "e" - [%u|b%"label"]=> - %unicode|string%(1) "e" -} -[011] -array(11) { - [0]=> - %unicode|string%(1) "1" - [%u|b%"a"]=> - %unicode|string%(1) "2" - [1]=> - %unicode|string%(1) "2" - [2]=> - %unicode|string%(1) "3" - [%u|b%"c"]=> - %unicode|string%(1) "3" - [3]=> - %unicode|string%(1) "4" - [%u|b%"C"]=> - %unicode|string%(1) "4" - [4]=> - NULL - [%u|b%"d"]=> - NULL - [5]=> - %unicode|string%(1) "1" - [%u|b%"e"]=> - %unicode|string%(1) "1" -} - -Warning: mysql_fetch_array(): The result type should be either MYSQL_NUM, MYSQL_ASSOC or MYSQL_BOTH in %s on line %d - -Warning: mysql_fetch_array(): supplied resource is not a valid MySQL result resource in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_fetch_assoc.phpt b/ext/mysql/tests/mysql_fetch_assoc.phpt deleted file mode 100644 index 936c7c6f23..0000000000 --- a/ext/mysql/tests/mysql_fetch_assoc.phpt +++ /dev/null @@ -1,106 +0,0 @@ ---TEST-- -mysql_fetch_assoc() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -[005] -array(2) { - [%u|b%"id"]=> - %unicode|string%(1) "1" - [%u|b%"label"]=> - %unicode|string%(1) "a" -} -[006] -bool(false) -[008] -array(5) { - [%u|b%"a"]=> - %unicode|string%(1) "2" - [%u|b%"c"]=> - %unicode|string%(1) "3" - [%u|b%"C"]=> - %unicode|string%(1) "4" - [%u|b%"d"]=> - NULL - [%u|b%"e"]=> - %unicode|string%(1) "1" -} - -Warning: mysql_fetch_assoc(): supplied resource is not a valid MySQL result resource in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -[010] -array(5) { - [%u|b%"id"]=> - %unicode|string%(1) "1" - [%u|b%"label"]=> - %unicode|string%(1) "a" - [%u|b%"_id"]=> - %unicode|string%(1) "1" - [%u|b%"_label"]=> - %unicode|string%(2) "aa" - [%u|b%"_foo"]=> - NULL -} -done! diff --git a/ext/mysql/tests/mysql_fetch_field.phpt b/ext/mysql/tests/mysql_fetch_field.phpt deleted file mode 100644 index 6855fc52dc..0000000000 --- a/ext/mysql/tests/mysql_fetch_field.phpt +++ /dev/null @@ -1,278 +0,0 @@ ---TEST-- -mysql_fetch_field() ---SKIPIF-- - ---FILE-- - array(1, 'int'), - 'TINYINT' => array(1, 'int'), - 'BOOL' => array('true', 'int'), - 'BOOL' => array(1, 'int'), - 'SMALLINT' => array(32767, 'int'), - 'MEDIUMINT' => array(8388607, 'int'), - 'INT' => array(100, 'int'), - 'BIGINT' => array(100, 'int'), - 'FLOAT' => array(100, 'real'), - 'DOUBLE' => array(100, 'real'), - 'DECIMAL' => array(100, 'real'), - 'DATE' => array(@date('Y-m-d'), 'date'), - 'DATETIME' => array(@date('Y-m-d H:i:s'), 'datetime'), - 'TIMESTAMP' => array(@date('Y-m-d H:i:s'), 'timestamp'), - 'TIME' => array(@date('H:i:s'), 'time'), - 'YEAR' => array(@date('Y'), 'year'), - 'CHAR(1)' => array('a', 'string'), - 'VARCHAR(1)' => array('a', 'string'), - 'BINARY(1)' => array('a', 'string'), - 'VARBINARY(1)' => array('a', 'string'), - 'TINYBLOB' => array('a', 'blob'), - 'TINYTEXT' => array('a', 'blob'), - 'BLOB' => array('a', 'blob'), - 'TEXT' => array('a', 'blob'), - 'MEDIUMBLOB' => array('a', 'blob'), - 'MEDIUMTEXT' => array('a', 'blob'), - 'LONGBLOB' => array('a', 'blob'), - 'LONGTEXT' => array('a', 'blob'), - 'ENUM("a", "b")' => array('a', 'string'), /* !!! */ - 'SET("a", "b")' => array('a', 'string'), /* !!! */ - ); - - foreach ($types as $type_name => $type_desc) { - if (!mysql_query("DROP TABLE IF EXISTS test", $link)) - printf("[008/%s] [%d] %s\n", $type_name, mysql_errno($link), mysql_error($link)); - if (!mysql_query(sprintf("CREATE TABLE test(id INT, label %s) ENGINE = %s", $type_name, $engine), $link)) { - // server and/or engine might not support the data type - continue; - } - - if (is_string($type_desc[0])) - $insert = sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $type_desc[0]); - else - $insert = sprintf("INSERT INTO test(id, label) VALUES (1, %s)", $type_desc[0]); - - if (!mysql_query($insert, $link)) { - if (1366 == mysql_errno($link)) { - /* Strict SQL mode - 1366, Incorrect integer value: 'true' for column 'label' at row 1 */ - continue; - } - printf("[009/%s] [%d] %s\n", $type_name, mysql_errno($link), mysql_error($link)); - continue; - } - if (!$res = mysql_query("SELECT id, label FROM test", $link)) { - printf("[010/%s] [%d] %s\n", $type_name, mysql_errno($link), mysql_error($link)); - continue; - } - if (!$tmp = mysql_fetch_field($res, 1)) { - printf("[011/%s] [%d] %s\n", $type_name, mysql_errno($link), mysql_error($link)); - } - - if ($type_desc[1] != $tmp->type) { - printf("[012/%s] Expecting type '%s' got '%s'\n", $type_name, $type_desc[1], $tmp->type); - } - mysql_free_result($res); - } - - if (!mysql_query("DROP TABLE IF EXISTS test", $link)) - printf("[013] [%d] %s\n", mysql_errno($link), mysql_error($link)); - - if (!mysql_query("CREATE TABLE test(id INT DEFAULT 1)")) - printf("[014] [%d] %s\n", mysql_errno($link), mysql_error($link)); - - if (!mysql_query("INSERT INTO test(id) VALUES (2)")) - printf("[015] [%d] %s\n", mysql_errno($link), mysql_error($link)); - - if (!$res = mysql_query("SELECT id FROM test", $link)) { - printf("[016] [%d] %s\n", mysql_errno($link), mysql_error($link)); - } - - var_dump(mysql_fetch_field($res)); - mysql_free_result($res); - - if (!$res = mysql_query("SELECT id FROM test", $link)) { - printf("[017] [%d] %s\n", mysql_errno($link), mysql_error($link)); - } - $res = mysql_list_fields($db, 'test'); - $found = false; - while ($tmp = mysql_fetch_field($res)) { - if ($tmp->name == 'id') { - printf("Fetch field from mysql_list_fields result set.\n"); - $found = true; - var_dump($tmp); - } - } - if (!$found) - printf("[018] mysqli_list_fields result set processing has failed.\n"); - - mysql_free_result($res); - - mysql_close($link); - print "done!"; -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -object(stdClass)#%d (13) { - [%u|b%"name"]=> - %unicode|string%(2) "ID" - [%u|b%"table"]=> - %unicode|string%(4) "TEST" - [%u|b%"def"]=> - %unicode|string%(0) "" - [%u|b%"max_length"]=> - int(1) - [%u|b%"not_null"]=> - int(1) - [%u|b%"primary_key"]=> - int(1) - [%u|b%"multiple_key"]=> - int(0) - [%u|b%"unique_key"]=> - int(0) - [%u|b%"numeric"]=> - int(1) - [%u|b%"blob"]=> - int(0) - [%u|b%"type"]=> - %unicode|string%(3) "int" - [%u|b%"unsigned"]=> - int(0) - [%u|b%"zerofill"]=> - int(0) -} -object(stdClass)#%d (13) { - [%u|b%"name"]=> - %unicode|string%(5) "label" - [%u|b%"table"]=> - %unicode|string%(4) "TEST" - [%u|b%"def"]=> - %unicode|string%(0) "" - [%u|b%"max_length"]=> - int(1) - [%u|b%"not_null"]=> - int(0) - [%u|b%"primary_key"]=> - int(0) - [%u|b%"multiple_key"]=> - int(0) - [%u|b%"unique_key"]=> - int(0) - [%u|b%"numeric"]=> - int(0) - [%u|b%"blob"]=> - int(0) - [%u|b%"type"]=> - %unicode|string%(6) "string" - [%u|b%"unsigned"]=> - int(0) - [%u|b%"zerofill"]=> - int(0) -} -bool(false) - -Warning: mysql_fetch_field(): Bad field offset in %s on line %d - -Warning: mysql_fetch_field(): supplied resource is not a valid MySQL result resource in %s on line %d -object(stdClass)#%d (13) { - [%u|b%"name"]=> - %unicode|string%(2) "id" - [%u|b%"table"]=> - %unicode|string%(4) "test" - [%u|b%"def"]=> - %unicode|string%(0) "" - [%u|b%"max_length"]=> - int(1) - [%u|b%"not_null"]=> - int(0) - [%u|b%"primary_key"]=> - int(0) - [%u|b%"multiple_key"]=> - int(0) - [%u|b%"unique_key"]=> - int(0) - [%u|b%"numeric"]=> - int(1) - [%u|b%"blob"]=> - int(0) - [%u|b%"type"]=> - %unicode|string%(3) "int" - [%u|b%"unsigned"]=> - int(0) - [%u|b%"zerofill"]=> - int(0) -} -Fetch field from mysql_list_fields result set. -object(stdClass)#%d (13) { - [%u|b%"name"]=> - %unicode|string%(2) "id" - [%u|b%"table"]=> - %unicode|string%(4) "test" - [%u|b%"def"]=> - %unicode|string%(1) "1" - [%u|b%"max_length"]=> - int(0) - [%u|b%"not_null"]=> - int(0) - [%u|b%"primary_key"]=> - int(0) - [%u|b%"multiple_key"]=> - int(0) - [%u|b%"unique_key"]=> - int(0) - [%u|b%"numeric"]=> - int(1) - [%u|b%"blob"]=> - int(0) - [%u|b%"type"]=> - %unicode|string%(3) "int" - [%u|b%"unsigned"]=> - int(0) - [%u|b%"zerofill"]=> - int(0) -} -done! diff --git a/ext/mysql/tests/mysql_fetch_lengths.phpt b/ext/mysql/tests/mysql_fetch_lengths.phpt deleted file mode 100644 index f59833e918..0000000000 --- a/ext/mysql/tests/mysql_fetch_lengths.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -mysql_fetch_lengths() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -array(2) { - [0]=> - int(1) - [1]=> - int(1) -} -bool(false) - -Warning: mysql_fetch_lengths(): supplied resource is not a valid MySQL result resource in %s on line %d -bool(false) -done! diff --git a/ext/mysql/tests/mysql_fetch_object.phpt b/ext/mysql/tests/mysql_fetch_object.phpt deleted file mode 100644 index 5038863458..0000000000 --- a/ext/mysql/tests/mysql_fetch_object.phpt +++ /dev/null @@ -1,153 +0,0 @@ ---TEST-- -mysql_fetch_object() ---SKIPIF-- - ---FILE-- -a = $a; - $this->b = $b; - } - -} - -var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', null)); -var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', array('a'))); -var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', array('a', 'b'))); -var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', array('a', 'b', 'c'))); -var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', "no array and not null")); -var_dump(mysql_fetch_object($res)); -var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', array('a', 'b'))); - -class mysql_fetch_object_private_construct { - private function __construct($a, $b) { - var_dump($a); - } -} -var_dump(mysql_fetch_object($res, 'mysql_fetch_object_private_construct', array('a', 'b'))); - -mysql_free_result($res); - -if (!$res = mysql_query("SELECT id AS ID, label FROM test AS TEST", $link)) { - printf("[009] [%d] %s\n", mysql_errno($link), mysql_error($link)); -} - -mysql_free_result($res); - -var_dump(mysql_fetch_object($res)); - -// Fatal error, script execution will end -var_dump(mysql_fetch_object($res, 'this_class_does_not_exist')); - -mysql_close($link); -print "done!"; -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -object(stdClass)#%d (2) { - [%u|b%"ID"]=> - %unicode|string%(1) "1" - [%u|b%"label"]=> - %unicode|string%(1) "a" -} -object(mysql_fetch_object_test)#%d (4) { - [%u|b%"a"]=> - NULL - [%u|b%"b"]=> - NULL - [%u|b%"ID"]=> - %unicode|string%(1) "2" - [%u|b%"label"]=> - %unicode|string%(1) "b" -} - -Warning: Missing argument 1 for mysql_fetch_object_construct::__construct() in %s on line %d - -Warning: Missing argument 2 for mysql_fetch_object_construct::__construct() in %s on line %d - -Notice: Undefined variable: a in %s on line %d - -Notice: Undefined variable: b in %s on line %d -object(mysql_fetch_object_construct)#%d (4) { - [%u|b%"a"]=> - NULL - [%u|b%"b"]=> - NULL - [%u|b%"ID"]=> - %unicode|string%(1) "3" - [%u|b%"label"]=> - %unicode|string%(1) "c" -} - -Warning: Missing argument 2 for mysql_fetch_object_construct::__construct() in %s on line %d - -Notice: Undefined variable: b in %s on line %d -object(mysql_fetch_object_construct)#%d (4) { - [%u|b%"a"]=> - %unicode|string%(1) "a" - [%u|b%"b"]=> - NULL - [%u|b%"ID"]=> - %unicode|string%(1) "4" - [%u|b%"label"]=> - %unicode|string%(1) "d" -} -object(mysql_fetch_object_construct)#%d (4) { - [%u|b%"a"]=> - %unicode|string%(1) "a" - [%u|b%"b"]=> - %unicode|string%(1) "b" - [%u|b%"ID"]=> - %unicode|string%(1) "5" - [%u|b%"label"]=> - %unicode|string%(1) "e" -} -bool(false) -bool(false) -bool(false) -bool(false) -bool(false) - -Warning: mysql_fetch_object(): supplied resource is not a valid MySQL result resource in %s on line %d -bool(false) - -Fatal error: Class 'this_class_does_not_exist' not found in %s on line %d diff --git a/ext/mysql/tests/mysql_fetch_row.phpt b/ext/mysql/tests/mysql_fetch_row.phpt deleted file mode 100644 index d26f7a4d82..0000000000 --- a/ext/mysql/tests/mysql_fetch_row.phpt +++ /dev/null @@ -1,57 +0,0 @@ ---TEST-- -mysql_fetch_row() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -[004] -array(2) { - [0]=> - %unicode|string%(1) "1" - [1]=> - %unicode|string%(1) "a" -} -[005] -bool(false) - -Warning: mysql_fetch_row(): supplied resource is not a valid MySQL result resource in %s on line %d -bool(false) -done! diff --git a/ext/mysql/tests/mysql_field_flags.phpt b/ext/mysql/tests/mysql_field_flags.phpt deleted file mode 100644 index bf2a193f57..0000000000 --- a/ext/mysql/tests/mysql_field_flags.phpt +++ /dev/null @@ -1,159 +0,0 @@ ---TEST-- -mysql_field_flags() ---SKIPIF-- - ---FILE-- -') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($tmp)) { - printf("[007] Check the unicode support!\n"); - var_inspect($tmp); -} - -if (false !== ($tmp = mysql_field_flags($res, 2))) - printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - -mysql_free_result($res); - -$version = mysql_get_server_info($link); -if (!preg_match('@(\d+)\.(\d+)\.(\d+)@ism', $version, $matches)) - printf("[009] Cannot get server version\n"); -$version = ($matches[1] * 1000) + ($matches[2] * 100) + $matches[3]; - -$tables = array( - 'label INT, UNIQUE KEY (label)' => array( - array('label', '1'), - 'label' => array(($version < 5000) ? 'multiple_key' : 'unique_key') - ), - 'labela INT, label2 CHAR(1), KEY keyname (labela, label2)' => array( - array('labela, label2', "1, 'a'"), - 'labela' => array('multiple_key'), - ), - 'label1 BLOB' => array( - array('label1', "'blob'"), - 'label1' => array('blob', 'binary'), - ), - 'label1 INT UNSIGNED' => array( - array('label1', '100'), - 'label1' => array('unsigned'), - ), - 'label1 INT UNSIGNED NOT NULL AUTO INCREMENT' => array( - array('label1', '100'), - 'label1' => array('auto_increment', - 'unsigned'), - ), - 'label1 ENUM("a", "b")' => array( - array('label1', "'a'"), - 'label1' => array('enum'), - ), - 'label1 SET("a", "b")' => array( - array('label1', "'a'"), - 'label1' => array('set'), - ), - 'label1 TIMESTAMP' => array( - array('label1', sprintf("'%s'", @date("Y-m-d H:i:s"))), - 'label1' => array( - 'timestamp', - 'binary', - 'not_null'), - ), -); - -if ($version < 5600) { - $tables['label1 TIMESTAMP']['label1'][] = 'zerofill'; - $tables['label1 TIMESTAMP']['label1'][] = 'unsigned'; -} - - -foreach ($tables as $columns => $expected) { - if (!mysql_query("DROP TABLE IF EXISTS test", $link)) { - printf("[010/%s] [%d] %s\n", $columns, mysql_errno($link), mysql_error($link)); - continue; - } - $sql = sprintf("CREATE TABLE test(id INT, %s) ENGINE = %s", $columns, $engine); - if (!@mysql_query($sql, $link)) { - // server or engine might not support this - continue; - } - - reset($expected); - list($k, $values) = each($expected); - $sql = sprintf("INSERT INTO test(id, %s) VALUES (1, %s)", $values[0], $values[1]); - if (!mysql_query($sql, $link)) { - printf("[011/%s] '%s', [%d] %s\n", $columns, $sql, mysql_errno($link), mysql_error($link)); - continue; - } - - if (!$res = mysql_query(sprintf("SELECT id, %s FROM test", $values[0]), $link)) { - printf("[012/%s] [%d] %s\n", $columns, mysql_errno($link), mysql_error($link)); - continue; - } - - $i = 1; - while (list($field, $flags) = each($expected)) { - $tmp = mysql_field_flags($res, $i++); - - foreach ($flags as $k => $flag) { - if (!preg_match(sprintf('@\s*%s\s*@ismU', $flag), $tmp)) { - printf("[013/%s] Field '%s', flag '%s' not found, [%d] %s\n", $columns, $field, $flag, mysql_errno($link), mysql_error($link)); - } - } - foreach ($flags as $k => $flag) { - $tmp = preg_replace(sprintf('@\s*%s\s*@ismU', $flag), '', $tmp); - } - if ('' != $tmp) - printf("[014/%s] Field '%s', unexpected flags '%s' found, [%d] %s\n", $columns, $field, $tmp, mysql_errno($link), mysql_error($link)); - } - mysql_free_result($res); -} - -var_dump(mysql_field_flags($res, 0)); - -mysql_close($link); -print "done!"; -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_field_flags() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: mysql_field_flags(): Field -1 is invalid for MySQL result index %d in %s on line %d - -Warning: mysql_field_flags(): Field 2 is invalid for MySQL result index %d in %s on line %d - -Warning: mysql_field_flags(): supplied resource is not a valid MySQL result resource in %s on line %d -bool(false) -done! diff --git a/ext/mysql/tests/mysql_field_len.phpt b/ext/mysql/tests/mysql_field_len.phpt deleted file mode 100644 index a7b4cabee3..0000000000 --- a/ext/mysql/tests/mysql_field_len.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -mysql_field_len() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_field_len() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: mysql_field_len(): Field -1 is invalid for MySQL result index %d in %s on line %d - -Warning: mysql_field_len(): Field 2 is invalid for MySQL result index %d in %s on line %d - -Warning: mysql_field_len(): supplied resource is not a valid MySQL result resource in %s on line %d -bool(false) -done! diff --git a/ext/mysql/tests/mysql_field_name.phpt b/ext/mysql/tests/mysql_field_name.phpt deleted file mode 100644 index 1ef613babe..0000000000 --- a/ext/mysql/tests/mysql_field_name.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -mysql_field_name() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_field_name() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: mysql_field_name(): Field -1 is invalid for MySQL result index %d in %s on line %d -%unicode|string%(2) "id" - -Warning: mysql_field_name(): Field 2 is invalid for MySQL result index %d in %s on line %d - -Warning: mysql_field_name(): supplied resource is not a valid MySQL result resource in %s on line %d -bool(false) -done! diff --git a/ext/mysql/tests/mysql_field_seek.phpt b/ext/mysql/tests/mysql_field_seek.phpt deleted file mode 100644 index a9eab70bca..0000000000 --- a/ext/mysql/tests/mysql_field_seek.phpt +++ /dev/null @@ -1,144 +0,0 @@ ---TEST-- -mysql_field_seek() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_field_seek(): Field -1 is invalid for MySQL result index %d in %s on line %d -bool(false) -object(stdClass)#%d (13) { - [%u|b%"name"]=> - %unicode|string%(2) "id" - [%u|b%"table"]=> - %unicode|string%(4) "test" - [%u|b%"def"]=> - %unicode|string%(0) "" - [%u|b%"max_length"]=> - int(1) - [%u|b%"not_null"]=> - int(1) - [%u|b%"primary_key"]=> - int(1) - [%u|b%"multiple_key"]=> - int(0) - [%u|b%"unique_key"]=> - int(0) - [%u|b%"numeric"]=> - int(1) - [%u|b%"blob"]=> - int(0) - [%u|b%"type"]=> - %unicode|string%(3) "int" - [%u|b%"unsigned"]=> - int(0) - [%u|b%"zerofill"]=> - int(0) -} -bool(true) -object(stdClass)#%d (13) { - [%u|b%"name"]=> - %unicode|string%(2) "id" - [%u|b%"table"]=> - %unicode|string%(4) "test" - [%u|b%"def"]=> - %unicode|string%(0) "" - [%u|b%"max_length"]=> - int(1) - [%u|b%"not_null"]=> - int(1) - [%u|b%"primary_key"]=> - int(1) - [%u|b%"multiple_key"]=> - int(0) - [%u|b%"unique_key"]=> - int(0) - [%u|b%"numeric"]=> - int(1) - [%u|b%"blob"]=> - int(0) - [%u|b%"type"]=> - %unicode|string%(3) "int" - [%u|b%"unsigned"]=> - int(0) - [%u|b%"zerofill"]=> - int(0) -} -bool(true) -object(stdClass)#%d (13) { - [%u|b%"name"]=> - %unicode|string%(5) "label" - [%u|b%"table"]=> - %unicode|string%(4) "test" - [%u|b%"def"]=> - %unicode|string%(0) "" - [%u|b%"max_length"]=> - int(1) - [%u|b%"not_null"]=> - int(0) - [%u|b%"primary_key"]=> - int(0) - [%u|b%"multiple_key"]=> - int(0) - [%u|b%"unique_key"]=> - int(0) - [%u|b%"numeric"]=> - int(0) - [%u|b%"blob"]=> - int(0) - [%u|b%"type"]=> - %unicode|string%(6) "string" - [%u|b%"unsigned"]=> - int(0) - [%u|b%"zerofill"]=> - int(0) -} - -Warning: mysql_field_seek(): Field %d is invalid for MySQL result index %d in %s on line %d -bool(false) -bool(false) - -Warning: mysql_field_seek(): supplied resource is not a valid MySQL result resource in %s on line %d -bool(false) -done! diff --git a/ext/mysql/tests/mysql_field_table.phpt b/ext/mysql/tests/mysql_field_table.phpt deleted file mode 100644 index d95be96ee5..0000000000 --- a/ext/mysql/tests/mysql_field_table.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -mysql_field_table() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_field_table() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: mysql_field_table(): Field -1 is invalid for MySQL result index %d in %s on line %d -%unicode|string%(4) "test" - -Warning: mysql_field_table(): Field 2 is invalid for MySQL result index %d in %s on line %d - -Warning: mysql_field_table(): supplied resource is not a valid MySQL result resource in %s on line %d -bool(false) -done! diff --git a/ext/mysql/tests/mysql_field_type.phpt b/ext/mysql/tests/mysql_field_type.phpt deleted file mode 100644 index e4b774a691..0000000000 --- a/ext/mysql/tests/mysql_field_type.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -mysql_field_type() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_field_type() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: mysql_field_type(): Field -1 is invalid for MySQL result index %d in %s on line %d -%unicode|string%(3) "int" - -Warning: mysql_field_type(): Field 2 is invalid for MySQL result index %d in %s on line %d - -Warning: mysql_field_type(): supplied resource is not a valid MySQL result resource in %s on line %d -bool(false) -done! diff --git a/ext/mysql/tests/mysql_free_result.phpt b/ext/mysql/tests/mysql_free_result.phpt deleted file mode 100644 index 582297c80f..0000000000 --- a/ext/mysql/tests/mysql_free_result.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -mysql_free_result() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -bool(true) - -Warning: mysql_free_result(): supplied resource is not a valid MySQL result resource in %s on line %d -bool(false) -done! diff --git a/ext/mysql/tests/mysql_get_client_info.phpt b/ext/mysql/tests/mysql_get_client_info.phpt deleted file mode 100644 index 6e84628476..0000000000 --- a/ext/mysql/tests/mysql_get_client_info.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -mysql_get_client_info() ---SKIPIF-- - ---FILE-- -') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($info)) { - printf("[002] Expecting Unicode!\n"); - var_inspect($info); -} - -if (!is_null($tmp = @mysql_get_client_info("too many arguments"))) { - printf("[003] Expecting NULL/NULL got %s/%s\n", $tmp, gettype($tmp)); -} - -print "done!"; -?> ---EXPECTF-- -done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_get_host_info.phpt b/ext/mysql/tests/mysql_get_host_info.phpt deleted file mode 100644 index a98ab5be35..0000000000 --- a/ext/mysql/tests/mysql_get_host_info.phpt +++ /dev/null @@ -1,47 +0,0 @@ ---TEST-- -mysql_get_host_info() ---SKIPIF-- - ---FILE-- -') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($info)) { - printf("[005] Expecting Unicode error message!\n"); - var_inspect($info); -} - -if (!is_null($tmp = @mysql_get_host_info($link, "too many arguments"))) { - printf("[006] Expecting NULL/NULL got %s/%s\n", $tmp, gettype($tmp)); -} - -print "done!"; -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_get_proto_info.phpt b/ext/mysql/tests/mysql_get_proto_info.phpt deleted file mode 100644 index 3e1481121e..0000000000 --- a/ext/mysql/tests/mysql_get_proto_info.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -mysql_get_proto_info() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_get_server_info.phpt b/ext/mysql/tests/mysql_get_server_info.phpt deleted file mode 100644 index e29222b966..0000000000 --- a/ext/mysql/tests/mysql_get_server_info.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -mysql_get_server_info() ---SKIPIF-- - ---FILE-- -') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($info)) { - printf("[005] Expecting Unicode error message!\n"); - var_inspect($info); -} - -if (NULL !== ($tmp = @mysql_get_server_info('too many', 'just too many'))) - printf("[006] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); - -print "done!"; -?> ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_info.phpt b/ext/mysql/tests/mysql_info.phpt deleted file mode 100644 index 82c680768b..0000000000 --- a/ext/mysql/tests/mysql_info.phpt +++ /dev/null @@ -1,76 +0,0 @@ ---TEST-- -mysql_info() ---SKIPIF-- - ---FILE-- -= 100", $link)) - printf("[011] [%d] %s\n", mysql_errno($link), mysql_error($link)); - -if (!is_string($tmp = mysql_info($link)) || ('' == $tmp)) - printf("[012] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); - -if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($tmp)) { - printf("[013] Expecting Unicode!\n"); - var_inspect($info); -} - -if (!is_string($def_tmp = mysql_info()) || ('' == $def_tmp)) - printf("[014] Expecting string/any_non_empty, got %s/%s\n", gettype($def_tmp), $def_tmp); - -if ($def_tmp !== $tmp) { - printf("[015] Results differ for default link and specified link, [%d] %s\n", - mysql_errno(), mysql_error()); - var_inspect($tmp); - var_inspect($def_tmp); -} - -// NOTE: no LOAD DATA INFILE test - -print "done!"; -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_insert_id.phpt b/ext/mysql/tests/mysql_insert_id.phpt deleted file mode 100644 index 93319dad23..0000000000 --- a/ext/mysql/tests/mysql_insert_id.phpt +++ /dev/null @@ -1,73 +0,0 @@ ---TEST-- -mysql_insert_id() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_insert_id(): supplied resource is not a valid MySQL-Link resource in %s on line %d -bool(false) -done! diff --git a/ext/mysql/tests/mysql_list_dbs.phpt b/ext/mysql/tests/mysql_list_dbs.phpt deleted file mode 100644 index 559b5a05d9..0000000000 --- a/ext/mysql/tests/mysql_list_dbs.phpt +++ /dev/null @@ -1,57 +0,0 @@ ---TEST-- -mysql_list_dbs() ---SKIPIF-- - ---FILE-- -') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($row[0])) { - printf("[005] Check for unicode support\n"); - var_inspect($row); -} - -mysql_free_result($res); - -if (!$res2 = @mysql_list_dbs()) - printf("[006] [%d] %s\n", mysql_errno(), mysql_error()); - -$row2 = mysql_fetch_array($res2, MYSQL_NUM); -mysql_free_result($res2); - -assert($row === $row2); - -mysql_close($link); - -print "done!\n"; -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_list_fields.phpt b/ext/mysql/tests/mysql_list_fields.phpt deleted file mode 100644 index 6b6ae9b319..0000000000 --- a/ext/mysql/tests/mysql_list_fields.phpt +++ /dev/null @@ -1,80 +0,0 @@ ---TEST-- -mysql_list_fields() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -[006] [%d] %s -bool(false) -Field Offset 0 -mysql_field_flags()%s -mysql_field_len(): 11 -mysql_field_name(): id -mysql_field_type(): int -Field Offset 1 -mysql_field_flags()%s -mysql_field_len(): %s -mysql_field_name(): label -mysql_field_type(): string -done! diff --git a/ext/mysql/tests/mysql_list_processes.phpt b/ext/mysql/tests/mysql_list_processes.phpt deleted file mode 100644 index 402a10d995..0000000000 --- a/ext/mysql/tests/mysql_list_processes.phpt +++ /dev/null @@ -1,57 +0,0 @@ ---TEST-- -mysql_list_processes() ---SKIPIF-- - ---FILE-- -') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($row[0])) { - printf("[004] Check for unicode support\n"); - var_inspect($row); -} - -mysql_free_result($res); - -if (!$res = mysql_list_processes()) - printf("[005] [%d] %s\n", mysql_errno(), mysql_error()); - -if (!$num = mysql_num_rows($res)) - printf("[006] Empty process list? [%d] %s\n", mysql_errno(), mysql_error()); - -$row = mysql_fetch_array($res, MYSQL_NUM); -if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($row[0])) { - printf("[007] Check for unicode support\n"); - var_inspect($row); -} - -mysql_free_result($res); -mysql_close($link); - -print "done!\n"; -?> ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_list_tables.phpt b/ext/mysql/tests/mysql_list_tables.phpt deleted file mode 100644 index 3b753ae37a..0000000000 --- a/ext/mysql/tests/mysql_list_tables.phpt +++ /dev/null @@ -1,86 +0,0 @@ ---TEST-- -mysql_list_tables() ---SKIPIF-- - ---FILE-- - $tlist) - foreach ($tlist as $k => $table) - $list1[] = $table; - -foreach ($tables_query as $k => $tlist) - foreach ($tlist as $k => $table) - $list2[] = $table; - -if ($list1 !== $list2) { - printf("[009] Got different results for mysql_list_tables() and SHOW TABLES\n"); - var_dump($list1); - var_dump($list2); -} - -if (!in_array('test', $list1)) - printf("[010] Table lists seem to be wrong. Check manually.\n"); - -mysql_close($link); - -print "done!\n"; -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_max_links.phpt b/ext/mysql/tests/mysql_max_links.phpt deleted file mode 100644 index 32096c426e..0000000000 --- a/ext/mysql/tests/mysql_max_links.phpt +++ /dev/null @@ -1,80 +0,0 @@ ---TEST-- -mysql_[p]connect() - max_links/max_persistent ---SKIPIF-- - ---INI-- -mysql.max_links=2 ---FILE-- - second open connection -$links[0] = my_connect(50, $host, $user, $passwd, $db, $port, $socket); -$links[2] = my_connect(60, $host, $user, $passwd, $db, $port, $socket); -ksort($links); -var_dump($links); - -mysql_close($links[0]); -mysql_close($links[1]); -print "done!\n"; -?> ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_connect(): Too many open links (2) in %s on line %s -[030] Cannot connect using host '%s', user '%s', password '****', [0] 0 - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_connect(): Too many open links (2) in %s on line %s -[060] Cannot connect using host '%s', user '%s', password '****', [0] 0 -array(3) { - [0]=> - resource(%d) of type (mysql link) - [1]=> - resource(%d) of type (mysql link) - [2]=> - bool(false) -} -done! diff --git a/ext/mysql/tests/mysql_max_persistent.phpt b/ext/mysql/tests/mysql_max_persistent.phpt deleted file mode 100644 index 36f2266665..0000000000 --- a/ext/mysql/tests/mysql_max_persistent.phpt +++ /dev/null @@ -1,105 +0,0 @@ ---TEST-- -mysql_[p]connect() - max_links/max_persistent ---SKIPIF-- - ---INI-- -mysql.max_links=2 -mysql.allow_persistent=1 -mysql.max_persistent=1 ---FILE-- - only open connection -$links[0] = my_connect(40, $host, $user, $passwd, $db, $port, $socket); -var_dump($links); - -mysql_query('REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest', $links[0]); -mysql_query('DROP USER pcontest', $links[0]); - -mysql_close($links[0]); -print "done!\n"; -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_pconnect(): Too many open persistent links (1) in %s on line %d -[020] Cannot connect using host '%s', user '%s', password '****', [0] 0 - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -array(1) { - [0]=> - resource(%d) of type (mysql link persistent) -} -done! diff --git a/ext/mysql/tests/mysql_mysqlnd_read_timeout_long.phpt b/ext/mysql/tests/mysql_mysqlnd_read_timeout_long.phpt deleted file mode 100644 index 2c67e64878..0000000000 --- a/ext/mysql/tests/mysql_mysqlnd_read_timeout_long.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -mysqlnd.net_read_timeout > default_socket_timeout ---SKIPIF-- - ---INI-- -default_socket_timeout=1 -mysqlnd.net_read_timeout=12 -max_execution_time=12 ---FILE-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -array(1) { - [%u|b%"SLEEP(6)"]=> - %unicode|string%(1) "0" -} -done! diff --git a/ext/mysql/tests/mysql_num_fields.phpt b/ext/mysql/tests/mysql_num_fields.phpt deleted file mode 100644 index f65f8ec165..0000000000 --- a/ext/mysql/tests/mysql_num_fields.phpt +++ /dev/null @@ -1,58 +0,0 @@ ---TEST-- -mysql_num_fields() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_num_fields(): supplied resource is not a valid MySQL result resource in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_num_rows.phpt b/ext/mysql/tests/mysql_num_rows.phpt deleted file mode 100644 index 2b69e939be..0000000000 --- a/ext/mysql/tests/mysql_num_rows.phpt +++ /dev/null @@ -1,89 +0,0 @@ ---TEST-- -mysql_num_rows() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in %s on line %d - -Warning: mysql_free_result() expects parameter 1 to be resource, boolean given in %s on line %d - -Warning: mysql_num_rows(): supplied resource is not a valid MySQL result resource in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_pconn_disable.phpt b/ext/mysql/tests/mysql_pconn_disable.phpt deleted file mode 100644 index 6997e5970f..0000000000 --- a/ext/mysql/tests/mysql_pconn_disable.phpt +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -mysql_pconnect() - disabling feature ---SKIPIF-- - ---INI-- -mysql.allow_persistent=0 -mysql.max_persistent=1 -mysql.max_links=2 ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -[001] Can connect to the server. -[002] Can fetch data using persistent connection! Data = '1' - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_pconn_kill.phpt b/ext/mysql/tests/mysql_pconn_kill.phpt deleted file mode 100644 index eb1feb7b85..0000000000 --- a/ext/mysql/tests/mysql_pconn_kill.phpt +++ /dev/null @@ -1,117 +0,0 @@ ---TEST-- -mysql_pconnect() - killing persitent connection ---SKIPIF-- - ---INI-- -mysql.allow_persistent=1 -mysql.max_persistent=2 ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -bool(true) - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_pconn_max_links.phpt b/ext/mysql/tests/mysql_pconn_max_links.phpt deleted file mode 100644 index ced94b3dbf..0000000000 --- a/ext/mysql/tests/mysql_pconn_max_links.phpt +++ /dev/null @@ -1,211 +0,0 @@ ---TEST-- -Persistent connections and mysql.max_persistent ---SKIPIF-- - ---INI-- -mysql.max_links=3 -mysql.max_persistent=2 -mysql.allow_persistent=1 ---FILE-- - enabled'), 500); - if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches)) - printf("[003] Cannot get # active persistent links from phpinfo()"); - $num_plinks = $matches[1]; - - if (!$res = mysql_query('SELECT id, label FROM test WHERE id = 1', $plink)) - printf("[004] Cannot run query on persistent connection of second DB user, [%d] %s\n", - mysql_errno($plink), mysql_error($plink)); - - if (!$row = mysql_fetch_assoc($res)) - printf("[005] Cannot run fetch result, [%d] %s\n", - mysql_errno($plink), mysql_error($plink)); - mysql_free_result($res); - var_dump($row); - - // change the password for the second DB user and kill the persistent connection - if (!$res = mysql_query("SELECT CURRENT_USER() AS _user", $link)) - printf("[006] [%d] %s", mysql_errno($link), mysql_error($link)); - - $row = mysql_fetch_assoc($res); - mysql_free_result($res); - $host = substr($row['_user'], strrpos($row['_user'], "@") + 1, strlen($row['_user'])); - - $sql = sprintf('SET PASSWORD FOR pcontest@"%s" = PASSWORD("newpass")', mysql_real_escape_string($host, $link)); - if (!mysql_query($sql, $link)) - printf("[007] Cannot change PW of second DB user, [%d] %s\n", mysql_errno($link), mysql_error($link)); - - // persistent connections cannot be closed but only be killed - $pthread_id = mysql_thread_id($plink); - if (!mysql_query(sprintf('KILL %d', $pthread_id), $link)) - printf("[008] Cannot KILL persistent connection of second DB user, [%d] %s\n", mysql_errno($link), mysql_error($link)); - // give the server a second to really kill the thread - sleep(1); - - if (!$res = mysql_query("SHOW FULL PROCESSLIST", $link)) - printf("[009] [%d] %s\n", mysql_errno($link), mysql_error($link)); - - $running_threads = array(); - while ($row = mysql_fetch_assoc($res)) - $running_threads[$row['Id']] = $row; - mysql_free_result($res); - - if (isset($running_threads[$pthread_id])) - printf("[010] Persistent connection has not been killed\n"); - - // we might get the old handle - if ($plink = @mysql_pconnect($host, 'pcontest', 'pcontest')) - printf("[011] Can connect using the old password, [%d] %s\n", - mysql_errno(), mysql_error()); - - ob_start(); - phpinfo(); - $phpinfo = strip_tags(ob_get_contents()); - ob_end_clean(); - $phpinfo = substr($phpinfo, strpos($phpinfo, 'MySQL Support => enabled'), 500); - if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches)) - printf("[012] Cannot get # active persistent links from phpinfo()\n"); - - $num_plinks_kill = $matches[1]; - if ($num_plinks_kill > $num_plinks) - printf("[013] Statistics seems to be wrong, got %d active persistent links, expecting < %d links\n", - $num_plinks_kill, $num_plinks); - - // The first connection has been closed, the last pconnect() was unable to connect -> no connection open - // We must be able to connect because max_persistent limit has not been reached - if (!$plink = mysql_pconnect($host, 'pcontest', 'newpass')) - die(sprintf("[014] Cannot connect using the second DB, [%d] %s\n", - mysql_errno(), mysql_error())); - - if (!mysql_select_db($db, $plink)) - printf("[015] [%d] %s\n", mysql_errno($plink), mysql_error($plink)); - - if (!$res = mysql_query('SELECT id, label FROM test WHERE id = 1', $plink)) - printf("[016] Cannot run query on persistent connection of second DB user, [%d] %s\n", - mysql_errno($plink), mysql_error($plink)); - - if (!$row = mysql_fetch_assoc($res)) - printf("[017] Cannot run fetch result, [%d] %s\n", - mysql_errno($plink), mysql_error($plink)); - mysql_free_result($res); - var_dump($row); - - mysql_query(sprintf('REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest@"%s"', mysql_real_escape_string($host, $link)), $link); - mysql_query(sprintf('DROP USER pcontest@"%s"', mysql_real_escape_string($host, $link)), $link); - mysql_close($link); - print "done!"; -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -array(2) { - [%u|b%"id"]=> - %unicode|string%(1) "1" - [%u|b%"label"]=> - %unicode|string%(1) "a" -} - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -array(2) { - [%u|b%"id"]=> - %unicode|string%(1) "1" - [%u|b%"label"]=> - %unicode|string%(1) "a" -} -done! diff --git a/ext/mysql/tests/mysql_pconn_reuse.phpt b/ext/mysql/tests/mysql_pconn_reuse.phpt deleted file mode 100644 index 26b4ca5f49..0000000000 --- a/ext/mysql/tests/mysql_pconn_reuse.phpt +++ /dev/null @@ -1,75 +0,0 @@ ---TEST-- -mysql_pconnect() - disabling feature ---SKIPIF-- - ---INI-- -mysql.allow_persistent=1 -mysql.max_persistent=1 -mysql.max_links=2 ---FILE-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -[001] Can connect to the server. -[002] Can fetch data using persistent connection! Data = '1' - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_connect(): Too many open links (2) in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_pconnect.phpt b/ext/mysql/tests/mysql_pconnect.phpt deleted file mode 100644 index ec28d2ea8a..0000000000 --- a/ext/mysql/tests/mysql_pconnect.phpt +++ /dev/null @@ -1,97 +0,0 @@ ---TEST-- -mysql_pconnect() ---SKIPIF-- - ---INI-- -mysql.max_persistent=10 -mysql.allow_persistent=1 ---FILE-- - ---EXPECTF-- -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_pconnect(): Access denied for user '%s'@'%s' (using password: YES) in %s on line %d - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_phpinfo.phpt b/ext/mysql/tests/mysql_phpinfo.phpt deleted file mode 100644 index 79de939167..0000000000 --- a/ext/mysql/tests/mysql_phpinfo.phpt +++ /dev/null @@ -1,75 +0,0 @@ ---TEST-- -phpinfo() mysql section ---SKIPIF-- - ---FILE-- - $entry) - if (!stristr($phpinfo, $entry)) - printf("[012] Could not find entry for '%s'\n", $entry); -} - -print "done!"; -?> ---EXPECTF-- -done! diff --git a/ext/mysql/tests/mysql_ping.phpt b/ext/mysql/tests/mysql_ping.phpt deleted file mode 100644 index 2f2c38cd90..0000000000 --- a/ext/mysql/tests/mysql_ping.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -mysql_ping() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -bool(true) -bool(true) -bool(true) - -Warning: mysql_ping(): supplied resource is not a valid MySQL-Link resource in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_query.phpt b/ext/mysql/tests/mysql_query.phpt deleted file mode 100644 index abe7adb88c..0000000000 --- a/ext/mysql/tests/mysql_query.phpt +++ /dev/null @@ -1,132 +0,0 @@ ---TEST-- -mysql_query() ---SKIPIF-- - ---FILE-- -') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($tmp['p_version'])) { - printf("[010] Expecting unicode string, dumping\n"); - var_dump($tmp); - } - mysql_free_result($res); - } else { - printf("[011] [%d] %s\n", mysql_errno($link), mysql_error($link)); - } - - mysql_query('DROP FUNCTION IF EXISTS f', $link); - if (mysql_query('CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN ver_param;', $link)) { - $res = mysql_query('SELECT f(VERSION()) AS f_version', $link); - $tmp = mysql_fetch_assoc($res); - if (!isset($tmp['f_version']) || ('' == $tmp['f_version'])) { - printf("[012] Result seems wrong, dumping\n"); - var_dump($tmp); - } - if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($tmp['f_version'])) { - printf("[013] Expecting unicode string, dumping\n"); - var_dump($tmp); - } - mysql_free_result($res); - } else { - printf("[014] [%d] %s\n", mysql_errno($link), mysql_error($link)); - } -} - -mysql_close($link); - -if (false !== ($tmp = mysql_query("SELECT id FROM test", $link))) - printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - -print "done!"; -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -array(1) { - [%u|b%"valid"]=> - %unicode|string%(30) "this is sql but with semicolon" -} -array(1) { - [%u|b%""]=> - %unicode|string%(1) "a" -} -%unicode|string%(1) "a" - -Warning: mysql_query(): supplied resource is not a valid MySQL-Link resource in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt b/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt deleted file mode 100644 index c2cb41e026..0000000000 --- a/ext/mysql/tests/mysql_query_load_data_openbasedir.phpt +++ /dev/null @@ -1,121 +0,0 @@ ---TEST-- -LOAD DATA INFILE - open_basedir ---SKIPIF-- - ---FILE-- -') >= 0) { - if (!fwrite($fp, (binary)"'97';'x';\n") || - !fwrite($fp, (binary)"'98';'y';\n") || - !fwrite($fp, (binary)"99;'z';\n")) { - printf("[004] Cannot write CVS file '%s'\n", $file); - } -} else { - if (!fwrite($fp, "97;'x';\n") || - !fwrite($fp, "98;'y';\n") || - !fwrite($fp, "99;'z';\n")) { - printf("[005] Cannot write CVS file '%s'\n", $file); - } -} -fclose($fp); - -$sql = sprintf("LOAD DATA LOCAL INFILE '%s' - INTO TABLE test - FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' - LINES TERMINATED BY '\n'", - mysql_real_escape_string(realpath('./simple.csv'), $link)); - -if (!mysql_query($sql, $link)) - printf("[006] [%d] %s\n", mysql_errno($link), mysql_error($link)); - -if (!($res = mysql_query('SELECT label FROM test WHERE id = 97', $link)) || - !($row = mysql_fetch_assoc($res)) || - !mysql_free_result($res)) - printf("[007] [%d] '%s'\n", mysql_errno($link), mysql_error($link)); - -if ($row['label'] != "x") - printf("[008] LOAD DATA not run?\n"); - -if (!mysql_query('DELETE FROM test', $link)) - printf("[009] [%d] %s\n", mysql_errno($link), mysql_error($link)); - -$sql = "LOAD DATA LOCAL INFILE '/tmp/idonotexist' - INTO TABLE test - FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' - LINES TERMINATED BY '\n'"; - -if (!mysql_query($sql, $link)) - printf("[010] [%d] %s\n", mysql_errno($link), mysql_error($link)); - -mysql_close($link); -unlink("./simple.csv"); - -print "done!"; -?> ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -[006] [1148] %s -[007] [0] '' -[008] LOAD DATA not run? -[010] [1148] %s -done! diff --git a/ext/mysql/tests/mysql_real_escape_string.phpt b/ext/mysql/tests/mysql_real_escape_string.phpt deleted file mode 100644 index 4fdedf7b37..0000000000 --- a/ext/mysql/tests/mysql_real_escape_string.phpt +++ /dev/null @@ -1,44 +0,0 @@ ---TEST-- -mysql_real_escape_string() ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -%unicode|string%(31) "Am I a unicode string in PHP 6?" -%unicode|string%(2) "\\" -%unicode|string%(2) "\"" -%unicode|string%(2) "\'" -%unicode|string%(2) "\n" -%unicode|string%(2) "\r" -%unicode|string%(8) "foo\0bar" -done! diff --git a/ext/mysql/tests/mysql_reflection_extension.phpt b/ext/mysql/tests/mysql_reflection_extension.phpt deleted file mode 100644 index 169036cd54..0000000000 --- a/ext/mysql/tests/mysql_reflection_extension.phpt +++ /dev/null @@ -1,105 +0,0 @@ ---TEST-- -ReflectionExtension basics to check API ---SKIPIF-- - ---FILE-- -name); - printf("Version: %s\n", $r->getVersion()); - $classes = $r->getClasses(); - if (!empty($classes)) { - printf("[002] Expecting no class\n"); - asort($classes); - var_dump($classes); - } - - $ignore = array(); - - $functions = $r->getFunctions(); - asort($functions); - printf("Functions:\n"); - foreach ($functions as $func) { - if (isset($ignore[$func->name])) { - unset($ignore[$func->name]); - } else { - printf(" %s\n", $func->name); - } - } - if (!empty($ignore)) { - printf("Dumping version dependent and missing functions\n"); - var_dump($ignore); - } - - - print "done!"; -?> ---EXPECTF-- -Name: mysql -Version: 1.0 -Functions: - mysql - mysql_affected_rows - mysql_client_encoding - mysql_close - mysql_connect - mysql_data_seek - mysql_db_name - mysql_db_query - mysql_dbname - mysql_errno - mysql_error - mysql_escape_string - mysql_fetch_array - mysql_fetch_assoc - mysql_fetch_field - mysql_fetch_lengths - mysql_fetch_object - mysql_fetch_row - mysql_field_flags - mysql_field_len - mysql_field_name - mysql_field_seek - mysql_field_table - mysql_field_type - mysql_fieldflags - mysql_fieldlen - mysql_fieldname - mysql_fieldtable - mysql_fieldtype - mysql_free_result - mysql_freeresult - mysql_get_client_info - mysql_get_host_info - mysql_get_proto_info - mysql_get_server_info - mysql_info - mysql_insert_id - mysql_list_dbs - mysql_list_fields - mysql_list_processes - mysql_list_tables - mysql_listdbs - mysql_listfields - mysql_listtables - mysql_num_fields - mysql_num_rows - mysql_numfields - mysql_numrows - mysql_pconnect - mysql_ping - mysql_query - mysql_real_escape_string - mysql_result - mysql_select_db - mysql_selectdb - mysql_set_charset - mysql_stat - mysql_table_name - mysql_tablename - mysql_thread_id - mysql_unbuffered_query -done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_reflection_functions.phpt b/ext/mysql/tests/mysql_reflection_functions.phpt deleted file mode 100644 index 4f2710d806..0000000000 --- a/ext/mysql/tests/mysql_reflection_functions.phpt +++ /dev/null @@ -1,387 +0,0 @@ ---TEST-- -ReflectionFunction to check API ---SKIPIF-- - ---FILE-- -getFunctions(); - asort($functions); - printf("Functions:\n"); - foreach ($functions as $func) { - if (isset($ignore[$func->name])) - continue; - - printf(" %s\n", $func->name); - $rf = new ReflectionFunction($func->name); - printf(" Deprecated: %s\n", $rf->isDeprecated() ? "yes" : "no"); - printf(" Accepted parameters: %d\n", $rf->getNumberOfParameters()); - printf(" Required parameters: %d\n", $rf->getNumberOfRequiredParameters()); - foreach( $rf->getParameters() as $param ) { - printf(" %s\n", $param); - } - } - - print "done!"; -?> ---EXPECTF-- -Functions: - mysql - Deprecated: yes - Accepted parameters: 3 - Required parameters: 2 - Parameter #0 [ $database_name ] - Parameter #1 [ $query ] - Parameter #2 [ $link_identifier ] - mysql_affected_rows - Deprecated: no - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_client_encoding - Deprecated: no - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_close - Deprecated: no - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_connect - Deprecated: no - Accepted parameters: 5 - Required parameters: 0 - Parameter #0 [ $hostname ] - Parameter #1 [ $username ] - Parameter #2 [ $password ] - Parameter #3 [ $new ] - Parameter #4 [ $flags ] - mysql_data_seek - Deprecated: no - Accepted parameters: 2 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $row_number ] - mysql_db_name - Deprecated: no - Accepted parameters: 3 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $row ] - Parameter #2 [ $field ] - mysql_db_query - Deprecated: yes - Accepted parameters: 3 - Required parameters: 2 - Parameter #0 [ $database_name ] - Parameter #1 [ $query ] - Parameter #2 [ $link_identifier ] - mysql_dbname - Deprecated: yes - Accepted parameters: 3 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $row ] - Parameter #2 [ $field ] - mysql_errno - Deprecated: no - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_error - Deprecated: no - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_escape_string - Deprecated: no - Accepted parameters: 1 - Required parameters: 1 - Parameter #0 [ $string ] - mysql_fetch_array - Deprecated: no - Accepted parameters: 2 - Required parameters: 1 - Parameter #0 [ $result ] - Parameter #1 [ $result_type ] - mysql_fetch_assoc - Deprecated: no - Accepted parameters: 1 - Required parameters: 1 - Parameter #0 [ $result ] - mysql_fetch_field - Deprecated: no - Accepted parameters: 2 - Required parameters: 1 - Parameter #0 [ $result ] - Parameter #1 [ $field_offset ] - mysql_fetch_lengths - Deprecated: no - Accepted parameters: 1 - Required parameters: 1 - Parameter #0 [ $result ] - mysql_fetch_object - Deprecated: no - Accepted parameters: 3 - Required parameters: 1 - Parameter #0 [ $result ] - Parameter #1 [ $class_name ] - Parameter #2 [ $ctor_params ] - mysql_fetch_row - Deprecated: no - Accepted parameters: 1 - Required parameters: 1 - Parameter #0 [ $result ] - mysql_field_flags - Deprecated: no - Accepted parameters: 2 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $field_offset ] - mysql_field_len - Deprecated: no - Accepted parameters: 2 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $field_offset ] - mysql_field_name - Deprecated: no - Accepted parameters: 2 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $field_index ] - mysql_field_seek - Deprecated: no - Accepted parameters: 2 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $field_offset ] - mysql_field_table - Deprecated: no - Accepted parameters: 2 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $field_offset ] - mysql_field_type - Deprecated: no - Accepted parameters: 2 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $field_offset ] - mysql_fieldflags - Deprecated: yes - Accepted parameters: 2 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $field_offset ] - mysql_fieldlen - Deprecated: yes - Accepted parameters: 2 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $field_offset ] - mysql_fieldname - Deprecated: yes - Accepted parameters: 2 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $field_index ] - mysql_fieldtable - Deprecated: yes - Accepted parameters: 2 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $field_offset ] - mysql_fieldtype - Deprecated: yes - Accepted parameters: 2 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $field_offset ] - mysql_free_result - Deprecated: no - Accepted parameters: 1 - Required parameters: 1 - Parameter #0 [ $result ] - mysql_freeresult - Deprecated: yes - Accepted parameters: 1 - Required parameters: 1 - Parameter #0 [ $result ] - mysql_get_client_info - Deprecated: no - Accepted parameters: 0 - Required parameters: 0 - mysql_get_host_info - Deprecated: no - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_get_proto_info - Deprecated: no - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_get_server_info - Deprecated: no - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_info - Deprecated: no - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_insert_id - Deprecated: no - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_list_dbs - Deprecated: yes - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_list_fields - Deprecated: no - Accepted parameters: 3 - Required parameters: 2 - Parameter #0 [ $database_name ] - Parameter #1 [ $table_name ] - Parameter #2 [ $link_identifier ] - mysql_list_processes - Deprecated: no - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_list_tables - Deprecated: yes - Accepted parameters: 2 - Required parameters: 1 - Parameter #0 [ $database_name ] - Parameter #1 [ $link_identifier ] - mysql_listdbs - Deprecated: yes - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_listfields - Deprecated: yes - Accepted parameters: 3 - Required parameters: 2 - Parameter #0 [ $database_name ] - Parameter #1 [ $table_name ] - Parameter #2 [ $link_identifier ] - mysql_listtables - Deprecated: yes - Accepted parameters: 2 - Required parameters: 1 - Parameter #0 [ $database_name ] - Parameter #1 [ $link_identifier ] - mysql_num_fields - Deprecated: no - Accepted parameters: 1 - Required parameters: 1 - Parameter #0 [ $result ] - mysql_num_rows - Deprecated: no - Accepted parameters: 1 - Required parameters: 1 - Parameter #0 [ $result ] - mysql_numfields - Deprecated: yes - Accepted parameters: 1 - Required parameters: 1 - Parameter #0 [ $result ] - mysql_numrows - Deprecated: yes - Accepted parameters: 1 - Required parameters: 1 - Parameter #0 [ $result ] - mysql_pconnect - Deprecated: no - Accepted parameters: 4 - Required parameters: 0 - Parameter #0 [ $hostname ] - Parameter #1 [ $username ] - Parameter #2 [ $password ] - Parameter #3 [ $flags ] - mysql_ping - Deprecated: no - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_query - Deprecated: no - Accepted parameters: 2 - Required parameters: 1 - Parameter #0 [ $query ] - Parameter #1 [ $link_identifier ] - mysql_real_escape_string - Deprecated: no - Accepted parameters: 2 - Required parameters: 1 - Parameter #0 [ $string ] - Parameter #1 [ $link_identifier ] - mysql_result - Deprecated: no - Accepted parameters: 3 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $row ] - Parameter #2 [ $field ] - mysql_select_db - Deprecated: no - Accepted parameters: 2 - Required parameters: 1 - Parameter #0 [ $database_name ] - Parameter #1 [ $link_identifier ] - mysql_selectdb - Deprecated: yes - Accepted parameters: 2 - Required parameters: 1 - Parameter #0 [ $database_name ] - Parameter #1 [ $link_identifier ] - mysql_set_charset - Deprecated: no - Accepted parameters: 2 - Required parameters: 1 - Parameter #0 [ $charset_name ] - Parameter #1 [ $link_identifier ] - mysql_stat - Deprecated: no - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_table_name - Deprecated: no - Accepted parameters: 3 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $row ] - Parameter #2 [ $field ] - mysql_tablename - Deprecated: no - Accepted parameters: 3 - Required parameters: 2 - Parameter #0 [ $result ] - Parameter #1 [ $row ] - Parameter #2 [ $field ] - mysql_thread_id - Deprecated: no - Accepted parameters: 1 - Required parameters: 0 - Parameter #0 [ $link_identifier ] - mysql_unbuffered_query - Deprecated: no - Accepted parameters: 2 - Required parameters: 1 - Parameter #0 [ $query ] - Parameter #1 [ $link_identifier ] -done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_result.phpt b/ext/mysql/tests/mysql_result.phpt deleted file mode 100644 index ae1983fe04..0000000000 --- a/ext/mysql/tests/mysql_result.phpt +++ /dev/null @@ -1,116 +0,0 @@ ---TEST-- -mysql_result() ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_result(): Unable to jump to row -1 on MySQL result index %d in %s on line %d -bool(false) - -Warning: mysql_result(): Unable to jump to row 2 on MySQL result index %d in %s on line %d -bool(false) - -Warning: mysql_result(): Bad column offset specified in %s on line %d -bool(false) - -Warning: mysql_result(): Bad column offset specified in %s on line %d -bool(false) -valid fields -%unicode|string%(1) "1" -%unicode|string%(1) "a" -%unicode|string%(1) "1" -%unicode|string%(1) "1" -%unicode|string%(1) "a" -%unicode|string%(1) "a" -some invalid fields - -Warning: mysql_result(): unknown not found in MySQL result index %d in %s on line %d -bool(false) - -Warning: mysql_result(): _test. not found in MySQL result index %d in %s on line %d -bool(false) - -Warning: mysql_result(): not found in MySQL result index %d in %s on line %d -bool(false) - -Warning: mysql_result(): _test. not found in MySQL result index %d in %s on line %d -bool(false) -_id -%unicode|string%(1) "1" -_label -string(2) "aa" -_foo -NULL - -Warning: mysql_result(): test.id not found in MySQL result index %d in %s on line %d -bool(false) - -Warning: mysql_result(): test.label not found in MySQL result index %d in %s on line %d -bool(false) - -Warning: mysql_result(): supplied resource is not a valid MySQL result resource in %s on line %d -bool(false) -done! diff --git a/ext/mysql/tests/mysql_select_db.phpt b/ext/mysql/tests/mysql_select_db.phpt deleted file mode 100644 index 6e0bf9e505..0000000000 --- a/ext/mysql/tests/mysql_select_db.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -mysql_select_db() ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -%unicode|string%(%d) "%s" -bool(false) - -Warning: mysql_select_db(): supplied resource is not a valid MySQL-Link resource in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_set_charset.phpt b/ext/mysql/tests/mysql_set_charset.phpt deleted file mode 100644 index a0bccd8c31..0000000000 --- a/ext/mysql/tests/mysql_set_charset.phpt +++ /dev/null @@ -1,62 +0,0 @@ ---TEST-- -mysql_set_charset() - STUB, function usage not recommended ---SKIPIF-- -') == 1) { - die('skip set character set not functional with PHP 6 (fomerly PHP 6 && unicode.semantics=On)'); -} - -if (!function_exists('mysql_set_charset')) - die("skip Function not available"); -?> ---FILE-- -') == 1)) - $expect = false; -else - $expect = true; - -$charsets = array('latin1', 'latin2'); -foreach ($charsets as $k => $charset) { - if (!($res = mysql_query(sprintf('SHOW CHARACTER SET LIKE "%s"', $charset), $link))) - continue; - mysql_free_result($res); - if ($expect !== ($tmp = @mysql_set_charset($charset, $link))) - printf("[006] Expecting %s/%s got %s/%s\n", - gettype($expect), $expect, - gettype($tmp), $tmp); -} - -mysql_close($link); -print "done!"; -?> ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_sql_safe_mode.phpt b/ext/mysql/tests/mysql_sql_safe_mode.phpt deleted file mode 100644 index 4d8ca92e47..0000000000 --- a/ext/mysql/tests/mysql_sql_safe_mode.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -mysql_[p]connect() - safe_mode ---SKIPIF-- - ---INI-- -sql.safe_mode=1 ---FILE-- - ---EXPECTF-- -Notice: mysql_connect(): SQL safe mode in effect - ignoring host/user/password information in %s on line %d - -Warning: mysql_connect(): Access denied for user '%s'@'%s' (using password: NO) in %s on line %d - -Notice: mysql_pconnect(): SQL safe mode in effect - ignoring host/user/password information in %s on line %d - -Warning: mysql_pconnect(): Access denied for user '%s'@'%s' (using password: NO) in %s on line %d -done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_stat.phpt b/ext/mysql/tests/mysql_stat.phpt deleted file mode 100644 index 95868b7b90..0000000000 --- a/ext/mysql/tests/mysql_stat.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -mysql_stat() ---SKIPIF-- - ---FILE-- -') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($stat)) { - printf("[004] Expecting Unicode error message!\n"); - var_inspect($stat); -} - -if ((!is_string($stat_def = mysql_stat())) || ('' === $stat_def)) - printf("[003] Expecting non empty string, got %s/'%s', [%d] %s\n", - gettype($stat_def), $stat_def, mysql_errno(), mysql_error()); - -assert(soundex($stat) === soundex($stat_def)); - -mysql_close($link); - -if (false !== ($tmp = mysql_stat($link))) - printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - -print "done!"; -?> ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_stat(): supplied resource is not a valid MySQL-Link resource in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_tablename.phpt b/ext/mysql/tests/mysql_tablename.phpt deleted file mode 100644 index 76007fde46..0000000000 --- a/ext/mysql/tests/mysql_tablename.phpt +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -mysql_tablename() ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_tablename() expects at least 2 parameters, 1 given in %s on line %d - -Warning: mysql_tablename(): Unable to jump to row -1 on MySQL result index %d in %s on line %d -%unicode|string%(1) "1" - -Warning: mysql_tablename(): Unable to jump to row 2 on MySQL result index %d in %s on line %d - -Warning: mysql_tablename(): supplied resource is not a valid MySQL result resource in %s on line %d -bool(false) -done! diff --git a/ext/mysql/tests/mysql_thread_id.phpt b/ext/mysql/tests/mysql_thread_id.phpt deleted file mode 100644 index a2e0f934c2..0000000000 --- a/ext/mysql/tests/mysql_thread_id.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -mysql_thread_id() ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d - -Warning: mysql_thread_id(): supplied resource is not a valid MySQL-Link resource in %s on line %d -done! diff --git a/ext/mysql/tests/mysql_trace_mode.phpt b/ext/mysql/tests/mysql_trace_mode.phpt deleted file mode 100644 index 73872de1db..0000000000 --- a/ext/mysql/tests/mysql_trace_mode.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -mysql.trace_mode=1 ---SKIPIF-- - ---INI-- -mysql.trace_mode=1 -error_reporting=E_ALL | E_NOTICE | E_STRICT ---FILE-- - ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -I don\'t mind character sets, do I?\n -Warning: mysql_query(): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'BOGUS_SQL' at line 1 in %s on line %d -done! - -Warning: Unknown: 1 result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query() in %s on line %d diff --git a/ext/mysql/tests/mysql_unbuffered_query.phpt b/ext/mysql/tests/mysql_unbuffered_query.phpt deleted file mode 100644 index 8c3c2d6e10..0000000000 --- a/ext/mysql/tests/mysql_unbuffered_query.phpt +++ /dev/null @@ -1,126 +0,0 @@ ---TEST-- -mysql_unbuffered_query() ---SKIPIF-- - ---FILE-- -') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($tmp['p_version'])) { - printf("[009] Expecting unicode string, dumping\n"); - var_dump($tmp); - } - mysql_free_result($res); - } else { - printf("[010] [%d] %s\n", mysql_errno($link), mysql_error($link)); - } - - mysql_unbuffered_query('DROP FUNCTION IF EXISTS f', $link); - if (mysql_unbuffered_query('CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN ver_param;', $link)) { - $res = mysql_unbuffered_query('SELECT f(VERSION()) AS f_version', $link); - $tmp = mysql_fetch_assoc($res); - if (!isset($tmp['f_version']) || ('' == $tmp['f_version'])) { - printf("[011] Result seems wrong, dumping\n"); - var_dump($tmp); - } - if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && - (version_compare(PHP_VERSION, '6.9.9', '<=') == 1) && - !is_unicode($tmp['f_version'])) { - printf("[012] Expecting unicode string, dumping\n"); - var_dump($tmp); - } - mysql_free_result($res); - } else { - printf("[012] [%d] %s\n", mysql_errno($link), mysql_error($link)); - } -} - -var_dump(mysql_unbuffered_query('INSERT INTO test(id) VALUES (100)', $link)); -var_dump($res = mysql_unbuffered_query('SELECT id FROM test', $link)); -var_dump(mysql_num_rows($res)); - -mysql_close($link); - -if (false !== ($tmp = mysql_unbuffered_query("SELECT id FROM test", $link))) - printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - -print "done!"; -?> ---CLEAN-- - ---EXPECTF-- -Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d -array(1) { - [%u|b%"valid"]=> - %unicode|string%(30) "this is sql but with semicolon" -} -bool(true) -resource(%d) of type (mysql result) -int(0) - -Notice: mysql_close(): Function called without first fetching all rows from a previous unbuffered query in %s on line %d - -Warning: mysql_unbuffered_query(): supplied resource is not a valid MySQL-Link resource in %s on line %d -done! diff --git a/ext/mysql/tests/setupdefault.inc b/ext/mysql/tests/setupdefault.inc deleted file mode 100644 index b13402ec14..0000000000 --- a/ext/mysql/tests/setupdefault.inc +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/ext/mysql/tests/skipif.inc b/ext/mysql/tests/skipif.inc deleted file mode 100644 index 0f932892ca..0000000000 --- a/ext/mysql/tests/skipif.inc +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/ext/mysql/tests/skipifconnectfailure.inc b/ext/mysql/tests/skipifconnectfailure.inc deleted file mode 100644 index a57c7dbd58..0000000000 --- a/ext/mysql/tests/skipifconnectfailure.inc +++ /dev/null @@ -1,17 +0,0 @@ - \ No newline at end of file diff --git a/ext/mysql/tests/skipifnotmysqlnd.inc b/ext/mysql/tests/skipifnotmysqlnd.inc deleted file mode 100644 index 9cccdc7bf1..0000000000 --- a/ext/mysql/tests/skipifnotmysqlnd.inc +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/ext/mysql/tests/table.inc b/ext/mysql/tests/table.inc deleted file mode 100644 index 18c858d913..0000000000 --- a/ext/mysql/tests/table.inc +++ /dev/null @@ -1,24 +0,0 @@ - -- 2.40.0