Doc #67822 [Fbk->NoF]: Precedence of used variable names vs closure arguments should be defined
| From: | php-bugs at lists dot php dot net | Date: | Sun, 12 Jul 2015 04:22:18 +0000 |
| Subject: | Doc #67822 [Fbk->NoF]: Precedence of used variable names vs closure arguments should be defined | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12507@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67822&edit=1
ID: 67822
Updated by: php-bugs@lists.php.net
Reported by: fredemmott@php.net
Summary: Precedence of used variable names vs closure arguments
should be defined
-Status: Feedback
+Status: No Feedback
Type: Documentation Problem
Package: PHP Language Specification
Operating System: n/a
PHP Version: PHP-5.6
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2015-06-28 22:36:03] stas@php.net
Not sure it is really necessary to specify, this doesn't seem to be an important use case. Is
there any reason why it should be one way or another?
------------------------------------------------------------------------
[2014-08-11 18:34:55] fredemmott@php.net
Description:
------------
If a closure has an argument and a used variable with the same name, PHP5 uses the
variable; HHVM uses the argument.
The PHP5 behavior should be documented in the specification.
There's also an issue filed against HHVM to match PHP5's behavior
(https://github.com/facebook/hhvm/issues/3406)
Test script:
---------------
<?php
$foo = 'used variable';
$closure = function ($foo) use ($foo) { return $foo; };
var_dump($closure('argument'));
Expected result:
----------------
'used variable'
Actual result:
--------------
PHP5: 'used variable'
HHVM: 'argument'
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67822&edit=1