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-- Reflection on closures: Segfaults with getParameters() and getDeclaringFunction()..

Decoded Output download

--TEST--
Reflection on closures: Segfaults with getParameters() and getDeclaringFunction()
--FILE--
<?php

$closure = function($a, $b = 0) { };

$method = new ReflectionMethod ($closure, '__invoke');
$params = $method->getParameters ();
unset ($method);
$method = $params[0]->getDeclaringFunction ();
unset ($params);
echo $method->getName ()."
";

$parameter = new ReflectionParameter (array ($closure, '__invoke'), 'b');
$method = $parameter->getDeclaringFunction ();
unset ($parameter);
echo $method->getName ()."
";

?>
--EXPECT--
__invoke
__invoke

Did this file decode correctly?

Original Code

--TEST--
Reflection on closures: Segfaults with getParameters() and getDeclaringFunction()
--FILE--
<?php

$closure = function($a, $b = 0) { };

$method = new ReflectionMethod ($closure, '__invoke');
$params = $method->getParameters ();
unset ($method);
$method = $params[0]->getDeclaringFunction ();
unset ($params);
echo $method->getName ()."\n";

$parameter = new ReflectionParameter (array ($closure, '__invoke'), 'b');
$method = $parameter->getDeclaringFunction ();
unset ($parameter);
echo $method->getName ()."\n";

?>
--EXPECT--
__invoke
__invoke

Function Calls

None

Variables

None

Stats

MD5 49575bc6098914bcdd9171d4ab240107
Eval Count 0
Decode Time 109 ms