Type hinting and exceptions

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
georgeoc
Forum Contributor
Posts: 166
Joined: Wed Aug 09, 2006 4:21 pm
Location: London, UK

Type hinting and exceptions

Post by georgeoc »

php manual wrote:Failing to satisfy the type hint results in a catchable fatal error.
I can't seem to make this work. When a type-hinting error is generated inside a try-catch block, the exception is not caught. Instead a E_RECOVERABLE_ERROR is generated. PHP 5.2.3.

Ta
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Re: Type hinting and exceptions

Post by Ambush Commander »

Try overloading the error handler. I don't think they mean "catch" as in try/catch style.
georgeoc
Forum Contributor
Posts: 166
Joined: Wed Aug 09, 2006 4:21 pm
Location: London, UK

Re: Type hinting and exceptions

Post by georgeoc »

Oh I see. I was taking it too literally.

Thanks!
Post Reply