php.net |  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
Votes:2
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
Hi
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
  http://bugs.php.net/bug.php?id=15800

ucwords(): "ucwords failing randomly with international characters" Status:OPEN
  http://bugs.php.net/bug.php?id=14655

strftime(): "xml in zlib.xml does not use CDATA for code" " Status:BOGUS
  http://bugs.php.net/bug.php?id=14180

mssql_fetch_array(): "French special characters" Status:BOGUS (Not sure about this one)
  http://bugs.php.net/bug.php?id=16151

setlocale(): "Does it exist some way how to sort Czech texts inside arrays" Status:CLOSED
  http://bugs.php.net/bug.php?id=10749

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
randomly! 
> 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 :
<?php
  // setlocale(LC_ALL,"german"); // Commented out at first
  $in = "??????";
  $ser = wddx_serialize_value($in);
  $des = wddx_deserialize($ser);
  echo "<pre>";
  echo htmlspecialchars($ser) . "\n";
  var_dump($des);
  echo "</pre>";
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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 
   
   setlocale(LC_ALL,"ge"); 

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

<?php
echo setlocale(LC_ALL,"ge");
$in = "??????";
$ser = wddx_serialize_value($in);
$des = wddx_deserialize($ser);
echo "<pre>";
echo htmlspecialchars($ser) . "\n";
var_dump($des);
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.....:):):):)

bye
 [2002-06-17 07:40 UTC] hholzgra@php.net
looks like another setlocale/ZTS issue :(
 [2002-10-29 16:57 UTC] iliaa@php.net
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-2020 The PHP Group
All rights reserved.
Last updated: Fri Feb 21 01:01:26 2020 UTC