pts-core: More PHP 8.1 warning fixes from new warnings / deprecations
This commit is contained in:
@@ -156,7 +156,7 @@ class pts_installed_test
|
||||
}
|
||||
public function get_last_run_date()
|
||||
{
|
||||
return substr($this->get_last_run_date_time(), 0, 10);
|
||||
return !empty($this->get_last_run_date_time()) ? substr($this->get_last_run_date_time(), 0, 10) : '';
|
||||
}
|
||||
public function get_installed_version()
|
||||
{
|
||||
|
||||
@@ -371,7 +371,7 @@ class phodevi_linux_parser
|
||||
}
|
||||
|
||||
$this_attribute = $line[0];
|
||||
$this_value = trim(count($line) > 1 ? $line[1] : null);
|
||||
$this_value = trim(count($line) > 1 ? $line[1] : '');
|
||||
if(in_array($this_attribute, array('flags', 'bugs', 'power management')))
|
||||
{
|
||||
$this_value = explode(' ', $this_value);
|
||||
|
||||
@@ -143,6 +143,18 @@ class pts_OverviewGraph extends pts_graph_core
|
||||
{
|
||||
$all_values = $result_object->test_result_buffer->get_values();
|
||||
|
||||
foreach($all_values as $ai => $av)
|
||||
{
|
||||
if(!is_numeric($av))
|
||||
{
|
||||
unset($all_values[$ai]);
|
||||
}
|
||||
}
|
||||
if(empty($all_values))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
switch($result_object->test_profile->get_result_proportion())
|
||||
{
|
||||
case 'HIB':
|
||||
|
||||
@@ -417,7 +417,7 @@ abstract class pts_graph_core
|
||||
$data_max = max($data_max);
|
||||
}
|
||||
|
||||
if(!is_numeric($data_max))
|
||||
if(!is_numeric($data_max) && $data_max != null)
|
||||
{
|
||||
$data_max = str_repeat(9, strlen($data_max));
|
||||
}
|
||||
|
||||
@@ -336,9 +336,25 @@ class pts_svg_dom_gd
|
||||
if($a['stroke-width'])
|
||||
{
|
||||
imagesetthickness($gd, $a['stroke-width']);
|
||||
imagefilledpolygon($gd, $points, count($a['points']), self::gd_color_allocate($gd, $a['stroke']));
|
||||
if(PHP_MAJOR_VERSION >= 8)
|
||||
{
|
||||
// PHP 8.1 deprecates the $num_points parameter and issues its warning for usage..
|
||||
// However, the alternative signature without using $num_points was only added in PHP 8.0.0
|
||||
imagefilledpolygon($gd, $points, self::gd_color_allocate($gd, $a['stroke']));
|
||||
}
|
||||
else
|
||||
{
|
||||
imagefilledpolygon($gd, $points, count($a['points']), self::gd_color_allocate($gd, $a['stroke']));
|
||||
}
|
||||
}
|
||||
if(PHP_MAJOR_VERSION >= 8)
|
||||
{
|
||||
imagefilledpolygon($gd, $points, self::gd_color_allocate($gd, $a['fill']));
|
||||
}
|
||||
else
|
||||
{
|
||||
imagefilledpolygon($gd, $points, count($a['points']), self::gd_color_allocate($gd, $a['fill']));
|
||||
}
|
||||
imagefilledpolygon($gd, $points, count($a['points']), self::gd_color_allocate($gd, $a['fill']));
|
||||
break;
|
||||
case 'rect':
|
||||
// Draw a rectangle
|
||||
|
||||
Reference in New Issue
Block a user