Skip to content

Fix typo: rename InvalidReverseSoldius to InvalidReverseSolidus in Uri\WhatWg\UrlValidationErrorType#22217

Draft
OracleNep wants to merge 3 commits into
php:masterfrom
OracleNep:master
Draft

Fix typo: rename InvalidReverseSoldius to InvalidReverseSolidus in Uri\WhatWg\UrlValidationErrorType#22217
OracleNep wants to merge 3 commits into
php:masterfrom
OracleNep:master

Conversation

@OracleNep
Copy link
Copy Markdown

Uri\WhatWg\UrlValidationErrorType currently exposes the enum case:

php Uri\WhatWg\UrlValidationErrorType::InvalidReverseSoldius

This 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::InvalidReverseSolidus

It 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.

…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.
@TimWolla
Copy link
Copy Markdown
Member

TimWolla commented Jun 3, 2026

Crap. Thank you for the report.

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.

Yes, we'll need some backwards compatibility here. Adding a:

#[\Deprecated]
public self const InvalidReverseSoldius = self::InvalidReverseSolidus;

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.

@LamentXU123
Copy link
Copy Markdown
Contributor

LamentXU123 commented Jun 3, 2026

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.

Also not sure if we should target this to 8.5 instead of master :) This is not a bug fix so master will be fine.

@OracleNep
Copy link
Copy Markdown
Author

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 InvalidReverseSoldius as a deprecated alias resolving to self::InvalidReverseSolidus, while keeping it out of UrlValidationErrorType::cases(). Because the enum case objects are still lazy during MINIT, this required storing the alias as an IS_CONSTANT_AST class-constant AST. That runs into Zend's internal-class cleanup assumption: any unresolved IS_CONSTANT_AST left in an internal class constant table is expected to be a lazy enum case AST (ZEND_AST_CONST_ENUM_INIT). The alias is a normal class-constant AST (ZEND_AST_CLASS_CONST), so debug builds hit:

Zend/zend_opcode.c:507: destroy_zend_class: Assertion `...->kind == ZEND_AST_CONST_ENUM_INIT' failed.

In CI this reproduced as failures in unrelated tests, especially ext/opcache/tests/preload_parse_error.phpt, on both MACOS_ARM64_DEBUG_ZTS and LINUX_X64_VARIATION_DEBUG_ZTS. I also tried cleaning up the extension-owned AST in uri MSHUTDOWN, but the preload path still trips the same assertion.

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.

@TimWolla
Copy link
Copy Markdown
Member

TimWolla commented Jun 3, 2026

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.

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