[ZBX-985] Dbexecute on pgsql return integer which may not work with binary AND Created: 2009 Jul 11  Updated: 2017 May 30  Resolved: 2009 Sep 30

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

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

using zabbix 1.6.5, issue present in branches/1.6 and trunk.
database is postgresql.
PHP 5.1.6 (RHEL5.3).



 Description   

Use case was to simply create a user-group which failed.
Looking at the code, the part failing:

                $result&=change_group_status($usrgrpid,$users_status);
                $result&=change_group_gui_access($usrgrpid,$gui_access);
                if(!$result) return     $result;

in frontends/php/include/users.inc.php.

The reason is because pg_query in db.inc.php will return a resource ID (integer ?) which may return false on a binary AND. In my case, the previous value of $result was resource 127 and the return of change_group_status() was 128. Doing a binary AND between 127 and 128 returned false.

In my case, I patched the file users.inc.php, but you may just want to patch DBexecute to force it to return a boolean true/false.



 Comments   
Comment by Artem Suharev (Inactive) [ 2009 Sep 30 ]

Will be fixed in ZBX 1.6.7 and ZBX 1.8

Comment by richlv [ 2009 Nov 10 ]

close old, resolved issues

Generated at Wed Apr 24 00:26:55 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.