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-- ReflectionGenerator while being currently executed --FILE-- <?php function call(..

Decoded Output download

--TEST--
ReflectionGenerator while being currently executed
--FILE--
<?php

function call(ReflectionGenerator $ref, $method, $rec = true) {
    if ($rec) {
        call($ref, $method, false);
        return;
    }
    var_dump($ref->$method());
}

function doCalls(ReflectionGenerator $ref) {
    call($ref, "getTrace");
    call($ref, "getExecutingLine");
    call($ref, "getExecutingFile");
    call($ref, "getExecutingGenerator");
    call($ref, "getFunction");
    call($ref, "getThis");
}

($gen = (function() use (&$gen) {
    $ref = new ReflectionGenerator($gen);

    doCalls($ref);

    yield from (function() use ($ref) {
        doCalls($ref);
        yield; // Generator !
    })();
})())->next();

?>
--EXPECTF--
array(1) {
  [0]=>
  array(2) {
    ["function"]=>
    string(9) "{closure}"
    ["args"]=>
    array(0) {
    }
  }
}
int(%d)
string(%d) "%sReflectionGenerator_in_Generator.%s"
object(Generator)#2 (0) {
}
object(ReflectionFunction)#4 (1) {
  ["name"]=>
  string(9) "{closure}"
}
NULL
array(2) {
  [0]=>
  array(4) {
    ["file"]=>
    string(%d) "%s"
    ["line"]=>
    int(%d)
    ["function"]=>
    string(9) "{closure}"
    ["args"]=>
    array(0) {
    }
  }
  [1]=>
  array(2) {
    ["function"]=>
    string(9) "{closure}"
    ["args"]=>
    array(0) {
    }
  }
}
int(%d)
string(%d) "%sReflectionGenerator_in_Generator.%s"
object(Generator)#5 (0) {
}
object(ReflectionFunction)#6 (1) {
  ["name"]=>
  string(9) "{closure}"
}
NULL

Did this file decode correctly?

Original Code

--TEST--
ReflectionGenerator while being currently executed
--FILE--
<?php

function call(ReflectionGenerator $ref, $method, $rec = true) {
    if ($rec) {
        call($ref, $method, false);
        return;
    }
    var_dump($ref->$method());
}

function doCalls(ReflectionGenerator $ref) {
    call($ref, "getTrace");
    call($ref, "getExecutingLine");
    call($ref, "getExecutingFile");
    call($ref, "getExecutingGenerator");
    call($ref, "getFunction");
    call($ref, "getThis");
}

($gen = (function() use (&$gen) {
    $ref = new ReflectionGenerator($gen);

    doCalls($ref);

    yield from (function() use ($ref) {
        doCalls($ref);
        yield; // Generator !
    })();
})())->next();

?>
--EXPECTF--
array(1) {
  [0]=>
  array(2) {
    ["function"]=>
    string(9) "{closure}"
    ["args"]=>
    array(0) {
    }
  }
}
int(%d)
string(%d) "%sReflectionGenerator_in_Generator.%s"
object(Generator)#2 (0) {
}
object(ReflectionFunction)#4 (1) {
  ["name"]=>
  string(9) "{closure}"
}
NULL
array(2) {
  [0]=>
  array(4) {
    ["file"]=>
    string(%d) "%s"
    ["line"]=>
    int(%d)
    ["function"]=>
    string(9) "{closure}"
    ["args"]=>
    array(0) {
    }
  }
  [1]=>
  array(2) {
    ["function"]=>
    string(9) "{closure}"
    ["args"]=>
    array(0) {
    }
  }
}
int(%d)
string(%d) "%sReflectionGenerator_in_Generator.%s"
object(Generator)#5 (0) {
}
object(ReflectionFunction)#6 (1) {
  ["name"]=>
  string(9) "{closure}"
}
NULL

Function Calls

None

Variables

None

Stats

MD5 6c245c1329a5b66a1150d2d7cd1644a5
Eval Count 0
Decode Time 82 ms