Allow non-static autoload methods w/ PHP >= 5.2.11
[htmlpurifier.git] / tests / HTMLPurifier / PHPT / loading / error-auto-with-spl-nonstatic-autoload.phpt
blob9a91abaf88fc390fb3d60664d9035e1cd782f504
1 --TEST--
2 Error when registering autoload with non-static autoload already on SPL stack
3 --SKIPIF--
4 <?php
5 if (!function_exists('spl_autoload_register')) {
6     echo "skip - spl_autoload_register() not available";
8 if (version_compare(PHP_VERSION, '5.2.11', '>=')) {
9     echo "skip - non-buggy version of PHP";
11 --FILE--
12 <?php
13 class NotStatic
15     public function autoload($class) {
16         echo "Autoloading... $class" . PHP_EOL;
17         eval("class $class {}");
18     }
21 $obj = new NotStatic();
22 spl_autoload_register(array($obj, 'autoload'));
24 try {
25     require '../library/HTMLPurifier.auto.php';
26 } catch (Exception $e) {
27     echo 'Caught error gracefully';
28     assert('strpos($e->getMessage(), "44144") !== false');
31 --EXPECT--
32 Caught error gracefully