[php-src] Issue #23876: `json_decode()`: `JSON_INVALID_UTF8_*` flags should be mutually exclusive
| From: | DanielEScherzer | Date: | Thu, 24 Sep 2026 02:14:53 +0000 |
| Subject: | [php-src] Issue #23876: `json_decode()`: `JSON_INVALID_UTF8_*` flags should be mutually exclusive | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-252812@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/23876
Author: DanielEScherzer
### Description
The following code:
```php
<?php
var_dump( json_decode( "\"a\xb0b\"", null, 512, JSON_INVALID_UTF8_IGNORE ) );
var_dump( json_decode( "\"a\xb0b\"", null, 512, JSON_INVALID_UTF8_SUBSTITUTE )
);
var_dump( json_decode( "\"a\xb0b\"", null, 512, JSON_INVALID_UTF8_IGNORE |
JSON_INVALID_UTF8_SUBSTITUTE ) );
```
Resulted in this output:
```
string(2) "ab"
string(5) "a�b"
string(5) "a�b"
```
But I expected this output instead:
```
string(2) "ab"
string(5) "a�b"
<some kind of ValueError>
```
### PHP Version
```plain
PHP 8.5.10, 3v4l
```
### Operating System
_No response_