Skip to content

[Php80] Map empty operator to < in VersionCompareFuncCallArgumentRector - #9055

Merged
TomasVotruba merged 1 commit into
mainfrom
fix-version-compare-empty-operator
Nov 24, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
fix-version-compare-empty-operator

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Before PHP 8.1, version_compare() matched the operator as a prefix, in order: </lt first (source, PHP-7.4). strncmp(op, "<", 0) is always 0, so an empty operator meant <, not !=.

version_compare(1, 2, '') now becomes version_compare(1, 2, '<'), keeping its result.

Note: gte and lte matched no operator there and returned null; their mapping to ge/le is left as is, since PHP 8.1 throws on them anyway and the mapping keeps the evident intent.

@TomasVotruba
TomasVotruba merged commit 39475d0 into main Nov 24, 2026
51 checks passed
@TomasVotruba
TomasVotruba deleted the fix-version-compare-empty-operator branch November 24, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant