ID:               26470
 Comment by:       mailling at gmx dot co dot uk
 Reported By:      mail at ulrich-voelkel dot de
 Status:           Open
 Bug Type:         Documentation problem
 Operating System: Gentoo Linux
 PHP Version:      4.3.3
 New Comment:

I think that you get with null the default locale, based on the
original value when you start php (changing with putenv the LANG or the
LANGUAGE variable doesn't change the behavior or setlocale(LC_ALL,
null))


Previous Comments:
------------------------------------------------------------------------

[2003-11-30 01:12:01] mail at ulrich-voelkel dot de

Description:
------------
Hi there!



On http://de.php.net/manual/en/function.setlocale.php

the description of "string setlocale ( mixed category, array locale)"
says

"If locale is NULL or "0", the locale setting is not affected, only the
current setting is returned."



On my Gentoo Box I figured out that giving "NULL" behaves different to
"0".

After setting the LC_ALL from the C locale to "de_DE" (or anything
else) "setlocale(LC_ALL, 0)" worked correctly and returnd all locale
Variables with their values set to "de_DE" (as expected). Refering to
the Documentation I expected the same result from "setlocale(LC_ALL,
NULL) but I didn`t get it.

It just set all locale vaiables back to the default C Value.



Thanks for your efforts,

Uli

Reproduce code:
---------------
<?php                                                                  
             

echo "Default locale: " . setlocale(LC_ALL, 0) . "<br />";

setlocale(LC_ALL, "de_DE");                                            
                                   

$locales = explode(";", setlocale(LC_ALL, NULL));                      
                                                         

echo "New locale: ";

print_r($locales);                                                     
                          

?>

Expected result:
----------------
Default locale: C

New locale: Array ( [0] => LC_CTYPE=de_DE [1] => LC_NUMERIC=C [2] =>
LC_TIME=de_DE [3] => LC_COLLATE=de_DE [4] => LC_MONETARY=de_DE [5] =>
LC_MESSAGES=de_DE [6] => LC_PAPER=de_DE [7] => LC_NAME=de_DE [8] =>
LC_ADDRESS=de_DE [9] => LC_TELEPHONE=de_DE [10] => LC_MEASUREMENT=de_DE
[11] => LC_IDENTIFICATION=de_DE )

Actual result:
--------------
Default locale: C

New locale: Array ( [0] => C )


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=26470&edit=1

Reply via email to