Busr bin Saeed reported,

Zayd bin Khalid sent him to Abu Juhaym to ask what he had heard from the Messenger of Allah ﷺ concerning a person passing in front of someone praying.Abu Juhaym said, "The Messenger of Allah ﷺ said, 'If the one who passes in front of a person praying knew the consequence of his action, standing still for forty would be better for him than passing in front of him.'"Abu Nadr said, "I do not know whether he said forty days, forty months, or forty years."

Bukhari 510

Sahih

حدثنا عبد الله بن يوسف قال أخبرنا مالك عن أبي النضر مولى عمر بن عبيد الله

عن بسر بن سعيد

أن زيد بن خالد أرسله إلى أبي جهيم يسأله ماذا سمع من رسول الله ﷺ في المار بين يدي المصلي فقال أبو جهيم قال رسول الله ﷺ لو يعلم المار بين يدي المصلي ماذا عليه لكان أن يقف أربعين خيرا له من أن يمر بين يديه قال أبو النضر لا أدري أقال أربعين يوما أو شهرا أو سنة

البخاري 510صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Prayer
Chapter
Sin of passing in front of one who is praying
Numbering
Darussalam 510
Bukhari 510