Q: Does the fast break if by squeezing the thighs together ejaculation takes place or if by thinking of women ejaculation takes place? Will this be counted as masturbation and will kaffarah be wajib ?
A: Even in masturbation, Qadhaa will become Waajib and not Kaffaarah. In the first case you mentioned, Qadhaa will be necessary and not Kaffaarah.
If ejaculation takes place by thinking (without touching, squeezing or rubbing at all), the fast will not break.
Moulana Yusuf Laher