nicolasff/phpredis — pull request #189 by maxbeutel (2012-05-23 09:38:42+00:00)
Title: Fix problem with floatvalue-scores in PHP 5.4

Due to a bug/weird behaviour in PHP 5.4 with `_php_math_number_format` float values were transformed to invalid values.

Test script:

$redis = new Redis();
$redis->connect('redis01');
var_dump($redis->zAdd('foo', 1337706476.8469, 'VAL'));

Redis command sent with rev. f8f552e3b24ce7dbcbae2b0b4fecb9dd091a4a90

"ZADD" "foo" "1" "VAL"

Expected output (at least within a certain precision range)

"ZADD" "foo" "1337706476.84689999" "VAL"

This patch circumvents the problem by not using `_php_math_number_format` at all and using `spprintf` which is also used internally in `_php_math_number_format` for getting the string length of the input.

See https://bugs.php.net/bug.php?id=62112
PHP Version: PHP 5.4.1 on Debian Squeeze