Arquivos
hhvm/hphp/test/vm/zend_closure_025.php
T
ptarjan ea782cbd3e handle create_function with a closure in it
This actually was pretty broken already. If you defined a new function in the ##create_function## string it would return that function but it wouldn't move it to the right unit so it can't execute. A big mess. For example:

    $ cat a.php
    <?php
    $a = create_function('', 'function b() { return 3; }');
    $a();
    var_dump(b());
    $ php a.php
    HipHop Fatal error: Undefined function: b in /data/users/ptarjan/hphp/hphp/a.php on line 4
    $ hhvm a.php
    int(3)
2013-03-09 13:26:15 -08:00

7 linhas
122 B
PHP

<?php
$a = create_function('$x', 'return function($y) use ($x) { return $x * $y; };');
var_dump($a(2)->__invoke(4));
?>