Skip to content

Missing JSON_ERROR_ constant mapping in JsonErrorException #499

@mfn

Description

@mfn

Summary of problem

PHP7 introduced two new JSON_ERROR_* constants. They are currently not documented at php.net (see bug report).

These are:

$ php -v
PHP 7.0.12-1+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
$ php -r 'var_dump(JSON_ERROR_INVALID_PROPERTY_NAME);'
int(9)
$ php -r 'var_dump(JSON_ERROR_UTF16);'
int(10)

This numbers are currently not handled in \Elasticsearch\Common\Exceptions\Serializer\JsonErrorException, leading to a generic e.g. 10 is not a valid JSON error code. message (which today I received due some weird ES response).

System details

  • PHP Version: PHP 7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions