2009-01-04 01:46:25 +08:00
|
|
|
--TEST--
|
|
|
|
Closure 033: Dynamic closure property and private function
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
class Test {
|
|
|
|
public $func;
|
|
|
|
function __construct() {
|
|
|
|
$this->func = function() {
|
|
|
|
echo __METHOD__ . "()\n";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
private function func() {
|
|
|
|
echo __METHOD__ . "()\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$o = new Test;
|
|
|
|
$f = $o->func;
|
|
|
|
$f();
|
|
|
|
$o->func();
|
|
|
|
|
|
|
|
?>
|
|
|
|
===DONE===
|
|
|
|
--EXPECTF--
|
2015-07-14 08:52:09 +08:00
|
|
|
{closure}()
|
2009-01-04 01:46:25 +08:00
|
|
|
|
2015-05-18 06:31:43 +08:00
|
|
|
Fatal error: Uncaught Error: Call to private method Test::func() from context '' in %sclosure_033.php:%d
|
2015-05-16 03:04:07 +08:00
|
|
|
Stack trace:
|
|
|
|
#0 {main}
|
|
|
|
thrown in %sclosure_033.php on line %d
|