diff options
-rw-r--r-- | ext/json/json_scanner.re | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/json/json_scanner.re b/ext/json/json_scanner.re index 99e63bbb41..79df12413c 100644 --- a/ext/json/json_scanner.re +++ b/ext/json/json_scanner.re @@ -234,16 +234,16 @@ std: return PHP_JSON_T_ERROR; } <STR_P1>["] { - char *str; + zend_string *str; size_t len = s->cursor - s->str_start - s->str_esc - 1; if (len == 0) { PHP_JSON_CONDITION_SET(JS); ZVAL_EMPTY_STRING(&s->value); return PHP_JSON_T_ESTRING; } - str = emalloc(len + 1); - str[len] = 0; - ZVAL_STRINGL(&s->value, str, len); + str = zend_string_alloc(len, 0); + str->val[len] = '\0'; + ZVAL_STR(&s->value, str); if (s->str_esc) { s->pstr = (php_json_ctype *) Z_STRVAL(s->value); s->cursor = s->str_start; |