cvs: /php4/ext/xml xml.c

From: Date: Wed, 20 Oct 1999 14:58:36 +0000
Subject: cvs: /php4/ext/xml xml.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-5600@lists.php.net to get a copy of this message
thies Wed Oct 20 10:58:36 1999 EDT Modified files: /php4/ext/xml xml.c Log: (PHP xml_parse_into_struct) sometimes the value was truncated Index: php4/ext/xml/xml.c diff -u php4/ext/xml/xml.c:1.27 php4/ext/xml/xml.c:1.28 --- php4/ext/xml/xml.c:1.27 Wed Oct 20 10:02:32 1999 +++ php4/ext/xml/xml.c Wed Oct 20 10:58:03 1999 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xml.c,v 1.27 1999/10/20 14:02:32 thies Exp $ */ +/* $Id: xml.c,v 1.28 1999/10/20 14:58:03 thies Exp $ */ #define IS_EXT_MODULE #if COMPILE_DL @@ -814,7 +814,19 @@ } if (doprint || (! parser->skipwhite)) { if (parser->lastwasopen) { - add_assoc_string(*(parser->ctag),"value",decoded_value,0); + zval **myval; + + /* check if the current tag already has a value - if yes append to that! */ + if (zend_hash_find((*parser->ctag)->value.ht,"value",sizeof("value"),(void **) &myval) == SUCCESS) { + int newlen = (*myval)->value.str.len + decoded_len; + (*myval)->value.str.val = erealloc((*myval)->value.str.val,newlen); + strcpy((*myval)->value.str.val + (*myval)->value.str.len,decoded_value); + (*myval)->value.str.len += decoded_len; + efree(decoded_value); + } else { + add_assoc_string(*(parser->ctag),"value",decoded_value,0); + } + } else { zval *tag; @@ -828,7 +840,7 @@ add_assoc_string(tag,"value",decoded_value,0); add_assoc_string(tag,"type","cdata",1); add_assoc_long(tag,"level",parser->level); - + zend_hash_next_index_insert(parser->data->value.ht,&tag,sizeof(zval*),NULL); } } else {

« previous php.version4 (#5600) next »