Skip to content

[stable29] fix(config): Throw PreconditionException always when it didn't match - #47941

Merged
nickvergessen merged 1 commit into
stable29from
backport/47933/stable29
Sep 16, 2024
Merged

[stable29] fix(config): Throw PreconditionException always when it didn't match#47941
nickvergessen merged 1 commit into
stable29from
backport/47933/stable29

Conversation

@backportbot

Copy link
Copy Markdown

Backport of PR #47933

Previously even when the precondition did not match, the call "passed"
when the after value was the expected one. This however can lead to
race conditions, duplicate code excutions and other things.
Signed-off-by: Joas Schilling <coding@schilljs.com>
if ($prevValue === (string)$value) {
return;
} elseif ($preCondition !== null && $prevValue !== (string)$preCondition) {
if ($preCondition !== null && $prevValue !== (string)$preCondition) {

Check notice

Code scanning / Psalm

RedundantCastGivenDocblockType

Redundant cast to string given docblock-provided type
@nickvergessen
nickvergessen merged commit 6e576e1 into stable29Sep 16, 2024
@nickvergessen
nickvergessen deleted the backport/47933/stable29 branch September 16, 2024 07:11
@AltahrimAltahrim mentioned this pull request Oct 1, 2024
1 task
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsbug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@nickvergessen@artonge@github-advanced-security@susnux