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--EXPECT-- 34a called 35a2 called 36b called 37foo 38