php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42493 odbc_pconnect: persistent connections with different locales
Submitted: 2007-08-31 12:34 UTC Modified: 2010-05-20 15:06 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: dave dot lane at gmx dot net Assigned:
Status: Not a bug Package: ODBC related
PHP Version: 5.2.4 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dave dot lane at gmx dot net
New email:
PHP Version: OS:

 

 [2007-08-31 12:34 UTC] dave dot lane at gmx dot net
Description:
------------
We have an environment where we both use odbc_pconnect and different locales. DB2 recognises the locale and returns data formatted based on this locale. That means when we do a setlocale(LC_ALL, de_DE); before we connect we get float formatted so: 1,23541200000000E+004 and when we do a setlocale(LC_ALL, en_GB); we get float formatted so 1.23541200000000E+004. This works fine when we use odbc_connect. The problem is when we use odbc_pconnect connections are recycled without taking the locale into account. Sometimes we get english when we have set german and vice versa. 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-20 12:37 UTC] mike@php.net
-Status: Open +Status: Bogus
 [2010-05-20 12:37 UTC] mike@php.net
Unforutnately this cannot be influenced by PHP, you need to take care of your locale when useing ODBC.
 [2010-05-20 13:52 UTC] dave dot lane at gmx dot net
The bug is about odbc_pconnect i.e. take notice of the "p". As far as I know the persistence of the connection is handled by php. The problem is the following:
setlocale(LC_ALL, de_DE);
odbc_pconnect(...)
SQL: select current_timestamp from ... result: date in german format
setlocale(LC_ALL, en_EN);
odbc_pconnect(...)
SQL: select current_timestamp from ... result: date still in german format

So obviously odbc_pconnect is taking notice of the locale when connecting, but not when using persistence connections. Thanks for the speedy reply to the problem by the way (nearly three years...)
 [2010-05-20 14:08 UTC] mike@php.net
thanks for wasting our time, by the way. (You probably find such comments funny, eh?)

The connection is just opened once.
 [2010-05-20 15:06 UTC] dave dot lane at gmx dot net
Excuse me? No I don't find it funny. The fact is the reply took 3 years. If you don't want to fix the problem or even understand it then fine don't. It is still a Unified ODBC problem though. If the connect routine takes notice of the locale when first connecting and not by any subsequent connections that is a bug. End of story. A fix would be to set the current locale on the existing connection or to keep track of the locales corresponding to the open connections in the pool and open a new connection when the current locale doesn't fit any in the pool. We had to stop using pconnect and implemenent our own pool doing exactly this.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 21:01:31 2024 UTC