Bug #67924 [Fbk->NoF]: Closure and lambda problem
| From: | php-bugs at lists dot php dot net | Date: | Tue, 30 Dec 2014 10:42:44 +0000 |
| Subject: | Bug #67924 [Fbk->NoF]: Closure and lambda problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-189495@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67924&edit=1
ID: 67924
Updated by: php-bugs@lists.php.net
Reported by: tin dot legall at wishgroupe dot com
Summary: Closure and lambda problem
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Scripting Engine problem
Operating System: Debian
PHP Version: 5.4.4
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:
------------------------------------------------------------------------
[2014-08-28 18:51:05] requinix@php.net
Works for me. http://3v4l.org/pOTkX
You've tried that exact code? No modifications whatsoever?
Do you have any Zend extensions installed? If so you need to try without them as they can modify
PHP's behavior.
------------------------------------------------------------------------
[2014-08-28 17:43:42] tin dot legall at wishgroupe dot com
Here is the code example that illustrates the problem:
<?php
// This is our range of numbers
$numbers = range(1, 5);
// Our closure
$double = function($a) {
return $a * 2;
};
// Use the closure as a callback here to
// double the size of each element in our
// range
$new_numbers = array_map($double, $numbers);
print implode(' ', $new_numbers);
?>
Expected result:
----------------
2 4 6 8 10
Actual result:
--------------
1 2 3 4 5
------------------------------------------------------------------------
[2014-08-28 16:11:23] requinix@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
Not a description of what you did but the actual code. Because what it sounds like you're
describing creates something totally incorrect and will spew warnings.
------------------------------------------------------------------------
[2014-08-28 13:05:18] tin dot legall at wishgroupe dot com
Description:
------------
Take example #2 at the following address and switch $double and $number declarations
http://php.net/manual/en/language.types.callable.php
Expected result:
----------------
2 4 6 8 10
Actual result:
--------------
1 2 3 4 5
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67924&edit=1