From f9fb12b6d2a167d248461d99b6993685331c6d1c Mon Sep 17 00:00:00 2001 From: Michael Larabel Date: Sun, 30 Nov 2025 04:42:41 -0600 Subject: [PATCH] pts-core: PHP 8.5 warning fixes --- .../phodevi/components/phodevi_cpu.php | 1 + pts-core/objects/pts_strings.php | 2 +- .../pages/phoromatic_maintenance_table.php | 1 + .../phoromatic/pages/phoromatic_sched.php | 1 + .../phoromatic/pages/phoromatic_tests.php | 51 ------------------- pts-core/phoromatic/phoromatic_functions.php | 1 + .../web-interfaces/pts_webui_tests.php | 3 +- 7 files changed, 7 insertions(+), 53 deletions(-) diff --git a/pts-core/objects/phodevi/components/phodevi_cpu.php b/pts-core/objects/phodevi/components/phodevi_cpu.php index 9214387df..3ace235b1 100644 --- a/pts-core/objects/phodevi/components/phodevi_cpu.php +++ b/pts-core/objects/phodevi/components/phodevi_cpu.php @@ -1385,6 +1385,7 @@ class phodevi_cpu extends phodevi_device_interface 162 => 'Zen 4', 163 => 'Zen 4', 164 => 'Zen 4', + 128 => 'Zen 4', 165 => 'Zen 4', 166 => 'Zen 4', 167 => 'Zen 4', diff --git a/pts-core/objects/pts_strings.php b/pts-core/objects/pts_strings.php index 755a61d08..066558145 100644 --- a/pts-core/objects/pts_strings.php +++ b/pts-core/objects/pts_strings.php @@ -583,7 +583,7 @@ class pts_strings public static function result_quantifier_to_string($quantifier) { $quantifiers = array('MAX' => 'Maximum', 'MIN' => 'Minimum', 'NULL' => null, 'AVG' => 'Average'); - return isset($quantifiers[$quantifier]) ? $quantifiers[$quantifier] : 'Average'; + return !empty($quantifier) && isset($quantifiers[$quantifier]) ? $quantifiers[$quantifier] : 'Average'; } public static function format_time($time, $input_format = 'SECONDS', $standard_version = true, $round_to = 0) { diff --git a/pts-core/phoromatic/pages/phoromatic_maintenance_table.php b/pts-core/phoromatic/pages/phoromatic_maintenance_table.php index 6cda31da2..2c33997b3 100644 --- a/pts-core/phoromatic/pages/phoromatic_maintenance_table.php +++ b/pts-core/phoromatic/pages/phoromatic_maintenance_table.php @@ -43,6 +43,7 @@ class phoromatic_maintenance_table implements pts_webui_interface $stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, Hardware, Software, ClientVersion, LastIP, NetworkMAC, LastCommunication, CurrentTask, CoreVersion, NetworkWakeOnLAN, BlockPowerOffs FROM phoromatic_systems WHERE AccountID = :account_id AND State >= 0 ORDER BY LastCommunication DESC'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $result = $stmt->execute(); + $components = array(); while($row = $result->fetchArray()) { diff --git a/pts-core/phoromatic/pages/phoromatic_sched.php b/pts-core/phoromatic/pages/phoromatic_sched.php index b949fe2c7..3a8669eb0 100644 --- a/pts-core/phoromatic/pages/phoromatic_sched.php +++ b/pts-core/phoromatic/pages/phoromatic_sched.php @@ -40,6 +40,7 @@ class phoromatic_sched implements pts_webui_interface return; $is_new = true; + $e_schedule = array(); $env_var_edit = array(); if(!empty($PATH[0]) && is_numeric($PATH[0])) { diff --git a/pts-core/phoromatic/pages/phoromatic_tests.php b/pts-core/phoromatic/pages/phoromatic_tests.php index cbbba159a..950734c39 100644 --- a/pts-core/phoromatic/pages/phoromatic_tests.php +++ b/pts-core/phoromatic/pages/phoromatic_tests.php @@ -60,57 +60,6 @@ class phoromatic_tests implements pts_webui_interface { $main .= '

No results found on this Phoromatic Server for the ' . $tp->get_title() . ' test profile.

'; } - else if(false) // previously: $recent_result_count > 5 TODO broken - { - // TODO XXX below code is borked - $stmt = phoromatic_server::$db->prepare('SELECT UploadID, SystemID, UploadTime FROM phoromatic_results WHERE AccountID = :account_id AND UploadID IN (SELECT DISTINCT UploadID FROM phoromatic_results_results WHERE AccountID = :account_id AND TestProfile LIKE :tp) ORDER BY UploadTime DESC LIMIT 1000'); - $stmt->bindValue(':account_id', $_SESSION['AccountID']); - $stmt->bindValue(':tp', $tp_identifier . '%'); - $result = $stmt->execute(); - $recent_result_count = 0; - $result_file = new pts_result_file(null, true); - while($result && $row = $result->fetchArray()) - { - $composite_xml = phoromatic_server::phoromatic_account_result_path($_SESSION['AccountID'], $row['UploadID']) . 'composite.xml'; - if(!is_file($composite_xml)) - { - continue; - } - - // Add to result file - $system_name = strtotime($row['UploadTime']) . ': ' . phoromatic_server::system_id_to_name($row['SystemID']); - $sub_result_file = new pts_result_file($composite_xml, true); - foreach($sub_result_file->get_result_objects() as $obj) - { - if($obj->test_profile->get_identifier(false) == $tp_identifier) - { - $obj->test_result_buffer->rename(null, $system_name); - $result_file->add_result($obj); - } - } - } - - $table = null; - $extra_attributes = array('multi_way_comparison_invert_default' => false); - $f = false; - foreach($result_file->get_result_objects() as $obj) - { - $obj->test_profile->set_display_format('SCATTER_PLOT'); - - foreach($obj->test_result_buffer->buffer_items as $i => &$item) - { - if(!is_numeric(substr($item->get_result_identifier(), 0, strpos($item->get_result_identifier(), ':')))) - { - unset($obj->test_result_buffer->buffer_items[$i]); - } - } - - $result_file = null; - $main .= '

' . pts_render::render_graph_inline_embed($obj, $result_file, $extra_attributes) . '

'; - } - - - } } else { diff --git a/pts-core/phoromatic/phoromatic_functions.php b/pts-core/phoromatic/phoromatic_functions.php index c2313dcde..b6e35d7a2 100644 --- a/pts-core/phoromatic/phoromatic_functions.php +++ b/pts-core/phoromatic/phoromatic_functions.php @@ -260,6 +260,7 @@ function phoromatic_tracker_page_relevant() function phoromatic_webui_header_logged_in() { $html_links = array(); + $pages = array(); if($_SESSION['AdminLevel'] == -40) { $pages = array('Admin', 'Admin_Config', 'Admin_Data', 'Logout'); diff --git a/pts-core/web-interface/web-interfaces/pts_webui_tests.php b/pts-core/web-interface/web-interfaces/pts_webui_tests.php index 588ef0923..683816132 100644 --- a/pts-core/web-interface/web-interfaces/pts_webui_tests.php +++ b/pts-core/web-interface/web-interfaces/pts_webui_tests.php @@ -104,6 +104,7 @@ class pts_webui_tests implements pts_webui_interface $tests_to_show = array_unique($tests_to_show); usort($tests_to_show, array('pts_webui_tests', 'cmp_result_object_sort')); $category = null; + $popularity_index = array(); foreach($tests_to_show as &$test_profile) { if($category != $test_profile->get_test_hardware_type()) @@ -114,7 +115,7 @@ class pts_webui_tests implements pts_webui_interface } $last_updated = pts_openbenchmarking_client::read_repository_test_profile_attribute($test_profile, 'last_updated'); - $popularity = array_search($test_profile->get_identifier(false), $popularity_index); + $popularity = !empty($popularity_index) ? array_search($test_profile->get_identifier(false), $popularity_index) : 9999; $secondary_message = null; if($last_updated > (time() - (60 * 60 * 24 * 21)))