Skip to content

Commit

Permalink
Ensures channel name matches from start of string (#45692)
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald authored Jan 18, 2023
1 parent 3a0c9eb commit f7a7a86
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,6 @@ protected function retrieveChannelOptions($channel)
*/
protected function channelNameMatchesPattern($channel, $pattern)
{
return preg_match('/'.preg_replace('/\{(.*?)\}/', '([^\.]+)', $pattern).'$/', $channel);
return preg_match('/^'.preg_replace('/\{(.*?)\}/', '([^\.]+)', $pattern).'$/', $channel);
}
}
2 changes: 2 additions & 0 deletions tests/Broadcasting/BroadcasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ public static function channelNameMatchPatternProvider()
['something.23.test.42', 'something.test.{id}', false],
['something-23-test-42', 'something-{id}-test', false],
['23:test', '{id}:test:abcd', false],
['customer.order.1', 'order.{id}', false],
['customerorder.1', 'order.{id}', false],
];
}
}
Expand Down

0 comments on commit f7a7a86

Please sign in to comment.