diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index d4ea952f8a8..aed8702b30e 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -333,11 +333,11 @@ PHP_LIBXML_API void php_libxml_node_free_list(xmlNodePtr node) if (curnode->type == XML_ELEMENT_NODE) { /* This ensures that namespace references in this subtree are defined within this subtree, * otherwise a use-after-free would be possible when the original namespace holder gets freed. */ - php_libxml_node_ptr *ptr = curnode->_private; + const php_libxml_node_ptr *ptr = curnode->_private; /* Checking in case it runs out of reference */ if (ptr->_private) { - php_libxml_node_object *obj = ptr->_private; + const php_libxml_node_object *obj = ptr->_private; if (!obj->document || obj->document->class_type < PHP_LIBXML_CLASS_MODERN) { xmlReconciliateNs(curnode->doc, curnode); } @@ -524,7 +524,7 @@ php_libxml_input_buffer_create_filename(const char *URI, xmlCharEncoding enc) /* Check if there's been an external transport protocol with an encoding information */ if (enc == XML_CHAR_ENCODING_NONE) { - php_stream *s = (php_stream *) context; + const php_stream *s = (php_stream *) context; zend_string *charset = php_libxml_sniff_charset_from_stream(s); if (charset != NULL) { enc = xmlParseCharEncoding(ZSTR_VAL(charset)); @@ -934,7 +934,7 @@ PHP_LIBXML_API void php_libxml_shutdown(void) } } -PHP_LIBXML_API void php_libxml_switch_context(zval *context, zval *oldcontext) +PHP_LIBXML_API void php_libxml_switch_context(const zval *context, zval *oldcontext) { if (oldcontext) { ZVAL_COPY_VALUE(oldcontext, &LIBXML(stream_context)); @@ -1268,7 +1268,7 @@ int php_libxml_xmlCheckUTF8(const unsigned char *s) return 1; } -zval *php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node export_function) +zval *php_libxml_register_export(const zend_class_entry *ce, php_libxml_export_node export_function) { php_libxml_func_handler export_hnd; @@ -1284,11 +1284,11 @@ PHP_LIBXML_API xmlNodePtr php_libxml_import_node(zval *object) xmlNodePtr node = NULL; if (Z_TYPE_P(object) == IS_OBJECT) { - zend_class_entry *ce = Z_OBJCE_P(object); + const zend_class_entry *ce = Z_OBJCE_P(object); while (ce->parent != NULL) { ce = ce->parent; } - php_libxml_func_handler *export_hnd = zend_hash_find_ptr(&php_libxml_exports, ce->name); + const php_libxml_func_handler *export_hnd = zend_hash_find_ptr(&php_libxml_exports, ce->name); if (export_hnd) { node = export_hnd->export_func(object); } diff --git a/ext/libxml/mime_sniff.c b/ext/libxml/mime_sniff.c index 0ca032f9b79..14034f3db26 100644 --- a/ext/libxml/mime_sniff.c +++ b/ext/libxml/mime_sniff.c @@ -314,8 +314,8 @@ PHP_LIBXML_API zend_string *php_libxml_sniff_charset_from_stream(const php_strea ZEND_HASH_REVERSE_FOREACH_VAL_IND(Z_ARRVAL(s->wrapperdata), header) { if (Z_TYPE_P(header) == IS_STRING) { /* If no colon is found in the header, we assume it's the HTTP status line and bail out. */ - char *colon = memchr(Z_STRVAL_P(header), ':', Z_STRLEN_P(header)); - char *space = memchr(Z_STRVAL_P(header), ' ', Z_STRLEN_P(header)); + const char *colon = memchr(Z_STRVAL_P(header), ':', Z_STRLEN_P(header)); + const char *space = memchr(Z_STRVAL_P(header), ' ', Z_STRLEN_P(header)); if (colon == NULL || space < colon) { return NULL; } diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h index 3314bf6a7b2..c05490cf5d9 100644 --- a/ext/libxml/php_libxml.h +++ b/ext/libxml/php_libxml.h @@ -196,7 +196,7 @@ PHP_LIBXML_API unsigned int php_libxml_increment_doc_ref(php_libxml_node_object PHP_LIBXML_API unsigned int php_libxml_decrement_doc_ref_directly(php_libxml_ref_obj *document); PHP_LIBXML_API unsigned int php_libxml_decrement_doc_ref(php_libxml_node_object *object); PHP_LIBXML_API xmlNodePtr php_libxml_import_node(zval *object); -PHP_LIBXML_API zval *php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node export_function); +PHP_LIBXML_API zval *php_libxml_register_export(const zend_class_entry *ce, php_libxml_export_node export_function); /* When an explicit freeing of node and children is required */ PHP_LIBXML_API void php_libxml_node_free_list(xmlNodePtr node); PHP_LIBXML_API void php_libxml_node_free_resource(xmlNodePtr node); @@ -208,7 +208,7 @@ PHP_LIBXML_API void php_libxml_pretend_ctx_error_ex(const char *file, int line, PHP_LIBXML_API void php_libxml_ctx_error(void *ctx, const char *msg, ...); PHP_LIBXML_API void php_libxml_error_handler_va(php_libxml_error_level error_type, void *ctx, const char *msg, va_list args); PHP_LIBXML_API int php_libxml_xmlCheckUTF8(const unsigned char *s); -PHP_LIBXML_API void php_libxml_switch_context(zval *context, zval *oldcontext); +PHP_LIBXML_API void php_libxml_switch_context(const zval *context, zval *oldcontext); PHP_LIBXML_API void php_libxml_issue_error(int level, const char *msg); PHP_LIBXML_API bool php_libxml_disable_entity_loader(bool disable); PHP_LIBXML_API void php_libxml_set_old_ns(xmlDocPtr doc, xmlNsPtr ns);