Skip to content

Commit 75b86a2

Browse files
committed
Replace json.precision with serialize_precision
1 parent 3043be3 commit 75b86a2

File tree

3 files changed

+2
-40
lines changed

3 files changed

+2
-40
lines changed

ext/json/json.c

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -93,31 +93,6 @@ static const zend_function_entry json_serializable_interface[] = {
9393
};
9494
/* }}} */
9595

96-
97-
/* {{{ PHP_INI_MH
98-
*/
99-
static PHP_INI_MH(OnSetJsonPrecision)
100-
{
101-
zend_long i;
102-
103-
ZEND_ATOL(i, ZSTR_VAL(new_value));
104-
if (i >= -1) {
105-
JSON_G(precision) = i;
106-
return SUCCESS;
107-
} else {
108-
return FAILURE;
109-
}
110-
}
111-
/* }}} */
112-
113-
114-
/* {{{ PHP_INI
115-
*/
116-
PHP_INI_BEGIN()
117-
STD_PHP_INI_ENTRY("json.precision", "-1", PHP_INI_ALL, OnSetJsonPrecision, precision, zend_json_globals, json_globals)
118-
PHP_INI_END()
119-
/* }}} */
120-
12196
/* Register constant for options and errors */
12297
#define PHP_JSON_REGISTER_CONSTANT(_name, _value) \
12398
REGISTER_LONG_CONSTANT(_name, _value, CONST_CS | CONST_PERSISTENT);
@@ -127,8 +102,6 @@ static PHP_MINIT_FUNCTION(json)
127102
{
128103
zend_class_entry ce;
129104

130-
REGISTER_INI_ENTRIES();
131-
132105
INIT_CLASS_ENTRY(ce, "JsonSerializable", json_serializable_interface);
133106
php_json_serializable_ce = zend_register_internal_interface(&ce);
134107

@@ -180,16 +153,6 @@ static PHP_GINIT_FUNCTION(json)
180153
}
181154
/* }}} */
182155

183-
/* {{{ PHP_MSHUTDOWN_FUNCTION
184-
*/
185-
static PHP_MSHUTDOWN_FUNCTION(json)
186-
{
187-
UNREGISTER_INI_ENTRIES();
188-
189-
return SUCCESS;
190-
}
191-
/* }}} */
192-
193156

194157
/* {{{ json_module_entry
195158
*/
@@ -198,7 +161,7 @@ zend_module_entry json_module_entry = {
198161
"json",
199162
json_functions,
200163
PHP_MINIT(json),
201-
PHP_MSHUTDOWN(json),
164+
NULL,
202165
NULL,
203166
NULL,
204167
PHP_MINFO(json),

ext/json/json_encoder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static inline void php_json_encode_double(smart_str *buf, double d, int options)
105105
size_t len;
106106
char num[PHP_JSON_DOUBLE_MAX_LENGTH];
107107

108-
php_gcvt(d, (int)JSON_G(precision), '.', 'e', num);
108+
php_gcvt(d, (int)PG(serialize_precision), '.', 'e', num);
109109
len = strlen(num);
110110
if (options & PHP_JSON_PRESERVE_ZERO_FRACTION && strchr(num, '.') == NULL && len < PHP_JSON_DOUBLE_MAX_LENGTH - 2) {
111111
num[len++] = '.';

ext/json/php_json.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ typedef enum {
8181
#define PHP_JSON_PARSER_DEFAULT_DEPTH 512
8282

8383
ZEND_BEGIN_MODULE_GLOBALS(json)
84-
zend_long precision;
8584
int encoder_depth;
8685
int encode_max_depth;
8786
php_json_error_code error_code;

0 commit comments

Comments
 (0)