Skip to content

parse json5 codes always thorw JsonException on set JSON_THROW_ON_ERROR #15

@inhere

Description

@inhere

Parse json5 codes always thorw JsonException on set JSON_THROW_ON_ERROR

Detailed description

if (PHP_VERSION_ID >= 70000) {
$result = \json_decode($source, $associative, $depth, $options);
if (\json_last_error() === \JSON_ERROR_NONE) {
return $result;
}
}

in the code L76, if php version > 7.0 and set option JSON_THROW_ON_ERROR.

always thorw JsonException and interrupt subsequent processing

Your environment

Include as many relevant details about the environment you experienced the bug in and how to reproduce it.

  • Library version used (e.g. 1.0)
  • PHP version used (e.g. PHP 5.6, PHP 7.0): PHP 7.0+
  • Operating system and version (e.g. Ubuntu 16.04, Windows 7):

I think should auto remove JSON_THROW_ON_ERROR option on php > 7.0 in:

if (PHP_VERSION_ID >= 70000) { 
	// auto remove JSON_THROW_ON_ERROR option before call json_decode()
	
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions