Skip to content

Conversation

@kocsismate
Copy link
Member

No description provided.

@kocsismate kocsismate changed the base branch from master to PHP-8.5 September 26, 2025 07:40
Copy link
Member

@TimWolla TimWolla left a comment

Choose a reason for hiding this comment

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

I went through all RFC 3986 tests. Looking pretty good overall, some nits. I also think it would be helpful to print the entire resulting URL in addition to printing the output of the getters, this makes it easier to double-check how exactly the resulting URL will look, particularly with regard to the difference between null and "" (e.g. whether there is a ? for the query or not).

@kocsismate
Copy link
Member Author

I also think it would be helpful to print the entire resulting URL in addition to printing the output of the getters, this makes it easier to double-check how exactly the resulting URL will look, particularly with regard to the difference between null and "" (e.g. whether there is a ? for the query or not).

Yes, I was also thinking about something similar (at least in some edge cases), but I didn't want to make the output too "crowded". My other concern is that most states can be tested via regular parsing 🤔 (we don't necessary have to use withers for them)

@kocsismate
Copy link
Member Author

@TimWolla What do you think about verifying URI recomposition separately? Or do you think we should always test the recomposed URI after URI modification?

@TimWolla
Copy link
Member

TimWolla commented Oct 4, 2025

Or do you think we should always test the recomposed URI after URI modification?

Always, because this also helps the human reader understand the test better.

@TimWolla
Copy link
Member

TimWolla commented Oct 4, 2025

but I didn't want to make the output too "crowded".

If the tests follow a common structure / order, that's easy to check and scan. You could also insert an additional newline between the various output “sections”.

@nielsdos nielsdos removed their request for review October 4, 2025 23:06
@nielsdos
Copy link
Member

nielsdos commented Oct 4, 2025

Unless I'm really needed here I'm removing my review request.
The honest reason is that I'm not really looking forward to reviewing 2K lines of tests in my spare time 😅

Copy link
Member

@TimWolla TimWolla left a comment

Choose a reason for hiding this comment

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

Taken another look at the RFC 3986 tests now. Generally LGTM. Will still need to look at the WHATWG tests.

Copy link
Member

Choose a reason for hiding this comment

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

Can you also add a test with ->withFragment("#")?

Copy link
Member Author

Choose a reason for hiding this comment

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

This revealed a bug :)

Copy link
Member Author

Choose a reason for hiding this comment

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

For now, I pushed the fixes with the same commit, but I plan to separately apply it before this PR is merged.

@@ -0,0 +1,19 @@
--TEST--
Test Uri\WhatWg\Url component modification - username - unsetting non-existent
Copy link
Member

Choose a reason for hiding this comment

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

This description does not match the test and does not match the filename.

Copy link
Member

Choose a reason for hiding this comment

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

Can be removed, this is just testing the signature (similarly to the one in Rfc3986 that was already removed).

Copy link
Member

Choose a reason for hiding this comment

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

Typo in filename

const lxb_url_t *lexbor_uri = uri;

if (lexbor_uri->fragment.length) {
if (lexbor_uri->fragment.data != NULL) {
Copy link
Member

Choose a reason for hiding this comment

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

FWIW, with this changed now, a follow-up PR (probs for master) may change the ZVAL_STRINGL to ZVAL_STRINGL_FAST to avoid allocating empty strings.

@kocsismate
Copy link
Member Author

I got rid of the Uri\WhatWg\Url::getQuery() and Uri\WhatWg\Url::getFragment() related changes so that this PR is at least uncontroversial again.

Copy link
Member

@TimWolla TimWolla left a comment

Choose a reason for hiding this comment

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

I trust that you added all the extra tests that I suggested. All files in this PR are now marked as "Viewed" for me and I didn't see any further issues after the latest changes / don't have further comments (or just a minor typo in a test title). Thus this should be good to go and clearly improves the test coverage and organization. If necessary we can just make some follow-up to fix issues we notice afterwards.

@kocsismate kocsismate merged commit 27bc7c0 into php:PHP-8.5 Oct 25, 2025
9 of 10 checks passed
@kocsismate kocsismate deleted the ext-uri-tests1 branch October 25, 2025 12:46
kocsismate added a commit that referenced this pull request Oct 25, 2025
* PHP-8.5:
  Reorganize ext/uri tests - withers (#19970)
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.

3 participants