File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,24 +86,16 @@ public function setData($data = [])
8686 */
8787 protected function hasValidJson ($ jsonError )
8888 {
89- // No error is obviously fine
9089 if ($ jsonError === JSON_ERROR_NONE ) {
9190 return true ;
9291 }
9392
94- // If the JSON_PARTIAL_OUTPUT_ON_ERROR option is set, some additional errors are fine
95- // (see https://secure.php.net/manual/en/json.constants.php)
96- if ($ this ->hasEncodingOption (JSON_PARTIAL_OUTPUT_ON_ERROR )) {
97- $ acceptableErrors = [
98- JSON_ERROR_RECURSION ,
99- JSON_ERROR_INF_OR_NAN ,
100- JSON_ERROR_UNSUPPORTED_TYPE ,
101- ];
102-
103- return \in_array ($ jsonError , $ acceptableErrors );
104- }
105-
106- return false ;
93+ return $ this ->hasEncodingOption (JSON_PARTIAL_OUTPUT_ON_ERROR ) &&
94+ in_array ($ jsonError , [
95+ JSON_ERROR_RECURSION ,
96+ JSON_ERROR_INF_OR_NAN ,
97+ JSON_ERROR_UNSUPPORTED_TYPE ,
98+ ]);
10799 }
108100
109101 /**
You can’t perform that action at this time.
0 commit comments