Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53836 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89110 invoked from network); 11 Jul 2011 08:21:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jul 2011 08:21:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.199.177.89 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 212.199.177.89 il-mr1.zend.com Received: from [212.199.177.89] ([212.199.177.89:43031] helo=il-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/35-41672-05CAA1E4 for ; Mon, 11 Jul 2011 03:54:57 -0400 Received: from il-gw1.zend.com (unknown [10.1.1.22]) by il-mr1.zend.com (Postfix) with ESMTP id 72E0F60715; Mon, 11 Jul 2011 10:53:46 +0300 (IDT) Received: from tpl2.home (10.1.10.4) by il-ex2.zend.net (10.1.1.22) with Microsoft SMTP Server id 14.1.255.0; Mon, 11 Jul 2011 10:54:41 +0300 Message-ID: <4E1AAC49.50102@zend.com> Date: Mon, 11 Jul 2011 11:54:49 +0400 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc15 Lightning/1.0b3pre Thunderbird/3.1.10 MIME-Version: 1.0 To: Stas Malyshev 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> <4E1AA582.1070201@sugarcrm.com> In-Reply-To: <4E1AA582.1070201@sugarcrm.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.1.10.4] 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: dmitry@zend.com (Dmitry Stogov) Hi Stas, On 07/11/2011 11:25 AM, Stas Malyshev wrote: > 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. > That warning might be only emitted if the first operand is a name of non existing class. is_a("NonExistingClass", "MyClass"); I think this warning may make sense. :) Thanks. Dmitry.