Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions ext/dom/document.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions ext/libxml/php_libxml.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading