- Output for 5.3.0 - 5.3.22, 5.4.0 - 5.4.12
- Fatal error: No code may exist outside of namespace {} in /in/Nqq30 on line 26
Process exited with code 255.
<?php
namespace Foo {
class Bar {
function baz() {
return time();
}
}
}
namespace {
class Test {
public static $now;
function call() {
$namespace = '\\Foo';
eval('namespace '.$namespace.' {
function time() {
return \\'.__CLASS__.'::$now ?: \time();
}
}');
}
}
}
$b = new Foo\Bar();
$t = new Test();
$t->call();
Test::$now = 'xxx';
$b->baz();