Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-15659

retrieve_block_vars generates warnings in PHP 7.2

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 3.2.3-RC1
    • 3.2.4-RC1
    • Template Engine
    • None
    • PHP 7.2, MySQL 5.7.21

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: