I am no security expert. My knowledge extends as far as "always use prepared staemtens and bind any SQL query parameters which are taken from user input".
Like, I imagine, many others, I would very much like to debug my PDO queries right there in my PHP code.
PDO-DEBUG looks like a great solution, even if I would have to rewrite my queries.
My uncertainty is where it says
Your PDO block probably looks like this:
$sql = "INSERT INTO test (col1, col2, col3) VALUES (:col1, :col2, :col3)";
and this, right ?
$query->execute(array(':col1' => $param_1, ':col2' => $param_2, ':col3' => $param_3));
because mine doesn't. It looks like
$stmt = $conn->prepare("INSERT INTO test (col1, col2, col3) VALUES (:col1, :col2, :col3"));
$stmt->bind_param(":col1", $col1);
$stmt->bind_param(":col2", $col2);
$stmt->bind_param(":col3", $col3);
$stmt->execute();
(the syntax may be slightly wrong; I am doing it from memory, with no access to my code or a PHP interpreter).
My point is that preapre()
and bind()
perform some "magicks", and I would not trade the security which they provide for some nice debugging.
Should I be concerned? Or should I go ahead and us it?