php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #76712
Patch workaround revision 2018-08-06 22:08 UTC by cmb@php.net

Patch workaround for SimpleXML related Bug #76712

Patch version 2018-08-06 22:08 UTC

Return to Bug #76712 | Download this patch
Patch Revisions:

Developer: cmb@php.net

 ext/simplexml/simplexml.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 92e6de107a..e466260f9f 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -404,7 +404,9 @@ static void change_node_zval(xmlNodePtr node, zval *value)
 			buffer_len = xmlStrlen(buffer);
 			/* check for NULL buffer in case of memory error in xmlEncodeEntitiesReentrant */
 			if (buffer) {
-				xmlNodeSetContentLen(node, buffer, buffer_len);
+				if (buffer_len) {
+					xmlNodeSetContentLen(node, buffer, buffer_len);
+				}
 				xmlFree(buffer);
 			}
 			break;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 00:01:41 2024 UTC