mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: libxml: Fix some deprecations regarding input buffer/parser handling
This commit is contained in:
4
NEWS
4
NEWS
@@ -28,6 +28,10 @@ PHP NEWS
|
||||
. Fixed bug GH-20502 (\Uri\WhatWg\Url crashes (SEGV) when parsing
|
||||
malformed URL due to Lexbor memory corruption). (lexborisov)
|
||||
|
||||
- LibXML:
|
||||
. Fix some deprecations on newer libxml versions regarding input
|
||||
buffer/parser handling. (ndossche)
|
||||
|
||||
- Opcache:
|
||||
. Fixed bug GH-20329 (opcache.file_cache broken with full interned string
|
||||
buffer). (Arnaud)
|
||||
|
||||
@@ -615,11 +615,10 @@ php_libxml_output_buffer_create_filename(const char *URI,
|
||||
}
|
||||
|
||||
/* Allocate the Output buffer front-end. */
|
||||
ret = xmlAllocOutputBuffer(encoder);
|
||||
if (ret != NULL) {
|
||||
ret->context = context;
|
||||
ret->writecallback = php_libxml_streams_IO_write;
|
||||
ret->closecallback = php_libxml_streams_IO_close;
|
||||
ret = xmlOutputBufferCreateIO(php_libxml_streams_IO_write, php_libxml_streams_IO_close, context, encoder);
|
||||
if (ret == NULL) {
|
||||
php_libxml_streams_IO_close(context);
|
||||
goto err;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -806,6 +805,7 @@ is_string:
|
||||
zend_string_release(callable_name);
|
||||
zval_ptr_dtor(&callable);
|
||||
} else {
|
||||
#if LIBXML_VERSION < 21400
|
||||
/* TODO: allow storing the encoding in the stream context? */
|
||||
xmlCharEncoding enc = XML_CHAR_ENCODING_NONE;
|
||||
xmlParserInputBufferPtr pib = xmlAllocParserInputBuffer(enc);
|
||||
@@ -824,6 +824,12 @@ is_string:
|
||||
xmlFreeParserInputBuffer(pib);
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* make stream not being closed when the zval is freed */
|
||||
GC_ADDREF(stream->res);
|
||||
ret = xmlNewInputFromIO(NULL, php_libxml_streams_IO_read, php_libxml_streams_IO_close, stream, 0);
|
||||
/* Note: if ret == NULL, the close operation will be executed, so don't DELREF stream->res upon failure! */
|
||||
#endif
|
||||
}
|
||||
} else if (Z_TYPE(retval) != IS_NULL) {
|
||||
/* retval not string nor resource nor null; convert to string */
|
||||
|
||||
Reference in New Issue
Block a user