[ZBX-19495] Inconsistend sorting of export with MySQL and Postgres Created: 2021 Jun 01  Updated: 2021 Jun 02

Status: Open
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 5.4.0
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Ivan Vanyushkin Assignee: Renats Valiahmetovs (Inactive)
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File image-2021-06-01-01-45-25-917.png    

 Description   

Steps to reproduce:

  1. Setup Zabbix Froentend with Postgres database.
  2. Export templates to file template_os_linux.yaml and compare with Zabbix git repository.

Result:
**

Expected:
The same order of fields as in repository and in other exports using MySQL database.

Possible fix:

Something like this seems improve the behavior:

--- /usr/share/zabbix/include/classes/export/CConfigurationExportBuilder.php_orig       2021-05-11 17:39:54.000000000 +0300
+++ /usr/share/zabbix/include/classes/export/CConfigurationExportBuilder.php    2021-06-01 01:33:46.837862216 +0300
@@ -1257,7 +1257,7 @@
        protected function formatWidgetFields(array $fields) {
                $result = [];
 
-               CArrayHelper::sort($fields, ['type']);
+               CArrayHelper::sort($fields, ['type', 'name', 'value']);
 
                foreach ($fields as $field) {
                        $result[] = [

Generated at Sun Mar 16 23:24:32 EET 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.