diff options
Diffstat (limited to 'ext/json/json_encoder.c')
-rw-r--r-- | ext/json/json_encoder.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/json/json_encoder.c b/ext/json/json_encoder.c index d9bfb16e5b..c3aa348626 100644 --- a/ext/json/json_encoder.c +++ b/ext/json/json_encoder.c @@ -169,7 +169,7 @@ static void php_json_encode_array(smart_str *buf, zval *val, int options) /* {{{ php_json_encode(buf, data, options); } else if (r == PHP_JSON_OUTPUT_OBJECT) { if (key) { - if (key->val[0] == '\0' && Z_TYPE_P(val) == IS_OBJECT) { + if (ZSTR_VAL(key)[0] == '\0' && Z_TYPE_P(val) == IS_OBJECT) { /* Skip protected and private members. */ if (tmp_ht && ZEND_HASH_APPLY_PROTECTION(tmp_ht)) { ZEND_HASH_DEC_APPLY_COUNT(tmp_ht); @@ -186,7 +186,7 @@ static void php_json_encode_array(smart_str *buf, zval *val, int options) /* {{{ php_json_pretty_print_char(buf, options, '\n'); php_json_pretty_print_indent(buf, options); - php_json_escape_string(buf, key->val, key->len, options & ~PHP_JSON_NUMERIC_CHECK); + php_json_escape_string(buf, ZSTR_VAL(key), ZSTR_LEN(key), options & ~PHP_JSON_NUMERIC_CHECK); smart_str_appendc(buf, ':'); php_json_pretty_print_char(buf, options, ' '); @@ -313,7 +313,7 @@ static void php_json_escape_string(smart_str *buf, char *s, size_t len, int opti } pos = 0; - checkpoint = buf->s ? buf->s->len : 0; + checkpoint = buf->s ? ZSTR_LEN(buf->s) : 0; /* pre-allocate for string length plus 2 quotes */ smart_str_alloc(buf, len+2, 0); @@ -326,7 +326,7 @@ static void php_json_escape_string(smart_str *buf, char *s, size_t len, int opti us = php_next_utf8_char((const unsigned char *)s, len, &pos, &status); if (status != SUCCESS) { if (buf->s) { - buf->s->len = checkpoint; + ZSTR_LEN(buf->s) = checkpoint; } JSON_G(error_code) = PHP_JSON_ERROR_UTF8; smart_str_appendl(buf, "null", 4); @@ -464,7 +464,7 @@ static void php_json_encode_serializable_object(smart_str *buf, zval *val, int o ZVAL_STRING(&fname, "jsonSerialize"); if (FAILURE == call_user_function_ex(EG(function_table), val, &fname, &retval, 0, NULL, 1, NULL) || Z_TYPE(retval) == IS_UNDEF) { - zend_throw_exception_ex(NULL, 0, "Failed calling %s::jsonSerialize()", ce->name->val); + zend_throw_exception_ex(NULL, 0, "Failed calling %s::jsonSerialize()", ZSTR_VAL(ce->name)); smart_str_appendl(buf, "null", sizeof("null") - 1); zval_ptr_dtor(&fname); return; |