Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17581 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99631 invoked by uid 1010); 8 Aug 2005 09:50:32 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 99608 invoked from network); 8 Aug 2005 09:50:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Aug 2005 09:50:31 -0000 X-Host-Fingerprint: 82.94.239.5 jdi.jdi-ict.nl Linux 2.5 (sometimes 2.4) (4) Received: from ([82.94.239.5:40388] helo=jdi.jdi-ict.nl) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id A5/8E-04646-5EA27F24 for ; Mon, 08 Aug 2005 05:50:30 -0400 Received: from localhost (localhost [127.0.0.1]) by jdi.jdi-ict.nl (8.12.11/8.12.11) with ESMTP id j789oPQB027282 for ; Mon, 8 Aug 2005 11:50:25 +0200 Received: from localhost (localhost [127.0.0.1]) by jdi.jdi-ict.nl (8.12.11/8.12.11) with ESMTP id j789oKjK027272 for ; Mon, 8 Aug 2005 11:50:20 +0200 Date: Mon, 8 Aug 2005 11:50:20 +0200 (CEST) X-X-Sender: derick@localhost To: PHP Developers Mailing List Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at jdi-ict.nl Subject: type hinting throwing a fatal error From: derick@php.net (Derick Rethans) Hei, currently if you pass a wrong object's type to a typehinted parameter: derick@kossu:~$ cat /tmp/foo.php bar(new stdClass); ?> derick@kossu:~$ php /tmp/foo.php Fatal error: Argument 1 must be an instance of foo in /tmp/foo.php on line 3 As type hinting is a new OO thing, it might perhaps make some sense to make this an exception instead - as this error might also happen for dynamic things by people who use the classes you designed. In that case having this fatal error to stop the whole application can be annoying. Opinions? Derick