|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16718 setlocale() corrupts all functions that depend on it: WDDX, strftime, ucwords
Submitted: 2002-04-21 06:18 UTC Modified: 2002-10-29 16:57 UTC
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: bs_php at infeer dot com Assigned: hholzgra (profile)
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.1.2 OS: Win 2k
Private report: No CVE-ID: None
 [2002-04-21 06:18 UTC] bs_php at infeer dot com
First a list of all bug repports that I've found that I think are all caused be the setlocale() function:

Note that some assume the bug in WDDX, strftime or ucword but it's acctually the setlocale() that causes it.

Bug List:
- - - - -
WDDX: "german characters cannot be stored" Status:OPEN

ucwords(): "ucwords failing randomly with international characters" Status:OPEN

strftime(): "xml in zlib.xml does not use CDATA for code" " Status:BOGUS

mssql_fetch_array(): "French special characters" Status:BOGUS (Not sure about this one)

setlocale(): "Does it exist some way how to sort Czech texts inside arrays" Status:CLOSED

Intressting is that bug #14655 and my comment in bug #15800 that it's something random. I'm adding my bug comment from bug #15800 below:

> It's very inconsisten!
> At first I wasn't using setlocale() and all seamed fine.
> But after I called setlocale() the wddx serialize failed all the time!
> Multiple calls of setlocale() produce 2 different results that alternate. 
> After every Apache restart the results changes sort of
> If setlocale() is commented out, the the last result remains(even after apache is restarted). 
> It seams as if setlocale() is writting something wrong to the apache conf. 

> Reboot didn't help, my wddx serializetion is mucked up now! :(

> Don't use it on Win2000!!!

Following code was used to test :
  // setlocale(LC_ALL,"german"); // Commented out at first
  $in = "??????";
  $ser = wddx_serialize_value($in);
  $des = wddx_deserialize($ser);
  echo "<pre>";
  echo htmlspecialchars($ser) . "\n";
  echo "</pre>";


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-21 06:48 UTC] bs_php at infeer dot com
Just managed to get WDDX to run again, but it's rather a coincidence. 
I was playing around with the setlocale parameters and calling 

Call the script 2x (twice!) and WDDX worked! 
Immediately commented the setlocale() out after and don't us it on win2k!!!  

echo setlocale(LC_ALL,"ge");
$in = "??????";
$ser = wddx_serialize_value($in);
$des = wddx_deserialize($ser);
echo "<pre>";
echo htmlspecialchars($ser) . "\n";
echo "</pre>";
 [2002-05-16 08:47 UTC] cris at tellme dot net
if you want to resolve this problem change all mssql querys with odbc querys and all will be ok.......................i tryed this and it works.....:):):):)

 [2002-06-17 07:40 UTC]
looks like another setlocale/ZTS issue :(
 [2002-10-29 16:57 UTC]
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the original bug instead.

Thank you for your interest in PHP.

Duplicate of bug #14655
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 28 11:01:32 2024 UTC