File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed
Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ private static function saveFile($file, $json)
114114 */
115115 private static function jsonLastErrorCollections ()
116116 {
117- return [
117+ $ collections = [
118118 JSON_ERROR_NONE => null ,
119119 JSON_ERROR_DEPTH => [
120120 'message ' => 'Maximum stack depth exceeded ' ,
@@ -148,19 +148,25 @@ private static function jsonLastErrorCollections()
148148 'message ' => 'Type value given cannot be encoded ' ,
149149 'error-code ' => 8 ,
150150 ],
151- JSON_ERROR_INVALID_PROPERTY_NAME => [
152- 'message ' => 'Name value given cannot be encoded ' ,
153- 'error-code ' => 9 ,
154- ],
155- JSON_ERROR_UTF16 => [
156- 'message ' => 'Malformed UTF-16 characters ' ,
157- 'error-code ' => 10 ,
158- ],
159151 'default ' => [
160152 'message ' => 'Unknown error ' ,
161153 'error-code ' => 999 ,
162154 ],
163155 ];
156+
157+ if (version_compare (PHP_VERSION , '7.0.0 ' , '>= ' ))
158+ {
159+ $ collections [JSON_ERROR_INVALID_PROPERTY_NAME ] = [
160+ 'message ' => 'Name value given cannot be encoded ' ,
161+ 'error-code ' => 9 ,
162+ ];
163+ $ collections [JSON_ERROR_UTF16 ] = [
164+ 'message ' => 'Malformed UTF-16 characters ' ,
165+ 'error-code ' => 10 ,
166+ ];
167+ }
168+
169+ return $ collections ;
164170 }
165171
166172 /**
You can’t perform that action at this time.
0 commit comments