Skip to content

Commit a0c29f0

Browse files
authored
Use unsigned int instead of int for refcount for libxml objects (#15247)
1 parent 0c7cd92 commit a0c29f0

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

UPGRADING.INTERNALS

+1
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ PHP 8.4 INTERNALS UPGRADE NOTES
301301
- Added php_libxml_uses_internal_errors().
302302
- Added a way to override document handlers (e.g. serialization) with
303303
php_libxml_document_handlers.
304+
- Changed the refcount fields from int to unsigned int.
304305

305306
e. ext/date
306307
- Added the php_format_date_ex() API to format instances of php_date_obj.

ext/dom/document.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,7 @@ PHP_METHOD(DOMDocument, __construct)
12431243
dom_object *intern;
12441244
char *encoding, *version = NULL;
12451245
size_t encoding_len = 0, version_len = 0;
1246-
int refcount;
1246+
unsigned int refcount;
12471247

12481248
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ss", &version, &version_len, &encoding, &encoding_len) == FAILURE) {
12491249
RETURN_THROWS();
@@ -1476,7 +1476,7 @@ static void php_dom_finish_loading_document(zval *this, zval *return_value, xmlD
14761476
php_libxml_decrement_node_ptr((php_libxml_node_object *) intern);
14771477
doc_prop = intern->document->doc_props;
14781478
intern->document->doc_props = NULL;
1479-
int refcount = php_libxml_decrement_doc_ref((php_libxml_node_object *)intern);
1479+
unsigned int refcount = php_libxml_decrement_doc_ref((php_libxml_node_object *)intern);
14801480
if (refcount != 0) {
14811481
docp->_private = NULL;
14821482
}

ext/libxml/php_libxml.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ typedef struct _php_libxml_ref_obj {
113113
php_libxml_cache_tag cache_tag;
114114
php_libxml_private_data_header *private_data;
115115
const php_libxml_document_handlers *handlers;
116-
int refcount;
116+
unsigned int refcount;
117117
php_libxml_class_type class_type : 8;
118118
php_libxml_quirks_mode quirks_mode : 8;
119119
} php_libxml_ref_obj;
120120

121121
typedef struct _php_libxml_node_ptr {
122122
xmlNodePtr node;
123-
int refcount;
123+
unsigned int refcount;
124124
void *_private;
125125
} php_libxml_node_ptr;
126126

0 commit comments

Comments
 (0)