Php Runkit沙盒:使用父';s类实例?

Php Runkit沙盒:使用父';s类实例?,php,runkit,Php,Runkit,下面的代码 function getInstance() { echo "(getInstance() called)\n"; return new TestClass(); } class TestClass { function someMethod() { echo "someMethod called. Awesome!\n"; } } $sandbox = new Runkit_Sandbox(); $sandbox['parent_access'] =

下面的代码

function getInstance() {
  echo "(getInstance() called)\n";

  return new TestClass();
}

class TestClass {
  function someMethod() {
    echo "someMethod called. Awesome!\n";
  }
}

$sandbox = new Runkit_Sandbox();
$sandbox['parent_access'] = true;
$sandbox['parent_call'] = true;

$sandbox->eval(
  '$PARENT = new Runkit_Sandbox_Parent; '.
  '$PARENT->getInstance()->someMethod();'
);
导致在我的PHP 5.4.10版本中出现以下输出:

(getInstance() called)
PHP Warning:  Runkit_Sandbox::eval(): Error executing sandbox code in /home/projpf/_test/sandbox_test2.php on line 24
显然,不可能从沙盒内调用在沙盒外声明的方法。 这是对Runkit的限制还是我做错了什么

如果您想知道我想做什么:我想将我的PHP web脚本转换为通过RabbitMQ接受HTTP请求的长时间运行的worker。这些脚本有时必须进行大量初始化,这些初始化可以作为变量缓存,但不能通过任何外部缓存。沙箱将允许工作进程加载正确的处理程序脚本,而不留下任何痕迹,但应该显式缓存的数据除外,在本例中,这将是大量的类实例