Praise be to Allah.
Shaykh al-Shanqeeti said, commenting on the aayah (interpretation of the meaning):
“Do you think that the people of the Cave and the Inscription (the news or the names of the people of the Cave) were a wonder among Our Signs?” [al-Kahf 18:9]
The apparent meaning is that the People of the Cave and of the Inscription were all one group, mentioned in conjunction with two things. This is in contrast to those who say that the people of the Cave were one group and the people of the Inscription were another group. Allaah told this story to His Prophet (peace and blessings of Allaah be upon them) in this soorah, and He did not mention anything about the people of the Inscription. This is unlike those who claim that the people of the Cave were three persons behind whom the rock fell and blocked the entrance of the cave in which they were, so they prayed to Allaah by virtue of their righteous deeds; they were one who honoured his parents, one who was chaste, and one who was a hired labourer. Their story is well known and is proven in al-Saheeh, but interpreting this aayah as meaning that these were the people referred to therein is far-fetched as you can see. It should be noted there is nothing about the story of the people of the cave, their names and which part of the earth they were in that has been narrated in any sound report from the Prophet (peace and blessings of Allaah be upon him), in addition to what is mentioned in the Qur’aan. The Mufassireen quoted many of those details from the Israa’eeliyyaat (reports from Jewish sources) which we will not quote here because they cannot be relied upon.