?
Referenced as Pull Request for: # 6148
avatar larsomator
larsomator
10 Feb 2015

Steps to reproduce the issue

There is a server where the phpinfo()-function is disabled in the php.ini. When I go to System -> System Information -> PHP Information there is an error message saying

Notice: Undefined offset: 0 in /joomlahome/administrator/components/com_admin/models/sysinfo.php on line 174 

Expected result

I would expect an error message pointing out that phpindo() is disabled.

Actual result

The error message quoted.

System information (as much as possible)

PHP Version 5.3.27

Joomla! 3.3.6 Stable [ Ember ] 01-October-2014 02:00 GMT

Additional comments

Following the error message to joomlahome/administrator/components/com_admin/models/sysinfo.php on line 174 I found that the case that there is no phpinfo returned in line 170 is not checked. So we go to line 174 without a valid string.

A fix would be to check the result of phpinfo (see also (http://php.net/manual/en/function.phpinfo.php)):

public function &getPHPInfo()
{
  if (is_null($this->php_info))
  {
    ob_start();
    date_default_timezone_set('UTC');
    if (phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES)) 
    {
      $phpInfo = ob_get_contents();
      ob_end_clean();
      preg_match_all('#<body[^>]*>(.*)</body>#siU', $phpInfo, $output);
      $output = preg_replace('#<table[^>]*>#', '<table class="table table-striped adminlist">', $output[1][0]);
      $output = preg_replace('#(\w),(\w)#', '\1, \2', $output);
      $output = preg_replace('#<hr />#', '', $output);
      $output = str_replace('<div class="center">', '', $output);
      $output = preg_replace('#<tr class="h">(.*)<\/tr>#', '<thead><tr class="h">$1</tr></thead><tbody>', $output);
      $output = str_replace('</table>', '</tbody></table>', $output);
      $output = str_replace('</div>', '', $output);
      $this->php_info = $output;
    } else 
    {
      // do we need another message here? 
      $this->php_info = '';
    }
  }
  return $this->php_info;
}
avatar larsomator larsomator - open - 10 Feb 2015
avatar brianteeman brianteeman - change - 11 Feb 2015
Labels Added: ?
avatar brianteeman
brianteeman - comment - 24 Feb 2015

Please see #6148


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6042.
avatar brianteeman brianteeman - change - 24 Feb 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-02-24 12:35:07
Closed_By brianteeman
avatar brianteeman brianteeman - close - 24 Feb 2015

Add a Comment

Login with GitHub to post a comment