php / php/doc-en

Explain that C is the default locale

Open
#1,842 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
XML
Stars
596
Forks
890
Avg merge
1d 15h
Merged PRs (30d)
55

Description

Hello,

Maybe on setlocale() page, explains that C is now the default locale and that setting one is not recommended anymore. Recommend to use Locale::setDefault() from Intl and mbstring instead, according to https://wiki.php.net/rfc/strtolower-ascii#why_do_applications_call_setlocale

Locale sensitivity is not useful for natural language processing in new code. We have the intl and mbstring extensions for that.

PHP libraries distributed with Packagist or PEAR cannot assume a particular locale. Setting the locale temporarily is discouraged by the PHP manual, because the locale is a true global and will influence other threads in a multithreaded SAPI. So libraries have a choice of either reimplementing these core string functions, or just calling them and hoping.

And https://www.php.net/manual/fr/migration80.incompatible.php#migration80.incompatible.standard

The default locale on startup is now always "C". No locales are inherited from the environment by default. Previously, LC_ALL was set to "C", while LC_CTYPE was inherited from the environment. However, some functions did not respect the inherited locale without an explicit setlocale() call. An explicit setlocale() call is now always required if a locale component should be changed from the default.

Regards,

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the setlocale() manual page, then read the linked PHP 8.0 migration note and RFC section for context. Update the documentation to explain that C is the default locale and to recommend Intl's Locale::setDefault() and mbstring for locale-sensitive work; done when these points are clearly reflected on the relevant page.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.