From c047a47e3d2bb5ec561ea0c52c2ffd2a9847850d Mon Sep 17 00:00:00 2001 From: Denis Mosolov Date: Mon, 11 May 2026 14:52:30 -0400 Subject: [PATCH] Fix logical operator for member and UUID checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It does not work the way it may look at first glance because of operator precedence (https://www.php.net/manual/en/language.operators.precedence.php ) `or` is called after the assignment `=` `||` is called before the assignment = It is interpreted as: ``` ($members = !empty($this->setMembers)) or !empty($this->removeMembers); ``` So if: $this->setMembers has 0 elements → empty(...) is true → !empty(...) is false $this->removeMembers has 1 element → !empty(...) is true Then: $members = false; --- src/PubNub/Endpoints/Objects/Member/ManageMembers.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PubNub/Endpoints/Objects/Member/ManageMembers.php b/src/PubNub/Endpoints/Objects/Member/ManageMembers.php index 5baaab3..484abf4 100644 --- a/src/PubNub/Endpoints/Objects/Member/ManageMembers.php +++ b/src/PubNub/Endpoints/Objects/Member/ManageMembers.php @@ -147,8 +147,8 @@ protected function validateParams() if (empty($this->channel)) { throw new PubNubValidationException("channel missing"); } - $members = !empty($this->setMembers) or !empty($this->removeMembers); - $uuids = !empty($this->setUuids) or !empty($this->removeUuids); + $members = !empty($this->setMembers) || !empty($this->removeMembers); + $uuids = !empty($this->setUuids) || !empty($this->removeUuids); if ($members and $uuids) { throw new PubNubValidationException("Either members or uuids should be provided");