ZF-7737: quoteInto won't accept valid SQL if question mark is in first position.


In Zend_Db_Adapter_Abstract

public function quoteInto($text, $value, $type = null, $count = null) { if ($count === null) { return str_replace('?', $this->quote($value, $type), $text); } else { while ($count > 0) { if (strpos($text, '?') != false) { $text = substr_replace($text, $this->quote($value), strpos($text, '?'), 1); } --$count; } return $text; } }

In the line "if (strpos($text, '?') != false) {", it should be !== and not !=, since position returned can be 0. Else, $table->select()->where('? = id', 123); //sample taken from forum in which I first wrote about this which is valid, won't work.

Nothing fancy, but I think it could affect some people =)


Patch for Zend_Db_Abstract and test case attached.

Patch applied to trunk and 1.9 release branch. In the future, please create your patches from the root of your ZF installation to ensure we patch the correct files. (There are many "Abstract.php" and "TestCommon.php" files!)