PDO Invalid parameter number - parameters in comments

前端 未结 1 606
野的像风
野的像风 2021-01-24 17:40

Today I encountered a bug (in PDO) I never saw before, but is kinda obvious when you think about it.

I got the following error: Warning: PDOStatement::execute() [p

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-24 18:42

    The solution is obvious: PDO disregards comments as such and tries to bind the non-existent variable ':Z'. You can't use parameters in comments in PDO (unless you do bind them).

    There's a similar bug using question marks in comments.

    0 讨论(0)
提交回复
热议问题