ganglia / ganglia-web

Ganglia Web Frontend
BSD 3-Clause "New" or "Revised" License
317 stars 169 forks source link

Fix php8 error in function.php #368

Open jh23453 opened 2 years ago

jh23453 commented 2 years ago

I got the message: PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /usr/share/ganglia-webfrontend/functions.php on line 732

This messages is likely new with php7.3. Will be an error with PHP8. For details see https://wiki.php.net/rfc/continue_on_switch_deprecation

This in one small step to get ready for php8. See https://github.com/ganglia/ganglia-web/issues/361

jh23453 commented 2 years ago

I now think that the following change would be better (pseudo-patch):

  case "standard":
    // Does view have any items/graphs defined
-    if ( count($view['items']) == 0 ) {
+    if ( count($view['items']) != 0 ) {
-      continue;
-      // print "No graphs defined for this view. Please add some";
-    } else {
      // Loop through graph items
      foreach ($view['items'] as $item_id => $item) {
berlin2123 commented 5 months ago

Thanks, this Warning is fixed now in PR #376, as the same in your PR