2009年8月27日星期四

[fw-db] Not sure, but is this a bug?

I'm not really looking into trying the code, since I was just reading some of
the Db code for entertaining (hey! it's better than some bad novels =) ).

I came up with this part in class 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;
}
}

My issue, and I'm probably wrong, but this shouldn't take long, is that I
believe that strpos($text, '?') != false should be strpos($text, '?') !==
false

If the "?" is the first character, it would just not replace it. (I mean, ?
being in position 0).

If I'm wrong, I apologize for taking a quick reaction without verifying...
but I don't have any applications of mine using the ZF (again, I was just
reading :D) and I'm not supposed to waste too much time =)

And if this is not the right place to ask about this, again, sorry =)


--
View this message in context: http://www.nabble.com/Not-sure%2C-but-is-this-a-bug--tp25178000p25178000.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: