Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17593 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57022 invoked by uid 1010); 8 Aug 2005 12:17:50 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 57007 invoked from network); 8 Aug 2005 12:17:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Aug 2005 12:17:49 -0000 X-Host-Fingerprint: 85.92.69.73 iko.gotobg.net Linux 2.4/2.6 Received: from ([85.92.69.73:43033] helo=iko.gotobg.net) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id A5/D4-04646-C6D47F24 for ; Mon, 08 Aug 2005 08:17:48 -0400 Received: from cpanel by iko.gotobg.net with local (Exim 4.50) id 1E26ZS-0001oB-WB; Mon, 08 Aug 2005 15:17:36 +0300 Received: from 194.39.131.39 ([194.39.131.39]) by hristov.com (Horde) with HTTP for ; Mon, 08 Aug 2005 14:17:32 +0200 Message-ID: <20050808141732.lienuuns5ds4w0ks@hristov.com> Date: Mon, 08 Aug 2005 14:17:32 +0200 To: Derick Rethans Cc: PHP Developers Mailing List References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1251; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.0) Sender: X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - iko.gotobg.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [32001 32569] / [47 12] X-AntiAbuse: Sender Address Domain - hristov.com X-Source: /usr/local/cpanel/3rdparty/bin/php X-Source-Args: /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/base/horde/imp/compose.php X-Source-Dir: :/base/horde/imp Subject: Re: [PHP-DEV] type hinting throwing a fatal error From: php@hristov.com (Andrey Hristov) Hmm, I was complaining about inusaability ot type hinting because of this fatal errors but nobody seems heard me :(. One better do a check in the code than risking a fatal error which is unstoppable... I call this showstopper if we say that we are proud with the type-hinting. Andrey Quoting Derick Rethans : > Hei, > > currently if you pass a wrong object's type to a typehinted parameter: > > derick@kossu:~$ cat /tmp/foo.php > class foo { > function bar(foo $a) > { > } > } > > $a = new foo; > $a->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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >