1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.3' into PHP-8.4

* PHP-8.3:
  libxml: Fix some deprecations regarding input buffer/parser handling
This commit is contained in:
Niels Dossche
2025-11-18 18:53:44 +01:00
2 changed files with 15 additions and 5 deletions

4
NEWS
View File

@@ -26,6 +26,10 @@ PHP NEWS
. Fixed bug GH-20483 (ASAN stack overflow with fiber.stack_size INI
small value). (David Carlier)
- 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)

View File

@@ -611,11 +611,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);
@@ -802,6 +801,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);
@@ -820,6 +820,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 */