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-- ReflectionFiber should not segfault when inspecting fibers where the previous sta..

Decoded Output download

--TEST--
ReflectionFiber should not segfault when inspecting fibers where the previous stack frame is a native function
--FILE--
<?php

namespace test;

$f = new \Fiber(fn() => call_user_func(["Fiber", "suspend"]));
$f->start();

$reflection = new \ReflectionFiber($f);

var_dump($reflection->getExecutingFile());
var_dump($reflection->getExecutingLine());
var_dump($reflection->getTrace());

?>
--EXPECTF--
string(%d) "%sReflectionFiber_notrace_2.php"
int(5)
array(3) {
  [0]=>
  array(4) {
    ["function"]=>
    string(7) "suspend"
    ["class"]=>
    string(5) "Fiber"
    ["type"]=>
    string(2) "::"
    ["args"]=>
    array(0) {
    }
  }
  [1]=>
  array(4) {
    ["file"]=>
    string(%d) "%sReflectionFiber_notrace_2.php"
    ["line"]=>
    int(5)
    ["function"]=>
    string(14) "call_user_func"
    ["args"]=>
    array(1) {
      [0]=>
      array(2) {
        [0]=>
        string(5) "Fiber"
        [1]=>
        string(7) "suspend"
      }
    }
  }
  [2]=>
  array(2) {
    ["function"]=>
    string(14) "test\{closure}"
    ["args"]=>
    array(0) {
    }
  }
}

Did this file decode correctly?

Original Code

--TEST--
ReflectionFiber should not segfault when inspecting fibers where the previous stack frame is a native function
--FILE--
<?php

namespace test;

$f = new \Fiber(fn() => call_user_func(["Fiber", "suspend"]));
$f->start();

$reflection = new \ReflectionFiber($f);

var_dump($reflection->getExecutingFile());
var_dump($reflection->getExecutingLine());
var_dump($reflection->getTrace());

?>
--EXPECTF--
string(%d) "%sReflectionFiber_notrace_2.php"
int(5)
array(3) {
  [0]=>
  array(4) {
    ["function"]=>
    string(7) "suspend"
    ["class"]=>
    string(5) "Fiber"
    ["type"]=>
    string(2) "::"
    ["args"]=>
    array(0) {
    }
  }
  [1]=>
  array(4) {
    ["file"]=>
    string(%d) "%sReflectionFiber_notrace_2.php"
    ["line"]=>
    int(5)
    ["function"]=>
    string(14) "call_user_func"
    ["args"]=>
    array(1) {
      [0]=>
      array(2) {
        [0]=>
        string(5) "Fiber"
        [1]=>
        string(7) "suspend"
      }
    }
  }
  [2]=>
  array(2) {
    ["function"]=>
    string(14) "test\{closure}"
    ["args"]=>
    array(0) {
    }
  }
}

Function Calls

None

Variables

None

Stats

MD5 660c9d1c79020e2189773189b44172ce
Eval Count 0
Decode Time 77 ms