Skip to content
This repository was archived by the owner on May 16, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions library/Zend/Db/Adapter/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -930,13 +930,7 @@ 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, $type), strpos($text, '?'), 1);
}
--$count;
}
return $text;
return implode($this->quote($value, $type), explode('?', $text, $count + 1));
}
}

Expand Down
10 changes: 10 additions & 0 deletions tests/Zend/Db/Adapter/TestCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,16 @@ public function testAdapterQuoteIntoCount()
'Incorrect quoteInto() result for count');
}

public function testAdapterQuoteIntoCountAndQuestionMark()
{
$string = 'foo = ? OR moo = ? OR boo = ?';
$param = 'What?';
$value = $this->_db->quoteInto($string, $param, null, 2);
$this->assertTrue(is_string($value));
$this->assertEquals("foo = 'What?' OR moo = 'What?' OR boo = ?", $value,
'Incorrect quoteInto() result for count and question mark in value');
}

public function testAdapterQuoteTypeInt()
{
foreach ($this->_numericDataTypes as $typeName => $type) {
Expand Down