最近PHP 7.0.4とnginx 1.8.1にアップグレードしましたが、私のアプリケーションはZend Framework(Magento 1.9.2.1)を使用しています。そのアップグレード以来、当社の顧客は時々、「復号化が失敗しました:構文エラー」を取得PHP7、JSON、Zend(デコードに失敗しました:構文エラー)
public static function decode($encodedValue, $objectDecodeType = Zend_Json::TYPE_ARRAY)
{
$encodedValue = (string) $encodedValue;
if (function_exists('json_decode') && self::$useBuiltinEncoderDecoder !== true) {
$decode = json_decode($encodedValue, $objectDecodeType);
// php < 5.3
if (!function_exists('json_last_error')) {
if (strtolower($encodedValue) === 'null') {
return null;
} elseif ($decode === null) {
#require_once 'Zend/Json/Exception.php';
throw new Zend_Json_Exception('Decoding failed');
}
// php >= 5.3
} elseif (($jsonLastErr = json_last_error()) != JSON_ERROR_NONE) {
#require_once 'Zend/Json/Exception.php';
switch ($jsonLastErr) {
case JSON_ERROR_DEPTH:
throw new Zend_Json_Exception('Decoding failed: Maximum stack depth exceeded');
case JSON_ERROR_CTRL_CHAR:
throw new Zend_Json_Exception('Decoding failed: Unexpected control character found');
case JSON_ERROR_SYNTAX:
throw new Zend_Json_Exception('Decoding failed: Syntax error');
default:
throw new Zend_Json_Exception('Decoding failed');
}
}
return $decode;
}
にスローされordermを提出するとき、私は空の文字列をエンコードする際にPHP7とJSONデコードが異なった動作をバグについて読みました。このバグがPHP7や私のアプリケーション/サーバーに関係しているかどうかは誰にも分かりますか?
おかげ