Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52950 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28281 invoked from network); 5 Jun 2011 18:16:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jun 2011 18:16:50 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-ww0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:34329] helo=mail-ww0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 73/26-26000-E08CBED4 for ; Sun, 05 Jun 2011 14:16:47 -0400 Received: by wwd20 with SMTP id 20so2933478wwd.11 for ; Sun, 05 Jun 2011 11:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=m5aaT7FkeWItZZTV1HGgzuqKbyP+7pfr9yOhLfkcYyg=; b=J+lCr7vflvUjkO2fD0X8gyOOOL0wNtkwcRCyujQDYQkZt5BmzbmWqjFgJnk9OQX/Nh HTC3WVcxbLi6nngIqTd9ilUEjqq+K9Grh0v6+lilayvqnnFirLoRhHCB7DHOzPGwguzJ bDBakkRjHVkPWHRSG6uZ+jRWsN51fvkGjjSjc= DomainKey-Signature: a=rsa-sha1; c=nofws; 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; b=s3NBkPdruBrjMtbIFM3kC9zgWxNmj8TiYOeWovWvAgn7Kc2kVpD7GSf3yEBZpgIGa8 86D+AIMIpVR9aVT5EFEMu2aBflfyC4/v/lUd6Tcp9iNIeeifokuoK+0V30DiDZngfwSV RMQ+xnyVgnIdmxmTZlaa5lWgxWzbrsZmamNvo= MIME-Version: 1.0 Received: by 10.216.229.229 with SMTP id h79mr1298461weq.74.1307297802790; Sun, 05 Jun 2011 11:16:42 -0700 (PDT) Sender: tyra3l@gmail.com Received: by 10.216.64.6 with HTTP; Sun, 5 Jun 2011 11:16:42 -0700 (PDT) In-Reply-To: References: Date: Sun, 5 Jun 2011 20:16:42 +0200 X-Google-Sender-Auth: MOkQB66bUWUysLbk-H5Tj_pYVG8 Message-ID: To: Felipe Pena Cc: internals Content-Type: multipart/alternative; boundary=0016e644c6c826a64904a4fafd7f Subject: Re: [PHP-DEV] $arr = array('Hello', 'world'); $arr(); From: info@tyrael.hu (Ferenc Kovacs) --0016e644c6c826a64904a4fafd7f Content-Type: text/plain; charset=UTF-8 On Sun, Jun 5, 2011 at 5:52 PM, Felipe Pena wrote: > Hi all, > Reading our bug tracker I noticed a good feature request [1] from 2009 > which > points to an interesting feature that I think makes sense for us, since we > are now working with $f() using objects and strings, and the array('class', > 'method') is an old known for call_user_func()-like functions. > > So, I wrote a patch [2] that allow such behavior to be consistent with > arrays. See some examples: > > class Hello { > public function world($x) { > echo "Hello, $x\n"; return $this; > } > } > > $f = array('Hello','world'); > var_dump($f('you')); > > $f = array(new Hello, 'foo'); > $f(); > > All such calls match with the call_user_func() behavior related to magic > methods, static & non-static methods. > > The array to be a valid callback should be a 2-element array, and it must > be > for the first element object/string and for the second string only. (just > like our zend_is_callable() check and opcodes related to init call) > > Any thoughts? > > [1] - http://bugs.php.net/bug.php?id=47160 > [2] - http://felipe.ath.cx/diff/fr47160.diff > phpt: http://felipe.ath.cx/diff/fr47160.phpt > > -- > Regards, > Felipe Pena > +1 Tyrael --0016e644c6c826a64904a4fafd7f--