Skip to content

Incorrect error column in PHP 8.6 JSON parser #22514

Description

@TimWolla

Description

The following code:

<?php

var_dump(json_decode('
{"\u00FF"_'));/*
1234567890 */
var_dump(json_last_error_msg());

Resulted in this output:

NULL
string(30) "Syntax error near location 2:5"

But I expected this output instead:

NULL
string(30) "Syntax error near location 2:10"

see #22487 (comment)

PHP Version

PHP 8.6.0-dev (cli) (built: Jun 29 2026 19:08:37) (NTS DEBUG)
Copyright © The PHP Group and Contributors
Zend Engine v4.6.0-dev, Copyright © Zend by Perforce
    with Zend OPcache v8.6.0-dev, Copyright ©, by Zend by Perforce

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions