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

Issue Type: Bug Created: 2012-03-28T07:44:17.000+0000 Last Updated: 2012-03-28T07:44:17.000+0000 Status: Open Fix version(s): Reporter: Jean-Marie Lamodière (jmlamo) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db

Related issues: Attachments:


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

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.