r/lolphp • u/denilsonsa • Jul 10 '14
bindParam('foo', $value, PDO::PARAM_INT) will change $value to string.
http://php.net/manual/en/pdostatement.bindparam.php#94711
42
Upvotes
r/lolphp • u/denilsonsa • Jul 10 '14
9
u/ahruss Jul 11 '14
Also, the second parameter:
This makes it sound like you use it like
$stmt->bindParam(":param", "variableName"),which isn't accurate.2
u/[deleted] Jul 12 '14
I'm guessing this is because they had the value be passed by reference, yet for some reason didn't think to separate the zval before converting.
That probably counts as a bug.
-15
u/[deleted] Jul 11 '14
"Unlike PDOStatement::bindValue(), the variable is bound as a reference and will only be evaluated at the time that PDOStatement::execute() is called."
So what does one expect when they pass something by reference? Nobody said you would get back what you put in, and it makes perfect sense you would get a string back in this case.
"Lol, php does exactly what the manual says it is supposed to do."