Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-15659

retrieve_block_vars generates warnings in PHP 7.2

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.2.4-RC1
    • 3.2.3-RC1
    • Template Engine
    • None
    • PHP 7.2, MySQL 5.7.21

      When there are no items in the specified block name the following is produced:

      [phpBB Debug] PHP Warning: in file [ROOT]/phpbb/template/context.php on line 289: count(): Parameter must be an array or an object that implements Countable
      [phpBB Debug] PHP Warning: in file [ROOT]/phpbb/template/context.php on line 301: Invalid argument supplied for foreach()
      

      Ran into this while doing a custom extension that deals with the navlinks and happens on the index page where there are no navlinks. This is the code:

      $navlinks = $this->template->retrieve_block_vars('navlinks', array());

      If I DO specify the variable name I'm looking for the error list gets reduced to just the first one.

            nicofuma nicofuma
            DavidIQ David Colón
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: