Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Bug #54358 (Closure, use and reference) --FILE-- <?php class asserter { publi..

Decoded Output download

--TEST--
Bug #54358 (Closure, use and reference)
--FILE--
<?php
class asserter {
    public function call($function) {
    }
}

$asserter = new asserter();

$closure = function() use ($asserter, &$function) {
        $asserter->call($function = 'md5');
};

$closure();

var_dump($function);

$closure = function() use ($asserter, $function) {
        $asserter->call($function);
};

$closure();

var_dump($function);

$closure = function() use ($asserter, $function) {
        $asserter->call($function);
};

$closure();

var_dump($function);
?>
--EXPECT--
string(3) "md5"
string(3) "md5"
string(3) "md5"

Did this file decode correctly?

Original Code

--TEST--
Bug #54358 (Closure, use and reference)
--FILE--
<?php
class asserter {
    public function call($function) {
    }
}

$asserter = new asserter();

$closure = function() use ($asserter, &$function) {
        $asserter->call($function = 'md5');
};

$closure();

var_dump($function);

$closure = function() use ($asserter, $function) {
        $asserter->call($function);
};

$closure();

var_dump($function);

$closure = function() use ($asserter, $function) {
        $asserter->call($function);
};

$closure();

var_dump($function);
?>
--EXPECT--
string(3) "md5"
string(3) "md5"
string(3) "md5"

Function Calls

None

Variables

None

Stats

MD5 dbd3eeaad8b1d61cd1fd67750dc99429
Eval Count 0
Decode Time 96 ms