All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
The intention is considered in the oath as stated by the jurists . So, if that man – that is, the person who asked the other person to make an oath – intended that the person who makes the oath should not inform anybody else – and this is the case in general – then the person who made the oath is not breaking his oath by informing him [i.e. the person who told him to make an oath]. However, if he intended that he should not speak to anyone else including the person who told him to make an oath – and this is highly unlikely – then he is considered as breaking the oath by informing him; in which case, he is obliged to expiate for breaking the oath.
Finally, it should be noted that if a person is told a secret, he should preserve it and not reveal it to other people. Al-Ghazaali said in his book entitled Ihyaa’ 'Uloom Ad-Deen, “Disclosing a secret is betrayal and this is forbidden if it causes harm, and if it does not cause any harm to others, then it is (still) wickedness."
Allaah Knows best.