#46408 [Opn->Bgs]: Locale number format settings can cause pg_query_params to break with numerics
From: jani@php.net Date: Tue, 28 Oct 2008 21:30:50 +0000 Subject: #46408 [Opn->Bgs]: Locale number format settings can cause pg_query_params to break with numerics References: 1 Groups: php.bugs Request: Send a blank email to php-bugs+get-130239@lists.php.net to get a copy of this message
ID: 46408
Updated by: jani@php.net
Reported By: alec at smecher dot bc dot ca
-Status: Open
+Status: Bogus
Bug Type: PostgreSQL related
Operating System: Debian testing
PHP Version: 5.2.7RC2
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2008-10-28 19:40:39] alec at smecher dot bc dot ca
Description:
------------
Using PHP's setlocale function can cause number formats to change (e.g.
formatting floats using a comma instead of a decimal, such as 3,5
instead of 3.5). This causes pg_query_params to break when binding
floats into the parameter array, as psql doesn't understand
comma-formatted numbers.
You may need to generate the hr_HR locale on your system in order for
number formatting to work as described above once setlocale has been
called (see the debug "echo" in the reproduce code).
I reproduced the problem with 5.2.6 and 5.2.7RC2.
Reproduce code:
---------------
<?php
ini_set('display_errors', E_ALL);
setlocale(LC_ALL, 'hr_HR.utf-8', 'hr_HR');
$number = 3.5;
$dbuser = 'putdbusernamehere';
$dbpass = 'putdbpasswordhere';
echo "Three and a half is: " . $number . " (should come out as
3,5)\n";
$conn = pg_connect("host=localhost user=$dbuser password=$dbpass");
$result = pg_query_params($conn, 'SELECT $1::numeric',
array($number));
pg_close($conn);
?>
Expected result:
----------------
Three and a half is: 3,5 (should come out as 3,5)
Actual result:
--------------
Three and a half is: 3,5 (should come out as 3,5)
Warning: pg_query_params(): Query failed: ERROR: invalid input syntax
for type numeric: "3,5" in /home/asmecher/cvs/ojs2-stable/test.php on
line 13
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46408&edit=1
Thread (29 messages)
- #46408 [Opn->Bgs]: Locale number format settings can cause pg_query_params to break with numerics
- #46408 [Bgs]: Locale number format settings can cause pg_query_params to break with numerics
- #46408 [Bgs]: Locale number format settings can cause pg_query_params to break with numerics
- #46408 [Bgs]: Locale number format settings can cause pg_query_params to break with numerics
- #46408 [Bgs]: Locale number format settings can cause pg_query_params to break with numerics
- #46408 [Bgs->Opn]: Locale number format settings can cause pg_query_params to break with numerics
- #46408 [Opn]: Locale number format settings can cause pg_query_params to break with numerics
- #46408 [Opn]: Locale number format settings can cause pg_query_params to break with numerics
- #46408 [Opn]: Locale number format settings can cause pg_query_params to break with numerics
- #46408 [Com]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Com]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Opn]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Asn->Wfx]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Wfx]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Wfx]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Wfx]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Wfx]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Wfx]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Wfx]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Wfx]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Wfx]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Wfx]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Wfx]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Wfx]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Com]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Com]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Com]: Locale number format settings can cause pg_query_params to break with numerics
- Bug #46408 [Wfx->Csd]: Locale number format settings can cause pg_query_params to break with numerics
| « previous | php.bugs (#130239) | next » |
|---|