]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.1'
authorAdam Baratz <adambaratz@php.net>
Thu, 29 Jun 2017 09:44:02 +0000 (11:44 +0200)
committerAdam Baratz <adambaratz@php.net>
Thu, 29 Jun 2017 09:44:02 +0000 (11:44 +0200)
* PHP-7.1:
  Fixed bug #69356
  Fixed #69356: PDOStatement::debugDumpParams() truncates query

1  2 
ext/pdo/pdo_stmt.c

index a826240c76d550dc03dc45acec7388e056474ea5,b953739a6a477afdc7ca2811a41703e3f86f8e7a..efdcc87eb8148bc62d2cd5d69186db80aad5b2ab
@@@ -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);