hi Lars, On Wed, Sep 19, 2012 at 8:35 PM, Lars Strojny <l...@strojny.net> wrote:
> I'm currently working on https://github.com/php/php-src/pull/186, which fixes > a problem with PostgreSQL when passing a float to pg_query_params() with a > locale setting that uses "," as a decimal point. pg_query_params() uses > convert_to_string(), which uses %G as a format string for floats, which is > locale sensitive (and therefore converts e.g. in hr_HR or de_DE to "1,1"). > The proposed fix is to introduce a new API convert_to_cstring() in the Zend > Engine to allow converting types to C-locale strings. > > This kind of fix is very likely needed in other places, where floats are > converted using convert_to_string(). I haven’t found time to try e.g. > mysqlnd, but I suspect we’ll find similar issues there. I don’t think the > proposed workaround of burden users with explicitly converting floats to a > numeric representation is a good solution and I think we should fix bugs like > that in places they occur. > > What’s your take on the proposed fix of introducing convert_to_cstring() and > using it where external protocols require a locale insensitive float > conversion? To me it looks like it is not something we should try to solve. The application, database code (via connection options, queries, etc.) should take care of. About internals other usages, *printf functions allow to do what you suggest easily without adding yet another conversion function. Cheers, -- Pierre @pierrejoye -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php