Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
indigoxela opened this issue Jul 8, 2024 · 3 comments

Comments

@indigoxela
Copy link
Contributor

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. 😉 Just have a look - who's more familiar with the code.

@indigoxela indigoxela changed the title Odd code (assign instead compare) in borg_project_metrics_get_metrics Odd code (assign instead compare) in function borg_project_metrics_get_metrics() Jul 8, 2024
@bugfolder
Copy link
Contributor

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

@indigoxela
Copy link
Contributor Author

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.

@jenlampton
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants