Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,15 @@ private function evaluate( $entry ) {
}

// Returns the opposite if it contains a negation operator (!).
return $should_negate_value ? ! $current : $current;
// Uses JavaScript-compatible truthiness rules to ensure server and client
// rendering agree. PHP and JavaScript differ on two values:
// - [] (empty array): falsy in PHP, truthy in JavaScript.
// - '0' (string zero): falsy in PHP, truthy in JavaScript.
if ( $should_negate_value ) {
$is_truthy = is_array( $current ) || '0' === $current ? true : (bool) $current;
return ! $is_truthy;
}
return $current;
}

/**
Expand Down
Loading