Skip to content

json_decode Failed to ignore incorrect utf8 #9858

@yinbug

Description

@yinbug

Description

When the following mixed text is included, json_decode Failed to ignore incorrect utf8.
Even if JSON_INVALID_UTF8_IGNORE

<?php
    $contents= '{"val": "测试 test  \uD83D\uDD17 \uD83D..."}';
     $body = json_decode($contents, true, 512,  JSON_INVALID_UTF8_IGNORE | JSON_THROW_ON_ERROR);

PHP Version

8.1.4

Operating System

All

Metadata

Metadata

Assignees

No one assigned

    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