#26470 [Opn->Csd]: setlocale(): Difference between 0 and NULL locale
| From: | vrana@php.net | Date: | Thu, 16 Sep 2004 14:14:50 +0000 |
| Subject: | #26470 [Opn->Csd]: setlocale(): Difference between 0 and NULL locale | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969364134@lists.php.net to get a copy of this message | ||
ID: 26470
Updated by: vrana@php.net
Reported By: mail at ulrich-voelkel dot de
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Gentoo Linux
PHP Version: 4.3.3
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Null is equivalent to '', not '0'.
Previous Comments:
------------------------------------------------------------------------
[2004-03-28 11:16:04] mailling at gmx dot co dot uk
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))
------------------------------------------------------------------------
[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