PR 186: external protocols and locale independent string conversion

From: Date: Wed, 19 Sep 2012 18:35:57 +0000
Subject: PR 186: external protocols and locale independent string conversion
Groups: php.internals 
Request: Send a blank email to internals+get-63171@lists.php.net to get a copy of this message
Hi everybody, 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? cu, Lars

« previous php.internals (#63171) next »