forked from gentlero/bitbucket-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
polyfill-55.php
34 lines (33 loc) · 1.15 KB
/
polyfill-55.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* Copyright 2015 - 2016 Alexandru Guzinschi <alex@gentle.ro>
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
/**
* Provides functions unavailable in PHP releases prior to v5.5
*/
if (PHP_VERSION_ID < 50500) {
if (!function_exists('json_last_error_msg')) {
function json_last_error_msg()
{
switch (json_last_error()) {
case JSON_ERROR_NONE:
return 'No error';
case JSON_ERROR_DEPTH:
return 'Maximum stack depth exceeded';
case JSON_ERROR_STATE_MISMATCH:
return 'State mismatch (invalid or malformed JSON)';
case JSON_ERROR_CTRL_CHAR:
return 'Control character error, possibly incorrectly encoded';
case JSON_ERROR_SYNTAX:
return 'Syntax error';
case JSON_ERROR_UTF8:
return 'Malformed UTF-8 characters, possibly incorrectly encoded';
default:
return 'Unknown error';
}
}
}
}