InfotelGLPI / mydashboard

Plugin mydashboard for GLPI
http://blogglpi.infotel.com/
GNU General Public License v2.0
42 stars 19 forks source link

Upgrading from 1.7.6 to 1.7.7 - autoload.php list function #89

Closed InformatiqueOLLN closed 4 years ago

InformatiqueOLLN commented 4 years ago

Hi, i'm having issues upgrading from 1.7.6 to 1.7.7

Output GLPI debug error :

Capture

function name is not accepted.

public function list() {

      $reportsFiles = scandir(GLPI_ROOT . '/plugins/mydashboard/reports');
      $widgets = [];
      foreach ($reportsFiles as $report) {
         if ($report != "." && $report != "..") {
            $reportName = substr($report, 0, strpos($report, "."));
            $className  = "PluginMydashboard" . ucfirst($reportName);
            if ((strpos($className, "PluginMydashboardReports") !== false)
                || (strpos($className, "PluginMydashboardAlert") !== false)) {
               array_push($widgets, $className);
            }
         }
      }

      return $widgets;
   }
Wolvverine commented 4 years ago

glpi 9.4.5, the same problem. Upgrade from 1.7.1

Parse error: syntax error, unexpected 'list' (T_LIST), expecting identifier (T_STRING) in /var/www/plugins/mydashboard/inc/autoload.php on line 41

Do not show any plugins .

renoow commented 4 years ago

Hello, Sure using list as a function name is a crazy thing... Try to rename list into liste (ligne 41 of /var/www/plugins/mydashboard/inc/autoload.php) and change it on the only call to this function I have found (ligne 72 of mydashboard/inc/widgetlist.class.php) seems to solve this issue...

tsmr commented 4 years ago

Fix for 1.7.8 https://github.com/InfotelGLPI/mydashboard/commit/8fa4ff2ceeae954d5dbe46e737dd65933731ba74#diff-b06fd26cdfc4df2c4d16fcf3af1d7001L41

https://github.com/InfotelGLPI/mydashboard/commit/8fa4ff2ceeae954d5dbe46e737dd65933731ba74#diff-3824558010f56e8c4a14c9f3f6da4696R72