ZF-12123: Float with comma not correctly quoted by Zend_Db_Adapter_Pdo_Abstract::_quote()


Some locales convert floats to string with a comma instead of a dot, as fr_FR. (string)12.34 == "12,34".

Zend_Db_Adapter_Abstract::_quote() handle this by using sprintf('%F', $value) when is_float($value) line 843. Float is converted to string with a dot regardless of the locale used.

But Zend_Db_Adapter_Pdo_Abstract::_quote() does not, line 292. This leads to a bug. For instance, with $db instanceof Zend_Db_Adapter_Pdo_Mysql :

echo (string) $db->select()->from('foo')->where('bar = ?', 12.34); //"SELECT foo.* FROM foo WHERE (bar = 12,34)"

Mysql error : "#1064 - You have an error in your SQL syntax;..."

I think ..._Pdo_Abstract::_quote() should do the same as ..._Abstact::_quote() ?


No comments to display