1--TEST--
2SPL: spl_autoload_register() Bug #48541: registering multiple closures fails with memleaks
3--FILE--
4<?php
5
6class X {
7  public function getClosure() {
8    return function($class) {
9      echo "a2 called\n";
10    };
11  }
12}
13
14$a = function ($class) {
15    echo "a called\n";
16};
17$x = new X;
18$a2 = $x->getClosure();
19$b = function ($class) {
20    eval('class ' . $class . '{function __construct(){echo "foo\n";}}');
21    echo "b called\n";
22};
23spl_autoload_register($a);
24spl_autoload_register($a2);
25spl_autoload_register($b);
26
27$c = $a;
28$c2 = $a2;
29spl_autoload_register($c);
30spl_autoload_register($c2);
31$c = new foo;
32?>
33===DONE===
34--EXPECT--
35a called
36a2 called
37b called
38foo
39===DONE===