Fixes #11125: Fixed JSON_ERROR_SYNTAX for json_decode(null) in PHP 7

This commit is contained in:
fps01
2016-03-15 20:51:16 +03:00
committed by Alexander Makarov
parent d3b5f4a284
commit 258175149d
2 changed files with 3 additions and 0 deletions

View File

@ -14,6 +14,7 @@ Yii Framework 2 Change Log
- Bug #10974: `yii.js` - fixed error in ajaxPrefilter event handler, caused by blocked frame (maximal)
- Bug #11038: Fixed handling of intervals of 0 seconds in `yii\i18n\Formatter::asDuration()` (VirtualRJ)
- Bug #11093: Fixed `yii\db\QueryBuilder::buildAndCondition()` to add query params passed directly by `yii\db\Expression` (CedricYii, silverfire)
- Bug #11125: Fixed `JSON_ERROR_SYNTAX` for `json_decode(null)` in PHP 7 (fps01)
- Bug: SQlite querybuilder did not create primary key with bigint for `TYPE_BIGPK` (cebe)
- Enh #5469: Add mimetype validation by mask in FileValidator (kirsenn, samdark, silverfire)
- Enh #8602: `yii\validators\DateValidator` skip validation for `timestampAttribute`, if it is already in correct format (klimov-paul)

View File

@ -90,6 +90,8 @@ class BaseJson
{
if (is_array($json)) {
throw new InvalidParamException('Invalid JSON data.');
} elseif ($json === null || $json === '') {
return null;
}
$decode = json_decode((string) $json, $asArray);
static::handleJsonError(json_last_error());