Skip to content

setlocale's 2nd and 3rd argument ignores strict_types #18823

@divinity76

Description

@divinity76

Description

The following code:

<?php
declare(strict_types=1);
try{
setlocale(LC_ALL, 0,"0"); // 2nd argument is a strict_types violation
}finally{
setlocale(LC_ALL, "0",0); // 3rd argument is a strict_types violation
}

Resulted in this output:

But I expected this output instead:

Uncaught TypeError: setlocale(): Argument #2 ($locales) must be of type string, int given in /in/dqfQT:4
Uncaught TypeError: setlocale(): Argument #3 ($rest) must be of type string, int given in /in/dqfQT:6

PHP Version

PHP8.4.8

Operating System

WSL Ubuntu 24.04

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions