YOURLS-AuthMgrPlus icon indicating copy to clipboard operation
YOURLS-AuthMgrPlus copied to clipboard

Add proper bracing around if-clause

Open umlaeute opened this issue 2 years ago • 2 comments

php is not Python, and the indentation is meaningless for code-blocks...

thus the snippet

if ($foo)
  foreach ($x as $a => $b)
    if ($yikes)
       doit;
elseif ($bar)
  somethingelse;

really does:

if ($foo) {
  foreach ($x as $a => $b) {
    if ($yikes) {
       doit;
    } elseif ($bar) {
       somethingelse;
    }
  }
}

whereas what we want is:

if ($foo) {
  foreach ($x as $a => $b) {
    if ($yikes) {
       doit;
    }
  }
} elseif ($bar) {
  somethingelse;
}

this was a regression introduced with ff31aff5c2418277fd0c40bf87cb0ee44ef02249

Closes: https://github.com/joshp23/YOURLS-AuthMgrPlus/issues/55

umlaeute avatar Feb 14 '23 12:02 umlaeute

I have also been bitten by this

This is also a duplicate of https://github.com/joshp23/YOURLS-AuthMgrPlus/pull/59

Please merge one of those PRs 🙏

Lucas-C avatar Dec 02 '24 12:12 Lucas-C

Gosh, what an easy fix for such an annoying bug. Yes, please merge one of those.

PlanetAngie avatar Feb 26 '25 09:02 PlanetAngie