Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54247 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79869 invoked from network); 29 Jul 2011 08:29:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jul 2011 08:29:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.42 as permitted sender) X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 209.85.161.42 mail-fx0-f42.google.com Received: from [209.85.161.42] ([209.85.161.42:36167] helo=mail-fx0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BD/A0-07983-82F623E4 for ; Fri, 29 Jul 2011 04:28:25 -0400 Received: by fxe23 with SMTP id 23so2359270fxe.29 for ; Fri, 29 Jul 2011 01:28:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=NpJT53svmNUf1A9xc1C7m2327pD4QjMlHz3gGuORmt4=; b=MLELclP51ke3W/C4nOaR5JBcgjYnUiWgncr/h8m0VlxKEnHGOAiZic/o2X+jalUOtC YtG+LrkcosZtqyJXYIaiBaQSEVNHjAUoQDpyaJlkfHYTchyTvK4YZIHGQu01b758ROBp dFb5AxJSkCjFjIBJ80vNlWwGLVN2oPVb+KL4s= MIME-Version: 1.0 Received: by 10.204.8.82 with SMTP id g18mr329998bkg.11.1311928101360; Fri, 29 Jul 2011 01:28:21 -0700 (PDT) Sender: ekneuss@gmail.com Received: by 10.204.122.80 with HTTP; Fri, 29 Jul 2011 01:28:21 -0700 (PDT) In-Reply-To: References: Date: Fri, 29 Jul 2011 10:28:21 +0200 X-Google-Sender-Auth: vQ-uGurnMnFEmnmQukF3OzTg0Ps Message-ID: To: Laruence Cc: PHP Internals , Felipe Pena , Pierre Joye , =?UTF-8?Q?Johannes_Schl=C3=BCter?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [Bug #55311] Static methods invoke __call when called from within class From: colder@php.net (Etienne Kneuss) Hi, On Fri, Jul 29, 2011 at 05:37, Laruence wrote: > Hi: > =C2=A0 =C2=A0 about #55311.https://bugs.php.net/bug.php?id=3D55311 > > =C2=A0 =C2=A0 I found it maybe for some reason, that somebody change the > if/elseif sequence to make this bug. > > =C2=A0 =C2=A0 but I am not sure about why he do this, =C2=A0so I refer to= maillist, =C2=A0any idea? This is not a bug. If you call a method using the Foo::bar() syntax, you don't necessarily get a static call. A static call is made if either: 1) the target method is declared as static 2) There is no compatible object context at the time of the call. In this case, it is not a static call, as the method is undeclared (hence cannot be declared as static) and you do have a compatible object context. So __call is used, not __callstatic. Best, > > =C2=A0 =C2=A0Index: Zend/zend_object_handlers.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- Zend/zend_object_handlers.c (revision 313905) > +++ Zend/zend_object_handlers.c (working copy) > @@ -988,13 +988,13 @@ > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!fbc && zend_hash_find(&ce->function_table= , lc_function_name, > function_name_strlen+1, (void **) &fbc)=3D=3DFAILURE) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0efree(lc_function_= name); > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ce->__call && > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ce->__callstatic) = { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 return zend_get_user_callstatic_function(ce, function_name_strval, > function_name_strlen); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else if (ce->__call = && > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0EG(T= his) && > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Z_OB= J_HT_P(EG(This))->get_class_entry && > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0inst= anceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0return zend_get_user_call_function(ce, function_name_strval, > function_name_strlen); > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else if (ce->__calls= tatic) { > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 return zend_get_user_callstatic_function(ce, function_name_strval, > function_name_strlen); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} else { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0return NULL; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} > -- > Laruence =C2=A0Xinchen Hui > http://www.laruence.com/ > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Etienne Kneuss http://www.colder.ch