From: Xinchen Hui Date: Mon, 5 May 2014 11:45:50 +0000 (+0800) Subject: Fixed Reference handling in xml_parse_into_struct X-Git-Tag: POST_PHPNG_MERGE~412^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa6f6c880741ae9696a9c21707fd3a844dd8d5ee;p=php Fixed Reference handling in xml_parse_into_struct --- diff --git a/ext/json/json.c b/ext/json/json.c index 528764e17c..7760741125 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -380,7 +380,6 @@ static int json_utf8_to_utf16(unsigned short *utf16, char utf8[], int len) /* {{ } /* }}} */ - static void json_escape_string(smart_str *buf, char *s, int len, int options TSRMLS_DC) /* {{{ */ { int pos = 0, ulen = 0; @@ -538,7 +537,6 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR } /* }}} */ - static void json_encode_serializable_object(smart_str *buf, zval *val, int options TSRMLS_DC) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(val); @@ -754,7 +752,6 @@ PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, } /* }}} */ - /* {{{ proto string json_encode(mixed data [, int options[, int depth]]) Returns the JSON representation of a value */ static PHP_FUNCTION(json_encode) diff --git a/ext/xml/xml.c b/ext/xml/xml.c index 146ff004f7..169be95981 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -679,7 +679,7 @@ static void _xml_add_to_info(xml_parser *parser,char *name) return; } - if ((element = zend_hash_str_find(Z_ARRVAL(parser->info),name, strlen(name))) == NULL) { + if ((element = zend_hash_str_find(Z_ARRVAL(parser->info), name, strlen(name))) == NULL) { zval values; array_init(&values); element = zend_hash_str_update(Z_ARRVAL(parser->info), name, strlen(name), &values); @@ -1407,8 +1407,9 @@ PHP_FUNCTION(xml_parse_into_struct) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsz|z", &pind, &data, &data_len, &xdata, &info) == FAILURE) { return; } - + if (info) { + ZVAL_DEREF(info); zval_ptr_dtor(info); array_init(info); }