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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • 3.1.0-b3
    • 3.1.0-b4
    • None
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: