Host interface priorities are not taken into account when resolving interface-related macros. Here's how you can reproduce the problem:
1. Create a script that uses a
macro in its confirmation text.
2. Create a host with a JMX interface.
3. Save the host.
4. Add a SNMP interface to that host.
5. Execute the script.
The confirmation text will contain the IP of the JMX interface, even, thought the SNMP interface has a higher priority.
The problem is caused by the following code in CMacrosResolver.php:240:
$dbInterfaces = DBselect(
' FROM interface i'.
' WHERE i.main='.INTERFACE_PRIMARY.
' AND '.dbConditionInt('i.hostid', $hostIds).
' AND '.dbConditionInt('i.type', $this->interfacePriorities)
Not only doesn't it sort interfaces by priority, but it tries to filter interface types using priority values.
I suggest to fix this problem after
ZBX-7137 is finished.