Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53831 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67552 invoked from network); 11 Jul 2011 07:25:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jul 2011 07:25:59 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.163 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.163 smtp163.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.163] ([67.192.241.163:59164] helo=smtp163.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5E/63-41672-685AA1E4 for ; Mon, 11 Jul 2011 03:25:59 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp16.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id F016540177; Mon, 11 Jul 2011 03:25:55 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp16.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 3B5184016B; Mon, 11 Jul 2011 03:25:55 -0400 (EDT) Message-ID: <4E1AA582.1070201@sugarcrm.com> Date: Mon, 11 Jul 2011 00:25:54 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: Dmitry Stogov CC: Ralph Schindler , "internals@lists.php.net" , =?UTF-8?B?Sm9oYW5uZXMgU2NobMO8dGVy?= References: <1310072926.3298.32.camel@guybrush> <4E171A47.9010609@smashlabs.com> <4E1AA3B7.7050907@zend.com> In-Reply-To: <4E1AA3B7.7050907@zend.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/Zend/tests/bug53727.phpt branches/PHP_5_3/Zend/tests/is_a.phpt branches/PHP_5_3/Zend/zend_builtin_functions.c branches/PHP_5_3/ext/standard/tests/class_object/is_a_ From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! On 7/11/11 12:18 AM, Dmitry Stogov wrote: > Hi Ralph, > > I don't have strong opinion about your suggestion. > > In some cases this warning might help to find a typo, in others it may > be useless, but anyway, I think that usage of undefined class name is a > quite rare situation. I would prefer to keep it as is. It's not as rare, if people use is_a the same way as instanceof. Example I've seen recently - suppose you've got a method that receives either instance of an object or it's ID, something like this: function process($obj) { if(!is_a($obj, "MyClass") { $obj = new MyClass($obj); } // process $obj } Here you've got a new warning. Of course, you could do just $obj instanceof MyClass, but it's a very subtle distinction which many people miss. So the thing here is not that $obj has unknown class name - it's not even a class name at all. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227