Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-12570

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

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.1.0-b3
    • Fix Version/s: 3.1.0-b4
    • Component/s: None
    • Labels:
      None

      Description

      			$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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: