Sahih al-Bukhari 714
Abdullah bin Maslamah narrated to us. He narrated from Malik bin Anas, Malik from Ayyub bin Abi Tamimah Sakhtiyani, Ayyub from Muhammad bin Sirin, Ibn Sirin from Hazrat Abu Hurairah (ra), that the Messenger of Allah (saw) said the Salam after only two Rak'ahs. So Dhul Yadain said to him: O Messenger of Allah (saw)! Has the Prayer been shortened, or have you forgotten? The Messenger of Allah (saw) asked: “Has Dhul Yadain spoken correctly?” The people said: Yes. So the Messenger of Allah (saw) stood up and offered the last two Rak'ahs. Then he said the Salam. After that he said “Allahu akbar” and prostrated, just as he had prostrated before, or somewhat longer.
AI-translated by Islam-Today
Book 69: Can the Imam depend on the people's saying if he is in doubt (about a certain matter)?