We say: this is a person who witnessed the matter while of sound mind, then became insane, and then regained his reason. We do not say that this insanity invalidates his testimony. Rather, we say that if he gives testimony after regaining his reason, we accept it. The same applies to a man who suffers an accident that impairs his mind, then Allah grants him recovery. We do not say that this impairment erases his previous memory and that his testimony cannot be accepted. Rather, we say that it is accepted, because this witness witnessed the matter while of sound mind and gave testimony while of sound mind.
His statement, “and the disbeliever embraces Islam”: he witnessed the matter while a disbeliever and gave testimony while a Muslim, so his testimony is accepted. But if he witnessed it while a Muslim and gave testimony while a disbeliever, it is not accepted.
His statement, “and the openly sinful person repents”: his testimony is then accepted. That is, a man witnessed the matter while openly sinful—for example, he did not pray in congregation—but Allah guided him and he began praying in congregation; his testimony is accepted. Thus, uprightness, Islam, and maturity are conditions for giving testimony, not for witnessing the matter. As for the ability to speak, we should likewise say that it is a condition only for giving testimony. If someone witnessed the matter while mute and gave testimony while able to speak, his testimony is accepted, even according to the school of law. According to the correct view, however, the detailed discussion of this has already preceded. Thus, the ability to speak is a condition only for giving testimony. Therefore, four of the six conditions apply to witnessing the matter, whereas all six are conditions for giving testimony.
In summary: whoever witnessed the matter while a minor and gave testimony after reaching maturity, his testimony is accepted. Whoever witnessed it while openly sinful and gave testimony after becoming upright, his testimony is accepted; but his testimony is not accepted if he witnessed it while upright and gave testimony while openly sinful. And whoever witnessed the matter while of sound mind, his testimony is not accepted during his insanity; but if he regains his reason after becoming insane, his testimony concerning what he witnessed before the insanity is accepted.