PDO版本问题 Invalid parameter number: no parameters were bou
发现在客户的某个PHP版本下,执行某类操作的时候,总是会报如下错误 Invalid parameter number: no parameters were bound,经google,发现是php版本过低导致
今天在处理bug的时候发现某一个很奇怪的问题,在执行某类操作的时候会报:Invalid parameter number: no parameters were bound,但是该问题在本地或是测试机上测试都没有重现,猜想是否和版本有关,于是就google了下,发现http://forum.typecho.org/topic.php?id=1501 该文的二楼说道,该问题是版本的bug,在php5.2.9以下的pdo中会出现。于是就是找了团队中另外一位同时的机子(5.2.6)做测试,果然重现该问题,他的服务器上5.2.17上测试,该问题没有出现。
在调试的时候,发现出现该类操作的时候有如下业务报以上错误:
用PDO往表nw_log(表字段一些列uid之类的,及content字段)中插入一条数据,其中content字段的内容为test,并且在入库之前表字段的内容会调用PDO->quote方法进行转义。在php5.2.6机子上则报如上错误,但是在5.2.17机子上表现正常。
当我仅仅只是将内容修改为http://a.xxx/?tid=1的时候,在5.2.6机子上和5.2.17机子上均表现正常,于是再次将内容格式调试为test,则5.2.6及5.2.17上均表现正常,看来是单引号惹的祸。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

