xref: /PHP-7.0/ext/spl/tests/bug40091.phpt (revision 3a4eb3e4)
1--TEST--
2Bug #40091 (issue with spl_autoload_register() and 2 instances of the same class)
3--FILE--
4<?php
5class MyAutoloader {
6	function __construct($directory_to_use) {}
7	function autoload($class_name) {
8		// code to autoload based on directory
9	}
10}
11
12$autloader1 = new MyAutoloader('dir1');
13spl_autoload_register(array($autloader1, 'autoload'));
14
15$autloader2 = new MyAutoloader('dir2');
16spl_autoload_register(array($autloader2, 'autoload'));
17
18print_r(spl_autoload_functions());
19?>
20===DONE===
21--EXPECT--
22Array
23(
24    [0] => Array
25        (
26            [0] => MyAutoloader Object
27                (
28                )
29
30            [1] => autoload
31        )
32
33    [1] => Array
34        (
35            [0] => MyAutoloader Object
36                (
37                )
38
39            [1] => autoload
40        )
41
42)
43===DONE===
44