ソースを参照

ZF-7737: allow quoting in front of assignment operators (patch courtesy Steve Hollis)

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19114 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 16 年 前
コミット
be34460633

+ 1 - 1
library/Zend/Db/Adapter/Abstract.php

@@ -902,7 +902,7 @@ abstract class Zend_Db_Adapter_Abstract
             return str_replace('?', $this->quote($value, $type), $text);
         } else {
             while ($count > 0) {
-                if (strpos($text, '?') != false) {
+                if (strpos($text, '?') !== false) {
                     $text = substr_replace($text, $this->quote($value, $type), strpos($text, '?'), 1);
                 }
                 --$count;

+ 9 - 0
tests/Zend/Db/Adapter/TestCommon.php

@@ -2005,4 +2005,13 @@ abstract class Zend_Db_Adapter_TestCommon extends Zend_Db_TestSetup
         unset($stmt);
         $util->dropTable($tableName);
     }
+
+    /**
+     * @group ZF-7737
+     */
+    public function testQuoteIntoReplacesPlaceholderAtFirstCharacterWhenCountIsNotNull()
+    {
+        $quotedString = $this->_db->quoteInto('? = bar', 'foo', NULL, 1);
+        $this->assertEquals("'foo' = bar", $quotedString);
+    }
 }