PHP 7.1 - Notice: A non well formed numeric value encountered in Drupal\Core\Menu\LocalTaskManager->getDefinitions() line 187 of core/lib/Drupal/Core/Menu/LocalTaskManager.php caused by syntax error in custom links.task.yml

Created on 16 October 2017, over 6 years ago
Updated 24 November 2023, 7 months ago

PHP 7.1 introduced Warning about invalid strings in arithmetic. And, yes, there is such "dirty" code in Drupal\Core\Menu\LocalTaskManager->getDefinitions() on line 187 ($definition['weight'] contains numeric string):

public function getDefinitions() {
  $definitions = parent::getDefinitions();
  $count = 0;
  foreach ($definitions as &$definition) {
    if (isset($definition['weight'])) {

      // Add some micro weight.
      $definition['weight'] += $count++ * 1.0E-6;
    }
  }
  return $definitions;
}

This is throwing errors on every page load and flooding my database with them!
Also makes the error-log unreadable.

Caused by a typo in a custom_module.links.task.yml file
I put a ; after weight: 10
weight: 10;

πŸ› Bug report
Status

Closed: outdated

Version

9.5

Component
Menu systemΒ  β†’

Last updated 1 day ago

Created by

πŸ‡§πŸ‡ͺBelgium Pascal-

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    Thanks for the report and working to improve Drupal.

    There has been no discussion of the problem here for 5 years. As #20 points out, we dropped support for PHP 7.1 some time ago. Therefor, I am closing this as outdated.

    Thanks

Production build 0.69.0 2024