diff options
-rw-r--r-- | ext/mysqlnd/config.w32 | 1 | ||||
-rw-r--r-- | ext/mysqlnd/config9.m4 | 2 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_bt.c | 241 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_debug.c | 1 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_debug.h | 2 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_result.c | 9 | ||||
-rw-r--r-- | ext/pdo_mysql/mysql_statement.c | 4 | ||||
-rw-r--r-- | ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt | 3 | ||||
-rw-r--r-- | ext/pdo_pgsql/tests/common.phpt | 2 | ||||
-rw-r--r-- | ext/pgsql/pgsql.c | 4 | ||||
-rw-r--r-- | ext/phar/phar_object.c | 12 | ||||
-rw-r--r-- | ext/xmlrpc/xmlrpc-epi-php.c | 2 |
12 files changed, 12 insertions, 271 deletions
diff --git a/ext/mysqlnd/config.w32 b/ext/mysqlnd/config.w32 index a910a0e509..c803042ee1 100644 --- a/ext/mysqlnd/config.w32 +++ b/ext/mysqlnd/config.w32 @@ -10,7 +10,6 @@ if (PHP_MYSQLND != "no") { "mysqlnd_alloc.c " + "mysqlnd_auth.c " + "mysqlnd_block_alloc.c " + - "mysqlnd_bt.c " + "mysqlnd_charset.c " + "mysqlnd_debug.c " + "mysqlnd_driver.c " + diff --git a/ext/mysqlnd/config9.m4 b/ext/mysqlnd/config9.m4 index 0e08b977af..d94d217945 100644 --- a/ext/mysqlnd/config9.m4 +++ b/ext/mysqlnd/config9.m4 @@ -18,7 +18,7 @@ fi dnl If some extension uses mysqlnd it will get compiled in PHP core if test "$PHP_MYSQLND" != "no" || test "$PHP_MYSQLND_ENABLED" = "yes"; then mysqlnd_ps_sources="mysqlnd_ps.c mysqlnd_ps_codec.c" - mysqlnd_base_sources="mysqlnd.c mysqlnd_alloc.c mysqlnd_bt.c mysqlnd_charset.c mysqlnd_wireprotocol.c \ + mysqlnd_base_sources="mysqlnd.c mysqlnd_alloc.c mysqlnd_charset.c mysqlnd_wireprotocol.c \ mysqlnd_loaddata.c mysqlnd_reverse_api.c mysqlnd_net.c \ mysqlnd_statistics.c mysqlnd_driver.c mysqlnd_ext_plugin.c mysqlnd_auth.c \ mysqlnd_result.c mysqlnd_result_meta.c mysqlnd_debug.c\ diff --git a/ext/mysqlnd/mysqlnd_bt.c b/ext/mysqlnd/mysqlnd_bt.c deleted file mode 100644 index 94b73f00e3..0000000000 --- a/ext/mysqlnd/mysqlnd_bt.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 2006-2014 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 <georg@mysql.com> | - | Andrey Hristov <andrey@mysql.com> | - | Ulf Wendel <uwendel@mysql.com> | - +----------------------------------------------------------------------+ -*/ - -/* $Id: mysqlnd_debug.c 309303 2011-03-16 12:42:59Z andrey $ */ - -#include "php.h" -#include "Zend/zend_builtin_functions.h" - -/* Follows code borrowed from zend_builtin_functions.c because the functions there are static */ - -/* {{{ gettraceasstring() macros */ -#define TRACE_APPEND_CHR(chr) \ - *str = (char*)erealloc(*str, *len + 1 + 1); \ - (*str)[(*len)++] = chr - -#define TRACE_APPEND_STRL(val, vallen) \ - { \ - int l = vallen; \ - *str = (char*)erealloc(*str, *len + l + 1); \ - memcpy((*str) + *len, val, l); \ - *len += l; \ - } - -#define TRACE_APPEND_STR(val) \ - TRACE_APPEND_STRL(val, sizeof(val)-1) - -inline void trace_append_key(HashTable *ht, const char *key) { - zval *ztmp; - if ((ztmp = zend_hash_str_find(ht, key, sizeof(key))) != NULL) { - TRACE_APPEND_STRL(Z_STRVAL_P(ztmp)->val, Z_STRVAL_P(ztmp)->len); - } -} - -/* }}} */ - -static int -mysqlnd_build_trace_args(zval *arg TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ -{ - char **str; - int *len; - - str = va_arg(args, char**); - len = va_arg(args, int*); - - /* the trivial way would be to do: - * conver_to_string_ex(arg); - * append it and kill the now tmp arg. - * but that could cause some E_NOTICE and also damn long lines. - */ - - switch (Z_TYPE_P(arg)) { - case IS_NULL: - TRACE_APPEND_STR("NULL, "); - break; - case IS_STRING: { - int l_added; - TRACE_APPEND_CHR('\''); - if (Z_STRLEN_P(arg) > 15) { - TRACE_APPEND_STRL(Z_STRVAL_P(arg), 15); - TRACE_APPEND_STR("...', "); - l_added = 15 + 6 + 1; /* +1 because of while (--l_added) */ - } else { - l_added = Z_STRLEN_P(arg); - TRACE_APPEND_STRL(Z_STRVAL_P(arg), l_added); - TRACE_APPEND_STR("', "); - l_added += 3 + 1; - } - while (--l_added) { - if ((*str)[*len - l_added] < 32) { - (*str)[*len - l_added] = '?'; - } - } - break; - } - case IS_TRUE: - TRACE_APPEND_STR("true, "); - break; - case IS_FALSE: - TRACE_APPEND_STR("false, "); - break; - case IS_RESOURCE: - TRACE_APPEND_STR("Resource id #"); - /* break; */ - case IS_LONG: { - long lval = Z_LVAL_P(arg); - char s_tmp[MAX_LENGTH_OF_LONG + 1]; - int l_tmp = zend_sprintf(s_tmp, "%ld", lval); /* SAFE */ - TRACE_APPEND_STRL(s_tmp, l_tmp); - TRACE_APPEND_STR(", "); - break; - } - case IS_DOUBLE: { - double dval = Z_DVAL_P(arg); - char *s_tmp; - int l_tmp; - - s_tmp = emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); - l_tmp = zend_sprintf(s_tmp, "%.*G", (int) EG(precision), dval); /* SAFE */ - TRACE_APPEND_STRL(s_tmp, l_tmp); - /* %G already handles removing trailing zeros from the fractional part, yay */ - efree(s_tmp); - TRACE_APPEND_STR(", "); - break; - } - case IS_ARRAY: - TRACE_APPEND_STR("Array, "); - break; - case IS_OBJECT: { - zend_string *class_name; - /* see #67299, may be removed now */ - int dupl = 0; - - TRACE_APPEND_STR("Object("); - - class_name = zend_get_object_classname(Z_OBJ_P(arg) TSRMLS_CC); - - TRACE_APPEND_STRL(class_name->val, class_name->len); - if (!dupl) { - efree(class_name); - } - - TRACE_APPEND_STR("), "); - break; - } - default: - break; - } - return ZEND_HASH_APPLY_KEEP; -} -/* }}} */ - -static int -mysqlnd_build_trace_string(zval *frame TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ -{ - char *s_tmp, **str; - int *len, *num; - long line; - HashTable *ht = Z_ARRVAL_P(frame); - zval *zfile, *tmp, *zline; - uint * level; - - level = va_arg(args, uint *); - str = va_arg(args, char**); - len = va_arg(args, int*); - num = va_arg(args, int*); - - if (!*level) { - return ZEND_HASH_APPLY_KEEP; - } - --*level; - - s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 1 + 1); - sprintf(s_tmp, "#%d ", (*num)++); - TRACE_APPEND_STRL(s_tmp, strlen(s_tmp)); - efree(s_tmp); - - if ((zfile = zend_hash_str_find(ht, "file", sizeof("file"))) != NULL) { - if ((zline = zend_hash_str_find(ht, "line", sizeof("line"))) != NULL) { - line = Z_LVAL_P(zline); - } else { - line = 0; - } - s_tmp = emalloc(Z_STRLEN_P(zfile) + MAX_LENGTH_OF_LONG + 4 + 1); - sprintf(s_tmp, "%s(%ld): ", Z_STR_P(zfile)->val, line); - TRACE_APPEND_STRL(s_tmp, strlen(s_tmp)); - efree(s_tmp); - } else { - TRACE_APPEND_STR("[internal function]: "); - } - trace_append_key(ht, "class"); - trace_append_key(ht, "type"); - trace_append_key(ht, "function"); - TRACE_APPEND_CHR('('); - if (zend_hash_find(ht, "args", sizeof("args"), (void**)&tmp) == SUCCESS) { - int last_len = *len; - zend_hash_apply_with_arguments(Z_ARRVAL_P(tmp) TSRMLS_CC, (apply_func_args_t)mysqlnd_build_trace_args, 2, str, len); - if (last_len != *len) { - *len -= 2; /* remove last ', ' */ - } - } - TRACE_APPEND_STR(")\n"); - return ZEND_HASH_APPLY_KEEP; -} -/* }}} */ - - -PHPAPI char * -mysqlnd_get_backtrace(uint max_levels, size_t * length TSRMLS_DC) -{ - zval *trace; - char *res = estrdup(""), **str = &res, *s_tmp; - int res_len = 0, *len = &res_len, num = 0; - if (max_levels == 0) { - max_levels = 99999; - } - - MAKE_STD_ZVAL(trace); - zend_fetch_debug_backtrace(trace, 0, 0, 0 TSRMLS_CC); - - zend_hash_apply_with_arguments(Z_ARRVAL_P(trace) TSRMLS_CC, (apply_func_args_t)mysqlnd_build_trace_string, 4, &max_levels, str, len, &num); - zval_ptr_dtor(&trace); - - if (max_levels) { - s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 7 + 1); - sprintf(s_tmp, "#%d {main}", num); - TRACE_APPEND_STRL(s_tmp, strlen(s_tmp)); - efree(s_tmp); - } - - res[res_len] = '\0'; - *length = res_len; - - return res; -} - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c index 9fbcc4768f..296a31dfb0 100644 --- a/ext/mysqlnd/mysqlnd_debug.c +++ b/ext/mysqlnd/mysqlnd_debug.c @@ -792,7 +792,6 @@ static struct st_mysqlnd_plugin_trace_log mysqlnd_plugin_trace_log_plugin = }, {/* methods */ mysqlnd_debug_init, - mysqlnd_get_backtrace } }; diff --git a/ext/mysqlnd/mysqlnd_debug.h b/ext/mysqlnd/mysqlnd_debug.h index 861851378b..6f073b1489 100644 --- a/ext/mysqlnd/mysqlnd_debug.h +++ b/ext/mysqlnd/mysqlnd_debug.h @@ -66,7 +66,6 @@ struct st_mysqlnd_plugin_trace_log struct { MYSQLND_DEBUG * (*trace_instance_init)(const char * skip_functions[] TSRMLS_DC); - char * (*get_backtrace)(uint max_levels, size_t * length TSRMLS_DC); } methods; }; @@ -74,7 +73,6 @@ void mysqlnd_debug_trace_plugin_register(TSRMLS_D); PHPAPI MYSQLND_DEBUG * mysqlnd_debug_init(const char * skip_functions[] TSRMLS_DC); -PHPAPI char * mysqlnd_get_backtrace(uint max_levels, size_t * length TSRMLS_DC); #if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 1400)) #ifdef PHP_WIN32 diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index 0112a1394d..68eabf7368 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -630,8 +630,6 @@ mysqlnd_query_read_result_set_header(MYSQLND_CONN_DATA * conn, MYSQLND_STMT * s stmt->state = MYSQLND_STMT_INITTED; } } else { - unsigned int to_log = MYSQLND_G(log_mask); - to_log &= fields_eof->server_status; DBG_INF_FMT("warnings=%u server_status=%u", fields_eof->warning_count, fields_eof->server_status); conn->upsert_status->warning_count = fields_eof->warning_count; /* @@ -649,13 +647,6 @@ mysqlnd_query_read_result_set_header(MYSQLND_CONN_DATA * conn, MYSQLND_STMT * s } else if (fields_eof->server_status & SERVER_QUERY_WAS_SLOW) { statistic = STAT_QUERY_WAS_SLOW; } - if (to_log) { -#if A0 - char *backtrace = mysqlnd_get_backtrace(TSRMLS_C); - php_log_err(backtrace TSRMLS_CC); - efree(backtrace); -#endif - } MYSQLND_INC_CONN_STATISTIC(conn->stats, statistic); } } while (0); diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index df3a3955c8..18d960cadb 100644 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -404,7 +404,9 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ /* ensure that we free any previous unfetched results */ #ifndef PDO_USE_MYSQLND if (S->stmt) { - stmt->column_count = (int)mysql_num_fields(S->result); + if (S->result) { + stmt->column_count = (int)mysql_num_fields(S->result); + } mysql_stmt_free_result(S->stmt); } #endif diff --git a/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt b/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt index c992d3acf9..49bd5551ac 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt @@ -102,5 +102,4 @@ require dirname(__FILE__) . '/mysql_pdo_test.inc'; MySQLPDOTest::dropTestTable(); ?> --EXPECTF-- -[001] Call to PDO::setAttribute(int attribute, mixed value) has changed the type of value from integer to boolean, test will not work properly -done!
\ No newline at end of file +done! diff --git a/ext/pdo_pgsql/tests/common.phpt b/ext/pdo_pgsql/tests/common.phpt index c5a2f2bbf3..8a21371bf9 100644 --- a/ext/pdo_pgsql/tests/common.phpt +++ b/ext/pdo_pgsql/tests/common.phpt @@ -18,7 +18,7 @@ if (false !== getenv('PDO_PGSQL_TEST_DSN')) { $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_PGSQL_TEST_ATTR'); } } else { - $config['ENV']['PDOTEST_DSN'] = 'pgsql:host=localhost port=5432 dbname=test user=postgres password=postgres'; + $config['ENV']['PDOTEST_DSN'] = 'pgsql:host=localhost port=5432 dbname=test user= password='; } return $config; diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 9d8cf2d9b3..550c1dda4a 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -3036,7 +3036,7 @@ PHP_FUNCTION(pg_free_result) } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result); - if (Z_LVAL_P(result) == 0) { + if (Z_RES_P(result) == NULL) { RETURN_FALSE; } zend_list_close(Z_RES_P(result)); @@ -5787,7 +5787,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con } convert_to_boolean(is_enum); - if (Z_LVAL_P(is_enum)) { + if (Z_TYPE_P(is_enum) == IS_TRUE) { /* enums need to be treated like strings */ data_type = PG_TEXT; } else { diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index d73f6ad641..e8f9c4c481 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -712,15 +712,8 @@ PHP_METHOD(Phar, webPhar) switch (Z_TYPE(retval)) { case IS_STRING: efree(entry); - - if (fci.retval != &retval) { - entry = estrndup(Z_STRVAL_P(fci.retval), Z_STRLEN_P(fci.retval)); - entry_len = Z_STRLEN_P(fci.retval); - } else { - entry = Z_STRVAL(retval); - entry_len = Z_STRLEN(retval); - } - + entry = estrndup(Z_STRVAL_P(fci.retval), Z_STRLEN_P(fci.retval)); + entry_len = Z_STRLEN_P(fci.retval); break; case IS_TRUE: case IS_FALSE: @@ -3832,7 +3825,6 @@ PHP_METHOD(Phar, addFile) php_stream_to_zval(resource, &zresource); phar_add_file(&(phar_obj->archive), fname, fname_len, NULL, 0, &zresource TSRMLS_CC); zval_ptr_dtor(&zresource); - php_stream_close(resource); } /* }}} */ diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index ea0d3c27ec..9378529013 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -281,7 +281,9 @@ static void destroy_server_data(xmlrpc_server_data *server TSRMLS_DC) static void xmlrpc_server_destructor(zend_resource *rsrc TSRMLS_DC) { if (rsrc && rsrc->ptr) { + rsrc->gc.refcount++; destroy_server_data((xmlrpc_server_data*) rsrc->ptr TSRMLS_CC); + rsrc->gc.refcount--; } } |