2009-06-13 17:28:35 +00:00
|
|
|
--TEST--
|
|
|
|
SPL: spl_autoload_register() Bug #48541: registering multiple closures fails with memleaks
|
|
|
|
--FILE--
|
|
|
|
<?php
|
2009-06-22 18:14:14 +00:00
|
|
|
|
|
|
|
class X {
|
|
|
|
public function getClosure() {
|
|
|
|
return function($class) {
|
|
|
|
echo "a2 called\n";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-13 17:28:35 +00:00
|
|
|
$a = function ($class) {
|
|
|
|
echo "a called\n";
|
|
|
|
};
|
2009-06-22 18:14:14 +00:00
|
|
|
$x = new X;
|
|
|
|
$a2 = $x->getClosure();
|
2009-06-13 17:28:35 +00:00
|
|
|
$b = function ($class) {
|
|
|
|
eval('class ' . $class . '{function __construct(){echo "foo\n";}}');
|
|
|
|
echo "b called\n";
|
|
|
|
};
|
|
|
|
spl_autoload_register($a);
|
2009-06-22 18:14:14 +00:00
|
|
|
spl_autoload_register($a2);
|
2009-06-13 17:28:35 +00:00
|
|
|
spl_autoload_register($b);
|
|
|
|
|
|
|
|
$c = $a;
|
2009-06-22 18:14:14 +00:00
|
|
|
$c2 = $a2;
|
2009-06-13 17:28:35 +00:00
|
|
|
spl_autoload_register($c);
|
2009-06-22 18:14:14 +00:00
|
|
|
spl_autoload_register($c2);
|
2009-06-13 17:28:35 +00:00
|
|
|
$c = new foo;
|
|
|
|
?>
|
|
|
|
===DONE===
|
|
|
|
--EXPECT--
|
|
|
|
a called
|
2009-06-22 18:14:14 +00:00
|
|
|
a2 called
|
2009-06-13 17:28:35 +00:00
|
|
|
b called
|
|
|
|
foo
|
|
|
|
===DONE===
|