Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53834 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86506 invoked from network); 11 Jul 2011 08:17:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jul 2011 08:17:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=hannes.magnusson@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=hannes.magnusson@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.170 as permitted sender) X-PHP-List-Original-Sender: hannes.magnusson@gmail.com X-Host-Fingerprint: 209.85.161.170 mail-gx0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:60295] helo=mail-gx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0E/37-41672-A91BA1E4 for ; Mon, 11 Jul 2011 04:17:30 -0400 Received: by gxk27 with SMTP id 27so1596235gxk.29 for ; Mon, 11 Jul 2011 01:17:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=ci+Amk8gzaDPLSJKHkMok/X9KrdEeaA5quGLLIL5K24=; b=kDJrbhM50YkYPPcLgewOpGyjpPomab01uPc3ryxbmPUOLUqmh8WfnkzWCA2f6mP96C UCiIVObXDYjZFrNnTzVruxGhmvQzIudkwSGWZJQHx14jrmSxBe9h5JhtiADHhmIsxngI FIyaOEfe7URojFdpZjvLLJ7ULWXWrjrixeG68= MIME-Version: 1.0 Received: by 10.147.86.18 with SMTP id o18mr3564026yal.17.1310372247752; Mon, 11 Jul 2011 01:17:27 -0700 (PDT) Received: by 10.147.35.14 with HTTP; Mon, 11 Jul 2011 01:17:27 -0700 (PDT) In-Reply-To: <4E1AA582.1070201@sugarcrm.com> References: <1310072926.3298.32.camel@guybrush> <4E171A47.9010609@smashlabs.com> <4E1AA3B7.7050907@zend.com> <4E1AA582.1070201@sugarcrm.com> Date: Mon, 11 Jul 2011 10:17:27 +0200 Message-ID: To: Stas Malyshev Cc: Dmitry Stogov , Ralph Schindler , "internals@lists.php.net" , =?UTF-8?Q?Johannes_Schl=C3=BCter?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: hannes.magnusson@gmail.com (Hannes Magnusson) On Mon, Jul 11, 2011 at 09:25, 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) > { > =C2=A0if(!is_a($obj, "MyClass") { > =C2=A0 =C2=A0 $obj =3D new MyClass($obj); > =C2=A0} > =C2=A0// process $obj > } > > Here you've got a new warning. Of course, you could do just $obj instance= of > MyClass, but it's a very subtle distinction which many people miss. So th= e > thing here is not that $obj has unknown class name - it's not even a clas= s > name at all. Isn't this exactly why is_a() was un-deprecated in the firstplace? Getting warnings from is_a() would be very weird. -Hannes