Skip to content

Fixed more ternary concatenation bugs#9462

Open
mbien wants to merge 1 commit into
apache:masterfrom
mbien:ternary-concat-fix
Open

Fixed more ternary concatenation bugs#9462
mbien wants to merge 1 commit into
apache:masterfrom
mbien:ternary-concat-fix

Conversation

@mbien

@mbien mbien commented Jun 22, 2026

Copy link
Copy Markdown
Member

inspired by #9459

I ran:

"possible bug: ambiguous ternary concatenation":
$pre + $nullable != null ? $a : $b =>
$pre + ($nullable != null ? $a : $b)
;;

"possible bug: ambiguous ternary concatenation":
$pre + $nullable == null ? $a : $b =>
$pre + ($nullable == null ? $a : $b)
;;

Eval order is from left to right which can lead to undesired effects when the right side has a ternary operator.

This puts the ternary operation in braces (or avoids the situation by other means)

Eval order is from left to right which can lead to undesired effects
when the right side has a ternary operator.

This puts the ternary operation in braces (or avoids the situation
by other means)
@mbien mbien added this to the NB31 milestone Jun 22, 2026
@mbien mbien requested review from matthiasblaesing and tmysik June 22, 2026 21:58
@mbien mbien added Code cleanup Label for cleanup done on the Netbeans IDE PHP [ci] enable extra PHP tests (php/php.editor) CSS [ci] enable web job Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Platform [ci] enable platform tests (platform/*) enterprise [ci] enable enterprise job Ant [ci] enable "build tools" tests labels Jun 22, 2026

@tmysik tmysik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ant [ci] enable "build tools" tests Code cleanup Label for cleanup done on the Netbeans IDE CSS [ci] enable web job enterprise [ci] enable enterprise job Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) PHP [ci] enable extra PHP tests (php/php.editor) Platform [ci] enable platform tests (platform/*)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants