xref: /php-src/ext/spl/tests/spl_autoload_004.phpt (revision f8d79582)
1--TEST--
2SPL: spl_autoload() with static methods
3--INI--
4include_path=.
5--FILE--
6<?php
7
8class MyAutoLoader {
9
10        static function autoLoad($className) {
11            echo __METHOD__ . "($className)\n";
12        }
13}
14
15spl_autoload_register(array('MyAutoLoader', 'autoLoad'));
16
17// and
18
19$myAutoLoader = new MyAutoLoader();
20
21spl_autoload_register(array($myAutoLoader, 'autoLoad'));
22
23var_dump(spl_autoload_functions());
24
25// check
26var_dump(class_exists("TestClass", true));
27
28?>
29--EXPECT--
30array(1) {
31  [0]=>
32  array(2) {
33    [0]=>
34    string(12) "MyAutoLoader"
35    [1]=>
36    string(8) "autoLoad"
37  }
38}
39MyAutoLoader::autoLoad(TestClass)
40bool(false)
41