Edit report at https://bugs.php.net/bug.php?id=52384&edit=1
ID: 52384 Comment by: cedric dot bethencourt at gmail dot com Reported by: jonah dot harris at gmail dot com Summary: PDOStatement::debugDumpParams does not emit the bind parameter value Status: Open Type: Feature/Change Request Package: PDO related PHP Version: Irrelevant Block user comment: N Private report: N New Comment: same problem with PHP 5.3.3 on Linux Debian Previous Comments: ------------------------------------------------------------------------ [2011-09-15 11:54:24] php at nedge2k dot com problem also exists in php 5.3 for windoze ------------------------------------------------------------------------ [2010-09-29 01:22:44] cdotgutierrez at gmail dot com I am seeing the same issue on PHP 5.3.3 on OSX. I've tried it using the same test script that is provided in the original ticket. ------------------------------------------------------------------------ [2010-07-20 23:43:12] jonah dot harris at gmail dot com Description: ------------ Per the PDO documentation, PDOStatement::debugDumpParams should emit the bind parameter value. Currently however, it does not. Attached is a patch for 5.2 (which also applies cleanly to 5.3), which emits the bind parameter value. Test script: --------------- <?php $dbh = new PDO("sqlite:test.sdb"); $calories = (int) 150; /* Force a type conversion to string */ $colour = 'red'; $sth = $dbh->prepare('SELECT 1 WHERE 1 = :calories AND 2 = :colour'); if ($sth->bindParam(':calories', $calories, PDO::PARAM_INT) !== true) die('die on ' . __LINE__. "\n"); if ($sth->bindValue(':colour', $colour, PDO::PARAM_STR) !== true) die('die on ' . __LINE__. "\n"); $sth->debugDumpParams(); Expected result: ---------------- With Patch: SQL : [len = 44] SELECT 1 WHERE 1 = :calories AND 2 = :colour Params: 2 Key: Name: [9] :calories paramno=-1 name=[9] ":calories" is_param=1 param_type=1 value=150 Key: Name: [7] :colour paramno=-1 name=[7] ":colour" is_param=1 param_type=2 value=red Actual result: -------------- SQL: [44] SELECT 1 WHERE 1 = :calories AND 2 = :colour Params: 2 Key: Name: [9] :calories paramno=-1 name=[9] ":calories" is_param=1 param_type=1 Key: Name: [7] :colour paramno=-1 name=[7] ":colour" is_param=1 param_type=2 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=52384&edit=1