Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-22290

TemplateDebugInfo generates a PHP notice when $templateStats is not defined

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 2014.03
    • 2014.01, 5.3-dev
    • None

    Description

      In TemplateDebugInfo::getLegacyTemplatesList a PHP Notice is generated when the usage statistics can not be retrieved thus leaving $templateStats uninitialized.

      try
      {
          $templateStats = $legacyKernel()->runCallback(
              function ()
              {
                  return eZTemplate::templatesUsageStatistics();
              }
          );
      }
      catch ( RuntimeException $e )
      {
          // Ignore the exception thrown by legacy kernel as this would break debug toolbar (and thus debug info display).
          // Furthermore, some legacy kernel handlers don't support runCallback (e.g. ezpKernelTreeMenu)
      }
      
      foreach ( $templateStats as $tplInfo )
      {
          // ...
      }
      

      The catch could be extended like this

      catch ( RuntimeException $e )
      {
          // Ignore the exception thrown by legacy kernel as this would break debug toolbar (and thus debug info display).
          // Furthermore, some legacy kernel handlers don't support runCallback (e.g. ezpKernelTreeMenu)
          $templateStats = array();
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            jgamez jgamez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: