Appeal from a judgment of the County Court of Clinton County which denied relator’s petition for a writ of habeas corpus. The relator correctly contends that his conviction on December 5, 1966 was invalid by reason of the sentencing court’s failure to comply with section 335-b (now 335-e) of the Code of Criminal Procedure, which required that the relator be informed, before acceptance of his plea of guilty, that if it should appear that he had been previously convicted of a felony, he would be subject to different or additional punishment. Our determination must be premised with the oft-repeated holding that prior to the acceptance of a plea of guilty the court must inform the defendant that if he has previously been convicted of a crime or offense, he will be subjected to different or additional punishment (People ex rel. Golan v. La Vallee, 14 N Y 2d 83; Code Grim. Pro., § 335-b). The respondent advances the argument that compliance with section 335-b was not required for the reason that the crime to which relator pleaded guilty (Penal Law, § 1897, subd. 3) actually contained a warning that a prior conviction would result in additional punishment for it provides that the illegal possession of certain weapons is a misdemeanor but that a person “is guilty of a felony if he has previously been convicted of any crime”. With this contention we cannot agree. Not only does the warning statute (Code Grim. Pro., § 335-b) mandate the court to advise a defendant that any previous conviction might subject him to different or additional punishment, but here, the defendant actually pleaded guilty to the crime as a felony and thereafter the District Attorney filed the information charging the relator “ as being a second felony offender ”; and the record shows he was sentenced as a “second felony offender”. The warning to be given is a matter of substance (People v. Dwell, 1 N Y 2d 132) and “required that the court give to defendant the notice therein prescribed before accepting his plea of guilty, even though such notice may have previously been given upon defendant’s arraignment” (People ex rel. Carlat v. Follette, 21 N Y 2d 732, 733; see, also, People ex rel. Manning v. Fay, 16 N Y 2d 1061). Judgment reversed, on the law and the facts, without costs. Writ granted, conviction vacated and relator remanded to the County Court of Essex County for rearraignment, repleading and other necessary and appropriate proceedings not inconsistent herewith. Gibson, P. J., Herlihy, Aulisi, Staley, Jr., and Gabrielli, JJ., concur in memorandum decision by Gabrielli, J.