Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Backward Compatibility for servers running Pusher < 5.0.0 #324

Merged
merged 2 commits into from
Jun 2, 2022
Merged
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
4 changes: 1 addition & 3 deletions src/Pusher.php
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,6 @@ public function make_batch_request(array $batch = [], bool $already_encoded = fa
public function triggerBatch(array $batch = [], bool $already_encoded = false): object
{
$post_value = $this->make_trigger_batch_body($batch, $already_encoded);

$this->log('trigger POST: {post_value}', compact('post_value'));
return $this->process_trigger_result($this->post('/batch_events', $post_value));
}
Expand All @@ -583,7 +582,6 @@ public function triggerBatchAsync(array $batch = [], bool $already_encoded = fal
{
$post_value = $this->make_trigger_batch_body($batch, $already_encoded);
$this->log('trigger POST: {post_value}', compact('post_value'));

return $this->postAsync('/batch_events', $post_value)->then(function ($result) {
return $this->process_trigger_result($result);
});
Expand Down Expand Up @@ -1190,7 +1188,7 @@ private function make_trigger_batch_body(array $batch = [], bool $already_encode
*/
private function process_trigger_result(object $result): object
{
if (property_exists($result, 'channels')) {
if (property_exists($result, 'channels') && is_object($result->channels)) {
$result->channels = get_object_vars($result->channels);
}

Expand Down