Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Sep 8, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.3)

Can you help keep this open source service alive? 💖 Please sponsor : )

TimWolla and others added 2 commits September 8, 2025 08:55
* uri: Inline implementation of `php_uri_implementation_set_object_handlers()`

There is no one time fits all solution to initialization of the object
handlers. A follow-up commit will use distinct `create_object` handlers for
each parser class.

Explicitly spelling out the handlers is a well-established pattern in php-src
and I don't see a reason to diverge from that with an intransparent helper
method.

* uri: Initialize the `.internal` field of `uri_object_t` immediately upon creation

This makes the objects much safer to use, since the `.parser` will always be
available and matching the object.

* uri: Remove `uri_parser_name` parameter of `uri_unserialize()`

The parser for a given object is already known from the object itself and
particularly must never change. Reassigning the value in `uri_unserialize()` is
just unsafe, especially since the existing `->uri` is freed with the destructor
of the reassigned parser.

Just rely on the `->parser` field being set to the correct value.

* uri: Remove the `uri_parser` parameter from `php_uri_instantiate_uri()`

Similarly to the previous change to `uri_unserialize()`, the `->parser` must
always match the object for the freeing to be safe.

Given that we expect to successfully parse URIs, we can eagerly initialize the
resulting URI object when using the `::parse()` methods and destruct it again
when parsing fails and `null` is returned instead. Calling the destructor is
safe, since `uri` will be `NULL`, which will result in a noop.

The `base_url_object` must also match the object that is currently being
constructed. Verify this using assertions matching the `->ce` and the
`->parser`.

* uri: Export the individual object handlers
@pull pull bot locked and limited conversation to collaborators Sep 8, 2025
@pull pull bot added the ⤵️ pull label Sep 8, 2025
@pull pull bot merged commit ae7def7 into wudi:master Sep 8, 2025
8 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants