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

retrieve_block_vars generates warnings in PHP 7.2

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2.3-RC1
    • Fix Version/s: 3.2.4-RC1
    • Component/s: Template Engine
    • Labels:
      None
    • Environment:
      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

            Assignee:
            nicofuma nicofuma
            Reporter:
            DavidIQ DavidIQ
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: