Skip to content

Commit 1f38e3e

Browse files
committed
Simplify JSON bigint detection
See jublo#223.
1 parent 6c64bb3 commit 1f38e3e

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ codebird-php - changelog
2323
- Remove contributor API methods
2424
- Remove deprecated statuses/update_with_media method
2525
- Remove deprecated statuses/update_profile_background_image method
26+
+ #223 Simplify JSON bigint handling
2627

2728
3.1.0 (2016-02-15)
2829
+ #143 Add support for proxy types

src/codebird.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,10 +1048,7 @@ protected function _json_decode($data, $need_array = false)
10481048
if (!(defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) {
10491049
return json_decode($data, $need_array, 512, JSON_BIGINT_AS_STRING);
10501050
}
1051-
$max_int_length = strlen((string) PHP_INT_MAX) - 1;
1052-
$json_without_bigints = preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $data);
1053-
$obj = json_decode($json_without_bigints, $need_array);
1054-
return $obj;
1051+
return json_decode($data, $need_array);
10551052
}
10561053

10571054
/**

0 commit comments

Comments
 (0)