Skip to content

Instantly share code, notes, and snippets.

@noomz
Created June 29, 2015 07:38
Show Gist options
  • Save noomz/7b1747fb05a941b91ebe to your computer and use it in GitHub Desktop.
Save noomz/7b1747fb05a941b91ebe to your computer and use it in GitHub Desktop.
diff -ubr php-5.3.10/ext/dom/documenttype.c ../php-5.3.10/ext/dom/documenttype.c
--- php-5.3.10/ext/dom/documenttype.c 2012-01-01 20:15:04.000000000 +0700
+++ ../php-5.3.10/ext/dom/documenttype.c 2015-06-29 14:31:37.945789850 +0700
@@ -205,7 +205,11 @@
if (buff != NULL) {
xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
xmlOutputBufferFlush(buff);
+#ifdef LIBXML2_NEW_BUFFER
+ ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff), 1);
+#else
ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1);
+#endif
(void)xmlOutputBufferClose(buff);
return SUCCESS;
}
diff -ubr php-5.3.10/ext/dom/node.c ../php-5.3.10/ext/dom/node.c
--- php-5.3.10/ext/dom/node.c 2012-01-01 20:15:04.000000000 +0700
+++ ../php-5.3.10/ext/dom/node.c 2015-06-29 14:32:56.837789561 +0700
@@ -1895,9 +1895,17 @@
RETVAL_FALSE;
} else {
if (mode == 0) {
+#ifdef LIBXML2_NEW_BUFFER
+ ret = xmlOutputBufferGetSize(buf);
+#else
ret = buf->buffer->use;
+#endif
if (ret > 0) {
+#ifdef LIBXML2_NEW_BUFFER
+ RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret, 1);
+#else
RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
+#endif
} else {
RETVAL_EMPTY_STRING();
}
diff -ubr php-5.3.10/ext/simplexml/simplexml.c ../php-5.3.10/ext/simplexml/simplexml.c
--- php-5.3.10/ext/simplexml/simplexml.c 2012-01-01 20:15:04.000000000 +0700
+++ ../php-5.3.10/ext/simplexml/simplexml.c 2015-06-29 14:33:43.709789389 +0700
@@ -1387,7 +1387,11 @@
xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, ((xmlDocPtr) sxe->document->ptr)->encoding);
xmlOutputBufferFlush(outbuf);
+#ifdef LIBXML2_NEW_BUFFER
+ RETVAL_STRINGL((char *)xmlOutputBufferGetContent(outbuf), xmlOutputBufferGetSize(outbuf), 1);
+#else
RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use, 1);
+#endif
xmlOutputBufferClose(outbuf);
}
} else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment