Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-12570

db_text throws an error, when set() is called with the current value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 3.1.0-b4
    • 3.1.0-b3
    • None
    • None

      			$sql = 'UPDATE ' . $this->table . "
      				SET config_value = '" . $this->db->sql_escape($value) . "'
      				WHERE config_name = '" . $this->db->sql_escape($key) . "'";
      			$result = $this->db->sql_query($sql);
       
      			if (!$this->db->sql_affectedrows($result))
      			{
      				$sql = 'INSERT INTO ' . $this->table . ' ' . $this->db->sql_build_array('INSERT', array(
      					'config_name'	=> $key,
      					'config_value'	=> $value,
      				));
      				$this->db->sql_query($sql);
      			}

      MySQL returns 0 when no value has been updated, so it tries to create the key again.

            nickvergessen Joas Schilling
            nickvergessen Joas Schilling
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: