Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-7389

string values of profiles table (value_str) are updated rounded by single quotes

    XMLWordPrintable

    Details

    • Type: Incident report
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 1.8.18
    • Fix Version/s: None
    • Component/s: Frontend (F)
    • Labels:
      None

      Description

      profiles table string values are stored in db rounded by an unwanted set of single quotes.

      for example, when you open any host's items list (let's say TESTHOST), modify any of its existing item by clicking on item name and save, by the time you got back to host's item list, filter "Host:" changes from TESTHOST to 'TESTHOST', and you don't see this host items anymore.

      the same 'quoting' transformation happens to any string filter values, Host group, Application, Description etc.

      the problem is in private static function updateDB($idx, $value, $type, $idx2){ of include/profiles.inc.php:
      ---------------
      $value_type = self::getFieldByType($type);
      $value = ($value_type == 'value_str') ? zbx_dbstr($value) : $value;

      $sql = 'UPDATE profiles SET '.
      $value_type.'='.zbx_dbstr($value).','.
      ' type='.zbx_dbstr($type).
      ' WHERE userid='.$USER_DETAILS['userid'].
      ' AND idx='.zbx_dbstr($idx).
      $sql_cond;

      $result = DBexecute($sql);
      ---------------

      as you can see, if $value_type is 'value_str', $value gets transformed by zbx_dbstr() twice, which leads to storing \'$value\' instead of $value in db.

      there might be another places where ZBX-7091 caused unwanted sideeffects, but multitude of zbx_dbstr calls makes it very hard to find them.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              alix alix
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: