aboutsummaryrefslogtreecommitdiffstats
path: root/lib/htmlpurifier/tests/HTMLPurifier/PHPT/loading/error-auto-with-spl-nonstatic-autoload.phpt
blob: 9a91abaf88fc390fb3d60664d9035e1cd782f504 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--TEST--
Error when registering autoload with non-static autoload already on SPL stack
--SKIPIF--
<?php
if (!function_exists('spl_autoload_register')) {
    echo "skip - spl_autoload_register() not available";
}
if (version_compare(PHP_VERSION, '5.2.11', '>=')) {
    echo "skip - non-buggy version of PHP";
}
--FILE--
<?php
class NotStatic
{
    public function autoload($class) {
        echo "Autoloading... $class" . PHP_EOL;
        eval("class $class {}");
    }
}

$obj = new NotStatic();
spl_autoload_register(array($obj, 'autoload'));

try {
    require '../library/HTMLPurifier.auto.php';
} catch (Exception $e) {
    echo 'Caught error gracefully';
    assert('strpos($e->getMessage(), "44144") !== false');
}

--EXPECT--
Caught error gracefully