[ZBX-6994] weird sql statement conditions Created: 2013 Sep 12  Updated: 2017 May 30  Resolved: 2013 Sep 30

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: None
Fix Version/s: 2.1.7, 2.2.0

Type: Incident report Priority: Major
Reporter: richlv Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: sql
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

trunk r38447.


Issue Links:
Duplicate
duplicates ZBX-7086 Application item count and number of ... Closed

 Description   

SQL (0.000364): SELECT i.itemid,i.hostid FROM items i WHERE i.type<>9 AND i.flags IN (0,4) AND i.itemid='31871' AND i.flags='0'
items.php:194 ? CAPIObject->get() ? CAPIObject->__call() ? czbxrpc::call() ? czbxrpc::callAPI() ? call_user_func() ? CItem->get() ? DBselect() in /home/main/usr/local/apache2/htdocs/trunk/api/classes/CItem.php:374

note the presence of both :

AND i.flags IN (0,4) AND i.itemid='31871' AND i.flags='0'

this is generated when clicking on an item in the configuration



 Comments   
Comment by Vitalij Romanovskij (Inactive) [ 2013 Sep 26 ]

fixed in the development branch svn://svn.zabbix.com/branches/dev/ZBX-6994

Comment by Ivo Kurzemnieks [ 2013 Sep 26 ]

(1) Item prototype > edit > save produces and error:

    Error in query [SELECT DISTINCT a.applicationid,a.name FROM applications a WHERE a.hostid=] [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
    mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given [disc_prototypes.php:344 → getItemFormData() → DBfetchArray() → DBfetch() → mysqli_fetch_assoc() in C:\Development\ZBX-6994-test\frontends\php\include\db.inc.php:616]
    mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given [disc_prototypes.php:344 → getItemFormData() → DBfetchArray() → DBfetch() → mysqli_free_result() in C:\Development\ZBX-6994-test\frontends\php\include\db.inc.php:618]
    Error in query [SELECT h.status FROM hosts h WHERE h.hostid=] [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
    mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given [disc_prototypes.php:344 → getItemFormData() → isTemplate() → DBfetch() → mysqli_fetch_assoc() in C:\Development\ZBX-6994-test\frontends\php\include\db.inc.php:616]
    mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given [disc_prototypes.php:344 → getItemFormData() → isTemplate() → DBfetch() → mysqli_free_result() in C:\Development\ZBX-6994-test\frontends\php\include\db.inc.php:618]

vitalij_zab FIXED in r38826

iivs CLOSED.

Comment by Ivo Kurzemnieks [ 2013 Sep 26 ]

(2) Graph prototype add/edit > add item prototype or edit existing graph prototype > save produces an error:

No permissions to referred object or it does not exist! [graphs.php:225 → CAPIObject->update() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CGraphGeneral->update() → CGraphPrototype->validateUpdate() → CZBXAPI::exception() in C:\Development\ZBX-6994-test\frontends\php\api\classes\CGraphPrototype.php:727]

vitalij_zab FIXED in r38826

iivs CLOSED.

Comment by Ivo Kurzemnieks [ 2013 Sep 26 ]

(3) Trigger prototype > add > add expression > select item prototype in popup produces an error:

    reset() expects parameter 1 to be array, null given [popup_trexpr.php:626 → reset() in C:\Development\ZBX-6994-test\frontends\php\popup_trexpr.php:626]
    Undefined index: name [popup_trexpr.php:628 → itemName() in C:\Development\ZBX-6994-test\frontends\php\include\items.inc.php:642]

vitalij_zab FIXED in r38826

iivs CLOSED.

Comment by Ivo Kurzemnieks [ 2013 Sep 26 ]

(4) Trigger prototype list is broken:

Fatal error: Unsupported operand types in C:\Development\ZBX-6994-test\frontends\php\include\triggers.inc.php on line 842

vitalij_zab FIXED in r38826

iivs CLOSED.

Comment by Ivo Kurzemnieks [ 2013 Sep 26 ]

(5) application.massadd allows to add item prototypes

There was a bug in previous version, because default check of flag was not rewritten, if there was flag parameter from filter.

vitalij_zab FIXED in r38826

iivs When adding item prototype it no longer throws an error. It seems like it now allows to add item prototype, but in reality it just skips the adding process.

There is a similar issue, that you can add multiple items to multiple applications: when adding two items from two different hosts to one application, the item count for application will be 2. But opening the item list will show only corresponding host items. That is only item.

After discussion decided that we shouldn't allow to add item prototypes the way it is done now and nor allow to add items from different hosts. A separate issue created ZBX-7086.

CLOSED.

Comment by Ivo Kurzemnieks [ 2013 Sep 26 ]

(6) Host > Full clone > save produces an error:

Undefined offset: 23603 [hosts.php:526 → CAPIObject->copy() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->copy() → CDiscoveryRule->copyDiscoveryRule() → CDiscoveryRule->copyGraphPrototypes() in C:\Development\ZBX-6994-test\frontends\php\api\classes\CDiscoveryRule.php:932]
Undefined index: [hosts.php:526 → CAPIObject->copy() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->copy() → CDiscoveryRule->copyDiscoveryRule() → CDiscoveryRule->copyGraphPrototypes() in C:\Development\ZBX-6994-test\frontends\php\api\classes\CDiscoveryRule.php:933]
Undefined offset: 23603 [hosts.php:526 → CAPIObject->copy() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->copy() → CDiscoveryRule->copyDiscoveryRule() → CDiscoveryRule->copyGraphPrototypes() in C:\Development\ZBX-6994-test\frontends\php\api\classes\CDiscoveryRule.php:932]
Undefined index: [hosts.php:526 → CAPIObject->copy() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->copy() → CDiscoveryRule->copyDiscoveryRule() → CDiscoveryRule->copyGraphPrototypes() in C:\Development\ZBX-6994-test\frontends\php\api\classes\CDiscoveryRule.php:933]
Undefined offset: 23603 [hosts.php:526 → CAPIObject->copy() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->copy() → CDiscoveryRule->copyDiscoveryRule() → CDiscoveryRule->copyGraphPrototypes() in C:\Development\ZBX-6994-test\frontends\php\api\classes\CDiscoveryRule.php:932]
Undefined index: [hosts.php:526 → CAPIObject->copy() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->copy() → CDiscoveryRule->copyDiscoveryRule() → CDiscoveryRule->copyGraphPrototypes() in C:\Development\ZBX-6994-test\frontends\php\api\classes\CDiscoveryRule.php:933]
Undefined offset: 23604 [hosts.php:526 → CAPIObject->copy() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->copy() → CDiscoveryRule->copyDiscoveryRule() → CDiscoveryRule->copyGraphPrototypes() in C:\Development\ZBX-6994-test\frontends\php\api\classes\CDiscoveryRule.php:932]
Undefined index: [hosts.php:526 → CAPIObject->copy() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->copy() → CDiscoveryRule->copyDiscoveryRule() → CDiscoveryRule->copyGraphPrototypes() in C:\Development\ZBX-6994-test\frontends\php\api\classes\CDiscoveryRule.php:933]
Undefined offset: 23606 [hosts.php:526 → CAPIObject->copy() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->copy() → CDiscoveryRule->copyDiscoveryRule() → CDiscoveryRule->copyGraphPrototypes() in C:\Development\ZBX-6994-test\frontends\php\api\classes\CDiscoveryRule.php:932]
Undefined index: [hosts.php:526 → CAPIObject->copy() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->copy() → CDiscoveryRule->copyDiscoveryRule() → CDiscoveryRule->copyGraphPrototypes() in C:\Development\ZBX-6994-test\frontends\php\api\classes\CDiscoveryRule.php:933]
Missing "itemid" field for item. [hosts.php:526 → CAPIObject->copy() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->copy() → CDiscoveryRule->copyDiscoveryRule() → CDiscoveryRule->copyGraphPrototypes() → CGraphGeneral->create() → CGraphPrototype->validateCreate() → CGraphGeneral->validateItemsCreate() → CZBXAPI::exception() in C:\Development\ZBX-6994-test\frontends\php\api\classes\CGraphGeneral.php:474]

vitalij_zab FIXED in r38826

iivs CLOSED.

Comment by Ivo Kurzemnieks [ 2013 Sep 27 ]

(7) hostinterface.get with option selectItems returns different number of items than before

vitalij_zab FIXED in r38826

iivs CLOSED.

Comment by Ivo Kurzemnieks [ 2013 Sep 27 ]

(8) Templates > item.update > in prepareInheritedItems() requesting $exItems returns fewer results that expected

vitalij_zab FIXED in r38826

iivs CLOSED.

Comment by Ivo Kurzemnieks [ 2013 Sep 27 ]

(9) triggerprototype.get with option "selectItems":"extend" doesn't return item data

vitalij_zab FIXED in r38826

iivs CLOSED.

Comment by Ivo Kurzemnieks [ 2013 Sep 27 ]

(10) Data exporting makes corrupted XML file:

[error] Undefined offset: 23603 [hosts.php:144 &rarr; CConfigurationExport->export() &rarr; CConfigurationExport->gatherData() &rarr; CConfigurationExport->gatherHosts() &rarr; CConfigurationExport->gatherHostDiscoveryRules() &rarr; CConfigurationExport->prepareDiscoveryRules() &rarr; CConfigurationExport->prepareGraphs() in C:\Development\ZBX-6994-test\frontends\php\include\classes\export\CConfigurationExport.php:674]
[error] reset() expects parameter 1 to be array, null given [hosts.php:144 &rarr; CConfigurationExport->export() &rarr; CConfigurationExport->gatherData() &rarr; CConfigurationExport->gatherHosts() &rarr; CConfigurationExport->gatherHostDiscoveryRules() &rarr; CConfigurationExport->prepareDiscoveryRules() &rarr; CConfigurationExport->prepareGraphs() &rarr; reset() in C:\Development\ZBX-6994-test\frontends\php\include\classes\export\CConfigurationExport.php:681]
[error] Undefined index: key_ [hosts.php:144 &rarr; CConfigurationExport->export() &rarr; CConfigurationExport->gatherData() &rarr; CConfigurationExport->gatherHosts() &rarr; CConfigurationExport->gatherHostDiscoveryRules() &rarr; CConfigurationExport->prepareDiscoveryRules() &rarr; CConfigurationExport->prepareGraphs() in C:\Development\ZBX-6994-test\frontends\php\include\classes\export\CConfigurationExport.php:684]
[error] Undefined offset: 23603 [hosts.php:144 &rarr; CConfigurationExport->export() &rarr; CConfigurationExport->gatherData() &rarr; CConfigurationExport->gatherHosts() &rarr; CConfigurationExport->gatherHostDiscoveryRules() &rarr; CConfigurationExport->prepareDiscoveryRules() &rarr; CConfigurationExport->prepareGraphs() in C:\Development\ZBX-6994-test\frontends\php\include\classes\export\CConfigurationExport.php:674]
[error] reset() expects parameter 1 to be array, null given [hosts.php:144 &rarr; CConfigurationExport->export() &rarr; CConfigurationExport->gatherData() &rarr; CConfigurationExport->gatherHosts() &rarr; CConfigurationExport->gatherHostDiscoveryRules() &rarr; CConfigurationExport->prepareDiscoveryRules() &rarr; CConfigurationExport->prepareGraphs() &rarr; reset() in C:\Development\ZBX-6994-test\frontends\php\include\classes\export\CConfigurationExport.php:681]
[error] Undefined index: key_ [hosts.php:144 &rarr; CConfigurationExport->export() &rarr; CConfigurationExport->gatherData() &rarr; CConfigurationExport->gatherHosts() &rarr; CConfigurationExport->gatherHostDiscoveryRules() &rarr; CConfigurationExport->prepareDiscoveryRules() &rarr; CConfigurationExport->prepareGraphs() in C:\Development\ZBX-6994-test\frontends\php\include\classes\export\CConfigurationExport.php:684]
[error] Undefined offset: 23603 [hosts.php:144 &rarr; CConfigurationExport->export() &rarr; CConfigurationExport->gatherData() &rarr; CConfigurationExport->gatherHosts() &rarr; CConfigurationExport->gatherHostDiscoveryRules() &rarr; CConfigurationExport->prepareDiscoveryRules() &rarr; CConfigurationExport->prepareGraphs() in C:\Development\ZBX-6994-test\frontends\php\include\classes\export\CConfigurationExport.php:674]
[error] reset() expects parameter 1 to be array, null given [hosts.php:144 &rarr; CConfigurationExport->export() &rarr; CConfigurationExport->gatherData() &rarr; CConfigurationExport->gatherHosts() &rarr; CConfigurationExport->gatherHostDiscoveryRules() &rarr; CConfigurationExport->prepareDiscoveryRules() &rarr; CConfigurationExport->prepareGraphs() &rarr; reset() in C:\Development\ZBX-6994-test\frontends\php\include\classes\export\CConfigurationExport.php:681]
[error] Undefined index: key_ [hosts.php:144 &rarr; CConfigurationExport->export() &rarr; CConfigurationExport->gatherData() &rarr; CConfigurationExport->gatherHosts() &rarr; CConfigurationExport->gatherHostDiscoveryRules() &rarr; CConfigurationExport->prepareDiscoveryRules() &rarr; CConfigurationExport->prepareGraphs() in C:\Development\ZBX-6994-test\frontends\php\include\classes\export\CConfigurationExport.php:684]
[error] Undefined offset: 23604 [hosts.php:144 &rarr; CConfigurationExport->export() &rarr; CConfigurationExport->gatherData() &rarr; CConfigurationExport->gatherHosts() &rarr; CConfigurationExport->gatherHostDiscoveryRules() &rarr; CConfigurationExport->prepareDiscoveryRules() &rarr; CConfigurationExport->prepareGraphs() in C:\Development\ZBX-6994-test\frontends\php\include\classes\export\CConfigurationExport.php:674]
[error] reset() expects parameter 1 to be array, null given [hosts.php:144 &rarr; CConfigurationExport->export() &rarr; CConfigurationExport->gatherData() &rarr; CConfigurationExport->gatherHosts() &rarr; CConfigurationExport->gatherHostDiscoveryRules() &rarr; CConfigurationExport->prepareDiscoveryRules() &rarr; CConfigurationExport->prepareGraphs() &rarr; reset() in C:\Development\ZBX-6994-test\frontends\php\include\classes\export\CConfigurationExport.php:681]
[error] Undefined index: key_ [hosts.php:144 &rarr; CConfigurationExport->export() &rarr; CConfigurationExport->gatherData() &rarr; CConfigurationExport->gatherHosts() &rarr; CConfigurationExport->gatherHostDiscoveryRules() &rarr; CConfigurationExport->prepareDiscoveryRules() &rarr; CConfigurationExport->prepareGraphs() in C:\Development\ZBX-6994-test\frontends\php\include\classes\export\CConfigurationExport.php:684]
[error] Undefined offset: 23606 [hosts.php:144 &rarr; CConfigurationExport->export() &rarr; CConfigurationExport->gatherData() &rarr; CConfigurationExport->gatherHosts() &rarr; CConfigurationExport->gatherHostDiscoveryRules() &rarr; CConfigurationExport->prepareDiscoveryRules() &rarr; CConfigurationExport->prepareGraphs() in C:\Development\ZBX-6994-test\frontends\php\include\classes\export\CConfigurationExport.php:674]
[error] reset() expects parameter 1 to be array, null given [hosts.php:144 &rarr; CConfigurationExport->export() &rarr; CConfigurationExport->gatherData() &rarr; CConfigurationExport->gatherHosts() &rarr; CConfigurationExport->gatherHostDiscoveryRules() &rarr; CConfigurationExport->prepareDiscoveryRules() &rarr; CConfigurationExport->prepareGraphs() &rarr; reset() in C:\Development\ZBX-6994-test\frontends\php\include\classes\export\CConfigurationExport.php:681]
[error] Undefined index: key_ [hosts.php:144 &rarr; CConfigurationExport->export() &rarr; CConfigurationExport->gatherData() &rarr; CConfigurationExport->gatherHosts() &rarr; CConfigurationExport->gatherHostDiscoveryRules() &rarr; CConfigurationExport->prepareDiscoveryRules() &rarr; CConfigurationExport->prepareGraphs() in C:\Development\ZBX-6994-test\frontends\php\include\classes\export\CConfigurationExport.php:684]

vitalij_zab FIXED in r38826

iivs CLOSED.

Comment by Ivo Kurzemnieks [ 2013 Oct 01 ]

TESTED

Comment by Vitalij Romanovskij (Inactive) [ 2013 Oct 01 ]

fixed in pre-2.1.7 (trunk) r38904

Generated at Fri Apr 26 05:34:19 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.