php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69356 PDO debugDumpParams truncate query
Submitted: 2015-04-02 11:47 UTC Modified: 2017-06-29 09:52 UTC
Votes:4
Avg. Score:3.0 ± 1.6
Reproduced:3 of 4 (75.0%)
Same Version:0 (0.0%)
Same OS:1 (33.3%)
From: cn007b at gmail dot com Assigned: adambaratz (profile)
Status: Closed Package: PDO Core
PHP Version: 5.5.23 OS: Ubuntu 14.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cn007b at gmail dot com
New email:
PHP Version: OS:

 

 [2015-04-02 11:47 UTC] cn007b at gmail dot com
Description:
------------
PDO debugDumpParams truncate query: 
http://stackoverflow.com/questions/29410151/why-pdo-debugdumpparams-truncate-query


Test script:
---------------
<?php
$dbh = new PDO('mysql:dbname=test;host=127.0.0.1', 'root');
$sth = $dbh->prepare("
    SELECT '
        Dumps the informations contained by a prepared statement directly on the output. It will provide the SQL query in use, the number of parameters used (Params), the list of parameters, with their name, type (paramtype) as an integer, their key name or position, and the position in the query (if this is supported by the PDO driver, otherwise, it will be -1).
        This is a debug function, which dump directly the data on the normal output.
        Tip:
        As with anything that outputs its result directly to the browser, the output-control functions can be used to capture the output of this function, and save it in a string (for example).
        This will only dumps the parameters in the statement at the moment of the dump. Extra parameters are not stored in the statement, and not displayed.
    '
");
$sth->execute();
$sth->debugDumpParams();

Actual result:
--------------
SQL: [835] 
    SELECT '
        Dumps the informations contained by a prepared statement directly on the output. It will provide the SQL query in use, the number of parameters used (Params), the list of parameters, with their name, type (paramtype) as an integer, their key name or position, and the position in the query (if this is supported by the PDO driver, otherwise, it will be -1).
        This is a debug function, which dump directly the data on the normal output.
        Tip:
        As with anythi
Params:  0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-02 21:34 UTC] cmb@php.net
-Summary: Kovpak +Summary: PDO debugDumpParams truncate query
 [2017-05-05 10:10 UTC] marc at gutt dot it
There should be an option to disable the truncation. And of course it should be possible to get the result as an array. At the moment the function is really useless for debugging.
 [2017-06-29 09:40 UTC] adambaratz@php.net
Automatic comment on behalf of adambaratz
Revision: http://git.php.net/?p=php-src.git;a=commit;h=08089f014cee7a43fac9ee75d677fcb93c0a5297
Log: Fixed #69356: PDOStatement::debugDumpParams() truncates query
 [2017-06-29 09:40 UTC] adambaratz@php.net
-Status: Open +Status: Closed
 [2017-06-29 09:43 UTC] adambaratz@php.net
Automatic comment on behalf of adambaratz
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c8bb64c406cc7a6fd56d7831aabac52f5402677e
Log: Fixed bug #69356
 [2017-06-29 09:43 UTC] adambaratz@php.net
Automatic comment on behalf of adambaratz
Revision: http://git.php.net/?p=php-src.git;a=commit;h=08089f014cee7a43fac9ee75d677fcb93c0a5297
Log: Fixed #69356: PDOStatement::debugDumpParams() truncates query
 [2017-06-29 09:49 UTC] adambaratz@php.net
Automatic comment on behalf of adambaratz
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c8bb64c406cc7a6fd56d7831aabac52f5402677e
Log: Fixed bug #69356
 [2017-06-29 09:50 UTC] adambaratz@php.net
Automatic comment on behalf of adambaratz
Revision: http://git.php.net/?p=php-src.git;a=commit;h=08089f014cee7a43fac9ee75d677fcb93c0a5297
Log: Fixed #69356: PDOStatement::debugDumpParams() truncates query
 [2017-06-29 09:52 UTC] adambaratz@php.net
-Package: PDO MySQL +Package: PDO Core -Assigned To: +Assigned To: adambaratz
 [2017-06-29 09:52 UTC] adambaratz@php.net
php_stream_printf(), which writes these strings to the output buffer, has a maximum length for strings it interpolates. I switched to php_stream_write() for the query strings to resolve the issue. The fix was applied starting with PHP 7.0.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 05:01:29 2024 UTC