Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53835 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87739 invoked from network); 11 Jul 2011 08:18:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jul 2011 08:18:20 -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.203 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.203 smtp203.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.203] ([67.192.241.203:60043] helo=smtp203.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 28/87-41672-BC1BA1E4 for ; Mon, 11 Jul 2011 04:18:20 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp20.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 6F696258228; Mon, 11 Jul 2011 04:18:17 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp20.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id A1CC72580AB; Mon, 11 Jul 2011 04:18:16 -0400 (EDT) Message-ID: <4E1AB1C8.1020809@sugarcrm.com> Date: Mon, 11 Jul 2011 01:18:16 -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> <4E1AA582.1070201@sugarcrm.com> <4E1AAC49.50102@zend.com> In-Reply-To: <4E1AAC49.50102@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! > That warning might be only emitted if the first operand is a name of non > existing class. > > is_a("NonExistingClass", "MyClass"); I think you've missed my point. The point was people use this to check if first argument is an instance of a certain class or something else - and "something else" may not be a class name at all, just random string that they'll use later. > I think this warning may make sense. :) I disagree, if you look at how people are using is_a on Google's codesearch, you'll see that many use it in the same manner as instanceof. In this case, the warning is useless since the first argument is not meant to be class name, so it's no use to warn that it is not - it does not add any information and does not expose any bug. Here's an example of PEAR code: function isError($data, $code = null) { if (!is_a($data, 'PEAR_Error')) { return false; } if (is_null($code)) { return true; } elseif (is_string($code)) { return $data->getMessage() == $code; } return $data->getCode() == $code; } } I'm sure there is more code like that out there. And in such code, producing a warning has no other result but make people to add useless checks that have no other purpose but avoid warnings and annoy them. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227