From: Adam Baratz Date: Thu, 29 Jun 2017 09:44:02 +0000 (+0200) Subject: Merge branch 'PHP-7.1' X-Git-Tag: php-7.2.0alpha3~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3ac20e099511c0bcbcfc5755199fe704e3918993;p=php Merge branch 'PHP-7.1' * PHP-7.1: Fixed bug #69356 Fixed #69356: PDOStatement::debugDumpParams() truncates query --- 3ac20e099511c0bcbcfc5755199fe704e3918993 diff --cc ext/pdo/pdo_stmt.c index a826240c76,b953739a6a..efdcc87eb8 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@@ -2103,18 -2104,11 +2103,19 @@@ static PHP_METHOD(PDOStatement, debugDu RETURN_FALSE; } - php_stream_printf(out, "SQL: [%zd] %.*s\n", - stmt->query_stringlen, - (int) stmt->query_stringlen, stmt->query_string); + /* break into multiple operations so query string won't be truncated at FORMAT_CONV_MAX_PRECISION */ + php_stream_printf(out, "SQL: [%zd] ", stmt->query_stringlen); + php_stream_write(out, stmt->query_string, stmt->query_stringlen); + php_stream_write(out, "\n", 1); + /* show parsed SQL if emulated prepares enabled */ + /* pointers will be equal if PDO::query() was invoked */ + if (stmt->active_query_string != NULL && stmt->active_query_string != stmt->query_string) { + php_stream_printf(out, "Sent SQL: [%zd] %.*s\n", + stmt->active_query_stringlen, + (int) stmt->active_query_stringlen, stmt->active_query_string); + } + php_stream_printf(out, "Params: %d\n", stmt->bound_params ? zend_hash_num_elements(stmt->bound_params) : 0);