> Le 28 oct. 2025 à 16:52, Marc Henderkes <[email protected]> a écrit :
> 
> Hello everyone,
>  
> We recently noticed that the setlocale function currently uses `setlocale` in 
> its C implementation as well [https://github.com/php/frankenphp/pull/1941], 
> which is a) not multithreading safe to use and b) when it doesn’t crash, 
> leads to overriding the current locale for the entire process.
> For NTS builds with php-fpm this is not an issue, but for FrankenPHP and 
> mod_php, this leads to unexpected behaviour described here: 
> https://github.com/php/frankenphp/pull/1941#issuecomment-3457137937
> 
> On Windows builds, since PHP 7, it is already per-thread, but on POSIX 
> systems it is not.
> 
> I would therefore like to get your reactions on whether it would make sense 
> to unify the behaviour between POSIX systems and Windows and make the 
> `setlocale()` function thread-safe and per-thread, rather than per-process.
> In case my proposal sees positive reception, I’d like to go ahead and create 
> an RFC. I will also implement the changes in php-src, I’ve already done so as 
> a proof of concept.
> 
> Thank you for your time,
> Marc Henderkes

Hi,

From my point of view, the current behaviour (not thread-safe and not 
per-thread) is obviously a bug, not a feature. I assume that there is no need 
to create an RFC for fixing a bug?

—Claude

Reply via email to