We propose a general formulation for nonisothermal multiphase flow of brine and gas through saline media. The balance equations include mass balance (three species), equilibrium of stresses and energy balance (total internal energy). Salt, water and air mass balance equations are established. The balance of salt allows the establishment of the equation for porosity evolution due to solid skeleton deformation, dissolution/precipitation of salt and migration of brine inclusions. Water and air mass balance equations are also obtained. Two equations are required for water: total water in the medium and water present in solid phase brine inclusions. The mechanical problem is formulated through the equation of stress equilibrium. Finally, the balance of internal energy is established assuming thermal equilibrium between phases. Some general aspects of the constitutive theory are also presented.