Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56969 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6144 invoked from network); 20 Dec 2011 23:43:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Dec 2011 23:43:37 -0000 Authentication-Results: pb1.pair.com header.from=markg85@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=markg85@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.170 as permitted sender) X-PHP-List-Original-Sender: markg85@gmail.com X-Host-Fingerprint: 209.85.216.170 mail-qy0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:33209] helo=mail-qy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D1/21-29615-8AD11FE4 for ; Tue, 20 Dec 2011 18:43:37 -0500 Received: by qcsd16 with SMTP id d16so4374612qcs.29 for ; Tue, 20 Dec 2011 15:43:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=+ecTcawekJ+hF7utor1Aa1jbU2vBRkD/vnLXr+aYW60=; b=K/UJHwhpZNROW+D0UMZdyrlDoC7ZFyQKujUQV4XaDujIj28/bUrKZfL69vUI3ulyCz nILQ3fFDz/9rzyCDcHyp0dgpgHDPuiMrbGv5OGAGjhGknS8uuvpcAU84bvhx7sgJZgkh 7xPmKAT+YIvbErEyx49ZlD7q4Y8qB4CCM3Ac8= Received: by 10.229.75.209 with SMTP id z17mr1691953qcj.131.1324424614133; Tue, 20 Dec 2011 15:43:34 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.251.207 with HTTP; Tue, 20 Dec 2011 15:43:13 -0800 (PST) Date: Wed, 21 Dec 2011 00:43:13 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=00235446fcd4a841ed04b48ea2c8 Subject: 5.3.8, Why is func_num_args() not working on a Clusure? From: markg85@gmail.com (Mark) --00235446fcd4a841ed04b48ea2c8 Content-Type: text/plain; charset=ISO-8859-1 Hi, Why is func_num_args not working on closures? Example code (tested on PHP 5.3.8): '; print_r(func_num_args($oClosure)); echo '
';
}
}

$c = new Test();
$c->testClosure(function($arg1, $arg2){
});

That returns 1 (the num of args in which function the closure is
(testClosure), but not the number of args from the closure itself.
Now Reflection can be used to get the number of args but that is overkill!
Also when you would do print_r(func_get_args($oClosure)); you do get
"something" back including the arguments but no way (that i know) to use
them!

Just something that i wonder...
I would have expected num args to return the args of the function you
provide it..

Kind regards,
Mark

--00235446fcd4a841ed04b48ea2c8--