backdropcms.org icon indicating copy to clipboard operation
backdropcms.org copied to clipboard

Odd code (assign instead compare) in function borg_project_metrics_get_metrics()

Open indigoxela opened this issue 1 year ago • 3 comments

This is really odd. It may be by intention, but I really doubt it.

https://github.com/backdrop-ops/backdropcms.org/blob/main/www/modules/custom/borg_project_metrics/borg_project_metrics.module#L194-L196

Could it be that this was supposed to be elseif ($type == 'comments') { instead?

Don't wait for me, I won't provide a PR for it. :wink: Just have a look - who's more familiar with the code.

indigoxela avatar Jul 08 '24 11:07 indigoxela

Sure looks like it ought to be ==. @jenlampton, would you agree?

bugfolder avatar Jul 24 '24 02:07 bugfolder

It might as well be, that this was supposed to be:

else {
  $type = 'comments';
  ...

Something needs to be assigned to $type because further down in the function it's assumed it exists, and also that $url is set, of course.

I belief, the code works as intended - it's just written in a confusing way.

indigoxela avatar Jul 24 '24 05:07 indigoxela

Yes, I think that was supposed to be == .

jenlampton avatar Jul 24 '24 22:07 jenlampton