Use unsigned int instead of int for refcount for libxml objects (#15247)

This commit is contained in:
Niels Dossche 2024-08-05 22:04:24 +02:00 committed by GitHub
parent 0c7cd92414
commit a0c29f0889
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 4 deletions

View file

@ -301,6 +301,7 @@ PHP 8.4 INTERNALS UPGRADE NOTES
- Added php_libxml_uses_internal_errors().
- Added a way to override document handlers (e.g. serialization) with
php_libxml_document_handlers.
- Changed the refcount fields from int to unsigned int.
e. ext/date
- Added the php_format_date_ex() API to format instances of php_date_obj.

View file

@ -1243,7 +1243,7 @@ PHP_METHOD(DOMDocument, __construct)
dom_object *intern;
char *encoding, *version = NULL;
size_t encoding_len = 0, version_len = 0;
int refcount;
unsigned int refcount;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ss", &version, &version_len, &encoding, &encoding_len) == FAILURE) {
RETURN_THROWS();
@ -1476,7 +1476,7 @@ static void php_dom_finish_loading_document(zval *this, zval *return_value, xmlD
php_libxml_decrement_node_ptr((php_libxml_node_object *) intern);
doc_prop = intern->document->doc_props;
intern->document->doc_props = NULL;
int refcount = php_libxml_decrement_doc_ref((php_libxml_node_object *)intern);
unsigned int refcount = php_libxml_decrement_doc_ref((php_libxml_node_object *)intern);
if (refcount != 0) {
docp->_private = NULL;
}

View file

@ -113,14 +113,14 @@ typedef struct _php_libxml_ref_obj {
php_libxml_cache_tag cache_tag;
php_libxml_private_data_header *private_data;
const php_libxml_document_handlers *handlers;
int refcount;
unsigned int refcount;
php_libxml_class_type class_type : 8;
php_libxml_quirks_mode quirks_mode : 8;
} php_libxml_ref_obj;
typedef struct _php_libxml_node_ptr {
xmlNodePtr node;
int refcount;
unsigned int refcount;
void *_private;
} php_libxml_node_ptr;