To find out this basic integral $$\int_0^{\pi} \frac{\sin(x)}{1+\sin(x)} \,\mathrm{d}x$$ I though of two methods :
Method 1:
I started by multiplying and dividing by $1-\sin(x)$ and then manipulating it one easily gets - $$\int_0^{\pi} {(\sec(x)\tan(x) - (\tan(x))^2})\,\mathrm{d}x$$ Which is quite easy to calculate and gives value of $\pi-2$ I do not have any problem with this method , even though it took me some time to solve it.
Method 2 : This was first thing I had thought of :
To let $\sin(x)=t$ and then when I tried to change the limits of integral I found that this substitution makes both upper and lower limits as $t=0$ which would give The value of above integral = 0 , according to the property $\int_a^a f(x)\,\mathrm{d}x = 0$.
But the previous method gives answer of $\pi-2$ then what is wrong with the method 2 . Is that substitution incorrect ? But how and why ?