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

Custom profile manager should not suppress errors when inserting user rows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.1.0-RC4
    • 3.1.0-b4
    • None
    • None

      		$sql = 'UPDATE ' . $this->fields_data_table . '
      			SET ' . $this->db->sql_build_array('UPDATE', $cp_data) . '
      			WHERE user_id = ' . (int) $user_id;
      		$this->db->sql_query($sql);
       
      		if (!$this->db->sql_affectedrows())
      		{
      			$cp_data = $this->build_insert_sql_array($cp_data);
      			$cp_data['user_id'] = (int) $user_id;
       
      			$this->db->sql_return_on_error(true);
       
      			$sql = 'INSERT INTO ' . $this->fields_data_table . ' ' . $this->db->sql_build_array('INSERT', $cp_data);
      			$this->db->sql_query($sql);
       
      			$this->db->sql_return_on_error(false);
      		}

      The "return on error" was added before we had PHPBB3-12570 to prevent errors when adding rows a second time.
      Since sql_affectedrows() works correctly now, the sql_return_on_error() calls should be removed.

            bantu Andreas Fischer [X] (Inactive)
            nickvergessen Joas Schilling
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: