Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55626 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97159 invoked from network); 25 Sep 2011 06:08:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Sep 2011 06:08:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=alan@akbkhome.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=alan@akbkhome.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain akbkhome.com designates 202.81.246.113 as permitted sender) X-PHP-List-Original-Sender: alan@akbkhome.com X-Host-Fingerprint: 202.81.246.113 246-113.netfront.net Received: from [202.81.246.113] ([202.81.246.113:55734] helo=246-113.netfront.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F8/30-29562-A55CE7E4 for ; Sun, 25 Sep 2011 02:08:27 -0400 Received: from wideboyhd.local ([192.168.0.28]) by akbkhome.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Mailfort v1.2) (envelope-from ) id 1R7ht0-0000Wh-O9 for internals@lists.php.net; Sun, 25 Sep 2011 14:08:22 +0800 Message-ID: <4E7EC551.2070202@akbkhome.com> Date: Sun, 25 Sep 2011 14:08:17 +0800 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Thunderbird/3.1.13 MIME-Version: 1.0 To: internals@lists.php.net References: <4E790B82.6090805@akbkhome.com> <8C.A0.17510.E4DE97E4@pb1.pair.com> <1316615094.2810.5.camel@guybrush> <1316629502-sup-831@fewbar.com> <20110922134956.GA28577@panix.com> <1316709104-sup-2744@fewbar.com> <1316713382.1290.60.camel@guybrush> <4E7BBA23.2080001@lerdorf.com> <4E7BC6BF.6080702@akbkhome.com> <4E7C5A24.8080305@lerdorf.com> <4E7E8B48.1060209@akbkhome.com> <4E7EA5B7.9010606@sugarcrm.com> In-Reply-To: <4E7EA5B7.9010606@sugarcrm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-mailfort-sig: 362df597e049667df40bcfcd0618eecf Subject: Re: [PHP-DEV] Backward Compatibility RFC - was Re: [PHP-DEV] Re: is_a() - again - a better fix From: alan@akbkhome.com (Alan Knowles) Sorry, never even noticed instanceof got fixed (in 5.1) with undefined classes. Since it did not work when introduced, i just assumed it would stay that way....... Anyway, It's a pretty good justification for phased "Announced" long term depreciation plan in 5.4 is_a() usage called without a third argument shows depreciated warning pointing to a message that you should use instanceof (as it has worked ok since 5.1) Then changing the behavior in 5.5 / 1yr+ and changing the default to true is a BC plan. Only downside is that users of is_a() for class string/autoload testing have to put true at the end, and eventually can remove it after a few years. Regards Alan On Sunday, September 25, 2011 11:53 AM, Stas Malyshev wrote: > Hi! > > On 9/24/11 7:00 PM, Alan Knowles wrote: >> Obviously I'd be keen to see this fix applied to 5.4 as the standard use >> case for is_a() is mixed return testing as '$x instanceof "somestring"' >> does not work. > > There is no reason to do $x instanceof "somestring" as you can do just > $x instanceof Class. And for 99% of cases I've seen the second > argument of is_a was constant - which means this code was plain wrong, > there's no reason to use is_a in such case. In case you do have to use > is_a - namely, when you have variable arguments - it would be rather > strange if first argument wouldn't support string as class name, but > the second one would, and moreover, is_subclass_of also would. >