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

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 2014.01, 5.3-dev
    • Fix Version/s: 2014.03
    • Component/s: None
    • Labels:

      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

            Assignee:
            Unassigned
            Reporter:
            jgamez Jérôme Gamez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: