Skip to content

Instantly share code, notes, and snippets.

@adamransome
Forked from tassoevan/libxml29_compat.patch
Created March 9, 2017 14:43
Show Gist options
  • Save adamransome/706b6fb758d81e8e69c34e5bed0b1658 to your computer and use it in GitHub Desktop.
Save adamransome/706b6fb758d81e8e69c34e5bed0b1658 to your computer and use it in GitHub Desktop.
Install PHP 5.2.17 in phpbrew
--- ext/dom/node.c 2012-08-06 17:49:48.826716692 +0800
+++ ext/dom/node.c 2012-08-06 17:52:47.633484660 +0800
@@ -1895,9 +1895,17 @@ static void dom_canonicalization(INTERNA
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();
}
--- ext/dom/documenttype.c 2012-08-06 18:02:16.019640870 +0800
+++ ext/dom/documenttype.c 2012-08-06 18:06:16.612228905 +0800
@@ -205,7 +205,13 @@ int dom_documenttype_internal_subset_rea
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;
}
--- ext/simplexml/simplexml.c 2012-08-06 18:10:44.621017026 +0800
+++ ext/simplexml/simplexml.c 2012-08-06 18:12:48.016270419 +0800
@@ -1417,7 +1417,12 @@ SXE_METHOD(asXML)
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 {
--- ext/openssl/xp_ssl.c 2015-10-07 17:19:55.710935804 -0300
+++ ext/openssl/xp_ssl.c 2015-10-07 17:23:12.723383144 -0300
@@ -332,10 +332,12 @@
sslsock->is_client = 1;
method = SSLv23_client_method();
break;
+#ifndef OPENSSL_NO_SSL2
case STREAM_CRYPTO_METHOD_SSLv2_CLIENT:
sslsock->is_client = 1;
method = SSLv2_client_method();
break;
+#endif
case STREAM_CRYPTO_METHOD_SSLv3_CLIENT:
sslsock->is_client = 1;
method = SSLv3_client_method();
@@ -352,10 +354,12 @@
sslsock->is_client = 0;
method = SSLv3_server_method();
break;
+#ifndef OPENSSL_NO_SSL2
case STREAM_CRYPTO_METHOD_SSLv2_SERVER:
sslsock->is_client = 0;
method = SSLv2_server_method();
break;
+#endif
case STREAM_CRYPTO_METHOD_TLS_SERVER:
sslsock->is_client = 0;
method = TLSv1_server_method();
@@ -579,9 +583,11 @@
case STREAM_CRYPTO_METHOD_SSLv23_CLIENT:
sock->method = STREAM_CRYPTO_METHOD_SSLv23_SERVER;
break;
+#ifndef OPENSSL_NO_SSL2
case STREAM_CRYPTO_METHOD_SSLv2_CLIENT:
sock->method = STREAM_CRYPTO_METHOD_SSLv2_SERVER;
break;
+#endif
case STREAM_CRYPTO_METHOD_SSLv3_CLIENT:
sock->method = STREAM_CRYPTO_METHOD_SSLv3_SERVER;
break;
@@ -813,9 +819,11 @@
if (strncmp(proto, "ssl", protolen) == 0) {
sslsock->enable_on_connect = 1;
sslsock->method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT;
+#ifndef OPENSSL_NO_SSL2
} else if (strncmp(proto, "sslv2", protolen) == 0) {
sslsock->enable_on_connect = 1;
sslsock->method = STREAM_CRYPTO_METHOD_SSLv2_CLIENT;
+#endif
} else if (strncmp(proto, "sslv3", protolen) == 0) {
sslsock->enable_on_connect = 1;
sslsock->method = STREAM_CRYPTO_METHOD_SSLv3_CLIENT;
$ phpbrew install http://museum.php.net/php5/php-5.2.17.tar.bz2 +default # it will fail
$ cd ~/.phpbrew/build/php-5.2.17
$ patch -p0 < ~/Downloads/openssl.patch
$ patch -p0 < ~/Downloads/libxml29_compat.patch
$ make
$ make install
$ phpbrew use 5.2.17
$ cd ext
$ wget http://xdebug.org/files/xdebug-2.2.1.tgz
$ tar xvf xdebug-2.2.1.tgz
$ mv xdebug-2.2.1 xdebug
$ rm xdebug-2.2.1.tgz
$ cd xdebug
$ phpbrew use 5.2.17
$ phpize
$ ./configure --enable-xdebug
$ make
$ make install
$ echo "zend_extension=$(readlink -f ~/.phpbrew/php/php-5.2.17/lib/php/extensions/no-debug-non-zts-*/xdebug.so)" > ~/.phpbrew/php/php-5.2.17/etc/php.ini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment