Skip to content

Fix logical operator for member and UUID checks - #131

Closed
denismosolov wants to merge 1 commit into
pubnub:masterfrom
denismosolov:patch-2
Closed

Fix logical operator for member and UUID checks#131
denismosolov wants to merge 1 commit into
pubnub:masterfrom
denismosolov:patch-2

Conversation

@denismosolov

Copy link
Copy Markdown
Contributor

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;

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;
@pubnub-ops-terraform

pubnub-ops-terraform commented May 11, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@pubnub-release-bot

Copy link
Copy Markdown
Contributor

@denismosolov this issue is addressed in 9.0.3

@github-actions github-actions Bot added the status: done This issue is considered resolved. label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: done This issue is considered resolved.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants