xref: /PHP-5.6/tests/classes/autoload_005.phpt (revision 610c7fbe)
1--TEST--
2ZE2 Autoload from destructor
3--SKIPIF--
4<?php
5	if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed');
6	if (class_exists('autoload_root', false)) die('skip Autoload test classes exist already');
7?>
8--FILE--
9<?php
10
11function __autoload($class_name)
12{
13	var_dump(class_exists($class_name, false));
14	require_once(dirname(__FILE__) . '/' . $class_name . '.p5c');
15	echo __FUNCTION__ . '(' . $class_name . ")\n";
16}
17
18var_dump(class_exists('autoload_derived', false));
19var_dump(class_exists('autoload_derived', false));
20
21class Test
22{
23    function __destruct() {
24        echo __METHOD__ . "\n";
25        $o = new autoload_derived;
26        var_dump($o);
27    }
28}
29
30$o = new Test;
31unset($o);
32
33?>
34===DONE===
35--EXPECTF--
36bool(false)
37bool(false)
38Test::__destruct
39bool(false)
40bool(false)
41__autoload(autoload_root)
42__autoload(autoload_derived)
43object(autoload_derived)#%d (0) {
44}
45===DONE===
46