php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #55173 Locale::setDefault never failed
Submitted: 2011-07-11 05:03 UTC Modified: 2021-02-01 13:45 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: jinmoku at hotmail dot com Assigned: cmb (profile)
Status: Closed Package: I18N and L10N related
PHP Version: Next major version OS: *
Private report: No CVE-ID: None
 [2011-07-11 05:03 UTC] jinmoku at hotmail dot com
Description:
------------
Locale::setDefault never failed even with wrong value

Test script:
---------------
var_dump(Locale::setDefault(''));
var_dump(Locale::setDefault(null));
var_dump(Locale::setDefault(false));
var_dump(Locale::setDefault(true));
var_dump(Locale::setDefault('en_US'));

Expected result:
----------------
bool(false)
bool(false)
bool(false)
bool(false)
bool(true)

Actual result:
--------------
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-11 05:49 UTC] jinmoku at hotmail dot com
you don't use uloc_setDefault  ???
 [2015-06-24 21:17 UTC] cmb@php.net
-Status: Open +Status: Verified -Operating System: Win 7 +Operating System: * -PHP Version: 5.3.6 +PHP Version: 5.6.10
 [2015-06-24 21:17 UTC] cmb@php.net
Basically, Locale::setDefault($string) behaves the same as
ini_set('intl.default_locale', $string)[1].

It is arguable whether this is a bug, but at least the
documentation regarding the return value should be improved.

[1] <http://3v4l.org/A3ooa>
 [2018-08-11 18:46 UTC] carusogabriel@php.net
`Locale::setDefault` has always true return: http://git.php.net/?p=php-src.git;a=blob;f=ext/intl/locale/locale_methods.c;hb=HEAD#l248

Might be interesting drop this and make it void in the next PHP version, as it's considered a BC.
 [2018-09-21 05:46 UTC] carusogabriel@php.net
-PHP Version: 5.6.10 +PHP Version: Next major version -Assigned To: +Assigned To: carusogabriel
 [2018-09-21 05:46 UTC] carusogabriel@php.net
-Status: Verified +Status: Assigned
 [2020-10-25 20:02 UTC] carusogabriel@php.net
-Assigned To: carusogabriel +Assigned To:
 [2021-02-01 13:45 UTC] cmb@php.net
-Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: cmb
 [2021-02-01 13:45 UTC] cmb@php.net
Makes no sense to leave this ticket open, so I'm changing to doc
problem.
 [2021-02-01 14:07 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=070bd3d0770c15b8e6a64c3b299c7b9eefc78002
Log: Fix #55173: Locale::setDefault never failed
 [2021-02-01 14:07 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 [2021-02-02 04:26 UTC] mumumu@php.net
Automatic comment on behalf of mumumu@mumumu.org
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=2ba372c737f0121d8c2f09d78273dad45e095487
Log: Fix #55173: Locale::setDefault never failed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 20:01:29 2024 UTC