Skip to content

Conversation

@iroqueta
Copy link
Collaborator

Previously, strcmp could return equality when comparing a null value with an empty string.

This happened because rtrim(null) returned an empty string, causing null and "" to be treated as equivalent during comparison.

This change preserves the semantic difference between null and empty strings by handling null values explicitly and delegating comparison to Comparator.nullsFirst after trimming.

Behavior:

  • null is considered less than any non-null String
  • empty strings are not equal to null
  • trailing whitespace is ignored during comparison

Issue: 207440

Previously, strcmp could return equality when comparing a null value
with an empty string.

This happened because rtrim(null) returned an empty string, causing
null and "" to be treated as equivalent during comparison.

This change preserves the semantic difference between null and empty
strings by handling null values explicitly and delegating comparison
to Comparator.nullsFirst after trimming.

Behavior:
- null is considered less than any non-null String
- empty strings are not equal to null
- trailing whitespace is ignored during comparison

Issue: 207440
@genexusbot
Copy link
Collaborator

Cherry pick to beta success

@genexusbot
Copy link
Collaborator

Cherry pick to beta success

@iroqueta iroqueta merged commit c483c5c into master Dec 23, 2025
11 checks passed
@iroqueta iroqueta deleted the fix/strcmp-null-vs-empty branch December 23, 2025 21:09
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