Aleksas - 2012-03-23

One solution of this bug is

(%i1)
changevar1(S,tr,t,x):=block(
factor(first(S)/diff(rhs(tr),x)),
ratsubst (t,rhs(tr),%%),
if member(x,listofvars(%%))
then changevar(S,tr,t,x) else
'integrate(%%,t))\$

Test examples:
(%i2)
changevar1('integrate(sqrt(x+sin(x))*(1+cos(x)),x),t=x+sin(x),t,x);
changevar1('integrate(sqrt(x+sin(x))*(1+cos(x)),x),t=x+sin(x),t,x);
changevar1('integrate(sqrt(sin(x))*(cos(x)),x),t=sin(x),t,x);
changevar1('integrate((2+sin(x+log(x)))*(1+1/x),x),t=x+log(x),t,x);
changevar1('integrate((2+exp(x+log(x)))*(1+1/x),x),t=2+exp(x+log(x)),t,x);
changevar1('integrate((2+exp(x+sin(x)))*(1+cos(x)),x),t=x+sin(x),t,x);
changevar1('integrate(sqrt((cos(x)+sin(x)))*(sin(x)-cos(x)),x),t=cos(x)+sin(x),t,x);
changevar1('integrate(((cos(x)+sin(x)))^(1/6)*(-sin(x)+cos(x)),x),t=cos(x)+sin(x),t,x);
changevar1('integrate((log(x)+1)*sqrt(1+(x*log(x))^2),x),u=x*log(x),u,x);
changevar1('integrate((x*cos(x)+sin(x))/(x*sin(x))^2,x),y=x*sin(x),y,x);
changevar1('integrate((x^2+1)/(x^4+1),x),y=x-1/x,y,x);
changevar1('integrate(exp(sqrt(x))/sqrt(x),x),t=sqrt(x),t,x);
changevar1('integrate(sqrt(1+sqrt(x+1)),x),t=1+sqrt(x+1),t,x);
changevar1('integrate((x+1)/(x+exp(-x)),x),t=x*exp(x)+1,t,x);
(%o2) integrate(sqrt(t),t)
(%o3) integrate(sqrt(t),t)
(%o4) integrate(sqrt(t),t)
(%o5) integrate(sin(t)+2,t)
(%o6) integrate(t/(t-2),t)
(%o7) integrate(%e^t+2,t)
(%o8) -integrate(sqrt(t),t)
(%o9) integrate(t^(1/6),t)
(%o10) integrate(sqrt(u^2+1),u)
(%o11) integrate(1/y^2,y)
(%o12) integrate(1/(y^2+2),y)
(%o13) 2*integrate(%e^t,t)
(%o14) integrate(2*t^(3/2)-2*sqrt(t),t)
(%o15) integrate(1/t,t)

Aleksas D