File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / spl / tests / spl_autoload_bug48541.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:01 2012 UTC (12 years, 6 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
SPL: spl_autoload_register() Bug #48541: registering multiple closures fails with memleaks
--FILE--
<?php

class X {
  public function getClosure() {
    return function($class) {
      echo "a2 called\n";
    };
  }
}

$a = function ($class) {
    echo "a called\n";
};
$x = new X;
$a2 = $x->getClosure();
$b = function ($class) {
    eval('class ' . $class . '{function __construct(){echo "foo\n";}}');
    echo "b called\n";
};
spl_autoload_register($a);
spl_autoload_register($a2);
spl_autoload_register($b);

$c = $a;
$c2 = $a2;
spl_autoload_register($c);
spl_autoload_register($c2);
$c = new foo;
?>
===DONE===
--EXPECT--
a called
a2 called
b called
foo
===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>