Fix typo: rename InvalidReverseSoldius to InvalidReverseSolidus in Uri\WhatWg\UrlValidationErrorType#22217
Fix typo: rename InvalidReverseSoldius to InvalidReverseSolidus in Uri\WhatWg\UrlValidationErrorType#22217OracleNep wants to merge 3 commits into
Conversation
…i\WhatWg\UrlValidationErrorType The WHATWG URL validation error is invalid-reverse-solidus, and the underlying Lexbor constant is LXB_URL_ERROR_TYPE_INVALID_REVERSE_SOLIDUS. The enum case was misspelled as InvalidReverseSoldius (missing 'l'). Changes: - Fixed enum case spelling in ext/uri/php_uri.stub.php - Fixed error string mapping in ext/uri/uri_parser_whatwg.c - Added PHPT test for the correct enum case name
Update the generated URI arginfo header so the enum case registration matches the corrected InvalidReverseSolidus spelling. Also add the missing trailing newline to the new PHPT test.
Refresh the generated URI arginfo and declaration headers after correcting the InvalidReverseSolidus enum case spelling.
|
Crap. Thank you for the report.
Yes, we'll need some backwards compatibility here. Adding a: constant might be the way to go with minimal impact (e.g. impact on Reflection is unavoidable). We would need to check the deserialization behavior, though. |
|
The fix looks correct. This is technically a BC break so we might want to put it in NEWS and UPGRADING file to indicate this change to users.
|
|
I tested the BC alias approach in a scratch PR/run in my fork before changing this PR further:
The rename-only state of this PR appears fine. The failures only show up after adding a deprecated compatibility alias for the old misspelling. The implementation I tested tried to keep In CI this reproduced as failures in unrelated tests, especially So adding the BC alias is not a small follow-up in the URI extension itself. It likely needs either engine support for non-case lazy class-constant aliases on internal enums, or a different BC strategy. For now I think the current rename-only PR should not be mixed with that larger compatibility implementation. |
Doing the rename without providing compatibility for the old one is not an option. The necessary (engine) changes would need to come first then. |
Uri\WhatWg\UrlValidationErrorType currently exposes the enum case:
php Uri\WhatWg\UrlValidationErrorType::InvalidReverseSoldiusThis appears to be a typo. The WHATWG URL validation error is
invalid-reverse-solidus, and the corresponding Lexbor error constant is
LXB_URL_ERROR_TYPE_INVALID_REVERSE_SOLIDUS.
This patch updates the enum case and the WHATWG validation error mapping to use:
php Uri\WhatWg\UrlValidationErrorType::InvalidReverseSolidusIt also adds a PHPT test for the corrected case spelling.
Since the misspelled name is already present in PHP 8.5, maintainer guidance may
be needed on whether this should target master only, be backported, or preserve
compatibility with the old spelling.
This is not a security issue.
Generated files should be refreshed from ext/uri/php_uri.stub.php.