- Output for 5.6.0 - 5.6.27, 7.0.0 - 7.0.12
- Parse error: syntax error, unexpected 'return' (T_RETURN) in /in/WoK3G on line 34
Process exited with code 255.
<?php
class stdobject {
public function __call($method, $arguments) {
if (isset($this->{$method}) && is_callable($this->{$method})) {
return call_user_func_array($this->{$method}, $arguments);
} else {
throw new Exception("Fatal error: Call to undefined method: $method");
}
}
}
$mod = function() {
$test = new stdobject();
$opmode=null;
$mode='somemode';
$ref2=&$mode;
$test->init = function ($params) use (&$opmode) {
$opmode = &$params['opmode'];
};
$test->setup = function () use (&$opmode,&$mode) {
$opmode = 'test';
$mode='someothermode';
};
$test->print=function() use (&$opmode,&$mode){
echo $opmode;
echo $mode;
}
return $test;
};
$test = $mod();
$opmode = 'helloworld';
$test->init(['opmode' => &$opmode]);
$test->setup();
$test->print();
echo $opmode;