The bug applies to the module Paypal Gateway, but the problem is general:
Code: Select all
<?php
setlocale (LC_ALL, 'de_DE.UTF8');
$key = "field";
$value = 2.4;
$fmt = 'key="%s" value="%s"';
echo sprintf($fmt,$key,$value);
?>
The output is:s - the argument is treated as and presented as a string.
Code: Select all
key="field" value="2,4"
Code: Select all
key="field" value="2.4"
2. How to convert the variable $value in the given example to string? Assume that the values come from database or _REQUEST, so that the direct assignment $value = "2.4" is NOT possible.
----------------------------------------------------
The above code is tested on this environment:
Server OS: Linux 2.6.24-etchnhalf.1-686 On i686
Server Software: Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 mod_ssl/2.2.3 OpenSSL/0.9.8c
Php Information:
* phpversion: 5.2.0-8+etch13
* md5_function: On (True)
* gd_version: 2
* tempnam_function: On (True)
* magic_quotes_runtime: Off (False)
* memory_limit: 100000000
* max_execution_time: 30
* safe_mode: Off (False)
* session_save_path: /var/lib/php5 (1733)
* session.use_cookies: On (True)
Server Information:
* Server Api: cgi-fcgi
* Server Db Type: MySQL (mysql)
* Server Db Version: 5.0.32