Muhammad reported that the Messenger of Allah ﷺ said, "Does the one who raises his head before the imam not fear that Allah might turn his head into the head of a donkey?"Qutayba said that Hammad said, "Muhammad bin Ziyad said to me, what he actually said was, 'Does he not fear...'"
حدثنا قتيبة حدثنا حماد بن زيد عن محمد بن زياد وهو أبو الحارث البصري ثقة
قال محمد ﷺ أما يخشى الذي يرفع رأسه قبل الإمام أن يحول الله رأسه رأس حمار قال قتيبة قال حماد قال لي محمد بن زياد وإنما قال أما يخشى
Agreed upon by Bukhari and Muslim. Muslim narrated it in the Book of Prayer, Chapter on the Prohibition of Preceding the Imam in Bowing or Prostrating or the Like, hadith no. 427, from the hadith of Hammad bin Zayd, and Bukhari, hadith no. 691, from the hadith of Muhammad bin Ziyad, through him.