Skip to content

Conversation

TimWolla
Copy link
Member

This improves type safety for the caller, since it is immediately visible what type of object is expected.

ZEND_ASSERT(base_url_object->ce == uri_object->std.ce);
uri_internal_t *internal_base_url = uri_internal_from_obj(base_url_object);
ZEND_ASSERT(base_url_object->std.ce == uri_object->std.ce);
const uri_internal_t *internal_base_url = &base_url_object->internal;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this line making the change pointed out a const-correctness bug.

@kocsismate kocsismate requested a review from nielsdos September 17, 2025 05:01
@TimWolla TimWolla merged commit cb49281 into php:master Sep 20, 2025
9 checks passed
@TimWolla TimWolla deleted the uri-object-typing branch September 20, 2025 08:43
TimWolla added a commit to TimWolla/php-src that referenced this pull request Sep 21, 2025
The functions derived non-const pointers from a const-pointer, which is not
correct. Since php#19854 no `const` pointers are passed into these
functions, so we can just make the parameter non-const.
TimWolla added a commit that referenced this pull request Sep 21, 2025
The functions derived non-const pointers from a const-pointer, which is not
correct. Since #19854 no `const` pointers are passed into these
functions, so we can just make the parameter non-const.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants