Skip to content

Commit

Permalink
Skip in_array() check for empty excludes list
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabker committed Nov 14, 2023
1 parent b8a25f6 commit bdcbd3f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/WAMP/Topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,14 @@ public function broadcast(mixed $msg, array $exclude = [], array $eligible = [])
return;
}

$useExclude = [] !== $exclude;
$useEligible = [] !== $eligible;

/** @var WAMPConnection $subscriber */
foreach ($this->subscribers as $subscriber) {
$sessionId = $subscriber->getAttributeStore()->get('wamp.session_id');

if (\in_array($sessionId, $exclude, true)) {
if ($useExclude && \in_array($sessionId, $exclude, true)) {
continue;
}

Expand Down

0 comments on commit bdcbd3f

Please sign in to comment.