From f07978b4c363bf0a47743ee0b4d83ff3dc49a405 Mon Sep 17 00:00:00 2001 From: longxinhui Date: Sat, 17 Nov 2018 15:28:05 +0800 Subject: [PATCH] Fix PDOStatement::execute parameter error in specific scenarios Array to string conversion occurs when the PDOStatement::execute parameter is empty in a specific scenario. --- extension/php_xhprof.h | 2 +- extension/xhprof.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/extension/php_xhprof.h b/extension/php_xhprof.h index 3da8305a..e180faee 100755 --- a/extension/php_xhprof.h +++ b/extension/php_xhprof.h @@ -39,7 +39,7 @@ extern zend_module_entry xhprof_module_entry; */ /* XHProf version */ -#define XHPROF_VERSION "2.0.4" +#define XHPROF_VERSION "2.0.5" /* Fictitious function name to represent top of the call tree. The paranthesis * in the name is to ensure we don't conflict with user function names. */ diff --git a/extension/xhprof.c b/extension/xhprof.c index a7e87cad..ffc9dfc9 100755 --- a/extension/xhprof.c +++ b/extension/xhprof.c @@ -1501,6 +1501,11 @@ char* hp_trace_callback_pdo_statement_execute(char *symbol, zend_execute_data *d return result; #endif + if (ZEND_CALL_NUM_ARGS(data) < 1) { + spprintf(&result, 0, "%s#%s", symbol, Z_STRVAL_P(query_string)); + return result; + } + arg = ZEND_CALL_ARG(data, 1); if (Z_TYPE_P(arg) != IS_ARRAY) { spprintf(&result, 0, "%s#%s", symbol, Z_STRVAL_P(query_string));