2008-02-17 00:19:27 +00:00
|
|
|
--TEST--
|
2008-02-18 01:11:17 +00:00
|
|
|
HTMLPurifier.auto.php using spl_autoload_register with user registration loading test
|
2008-02-17 00:19:27 +00:00
|
|
|
--SKIPIF--
|
|
|
|
<?php
|
|
|
|
if (!function_exists('spl_autoload_register')) {
|
|
|
|
echo "skip - spl_autoload_register() not available";
|
|
|
|
}
|
|
|
|
--FILE--
|
|
|
|
<?php
|
2008-02-18 01:11:17 +00:00
|
|
|
function my_autoload($class) {
|
2008-02-17 00:19:27 +00:00
|
|
|
echo "Autoloading $class..." . PHP_EOL;
|
|
|
|
eval("class $class {}");
|
2008-02-18 01:11:17 +00:00
|
|
|
return true;
|
2008-02-17 00:19:27 +00:00
|
|
|
}
|
2008-02-18 02:33:50 +00:00
|
|
|
class MyClass {
|
|
|
|
public static function myAutoload($class) {
|
|
|
|
if ($class == 'Foo') {
|
|
|
|
echo "Special autoloading Foo..." . PHP_EOL;
|
|
|
|
eval("class $class {}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
spl_autoload_register(array('MyClass', 'myAutoload'));
|
2008-02-18 01:11:17 +00:00
|
|
|
spl_autoload_register('my_autoload');
|
2008-02-17 00:19:27 +00:00
|
|
|
|
2008-02-18 00:49:45 +00:00
|
|
|
require '../library/HTMLPurifier.auto.php';
|
|
|
|
require 'HTMLPurifier/PHPT/loading/_autoload.inc';
|
2008-02-17 00:19:27 +00:00
|
|
|
$config = HTMLPurifier_Config::createDefault();
|
|
|
|
$purifier = new HTMLPurifier($config);
|
|
|
|
echo $purifier->purify('<b>Salsa!') . PHP_EOL;
|
|
|
|
|
2008-02-18 02:33:50 +00:00
|
|
|
// purposely invoke older autoloads
|
|
|
|
$foo = new Foo();
|
2008-02-17 00:19:27 +00:00
|
|
|
$bar = new Bar();
|
|
|
|
|
|
|
|
--EXPECT--
|
|
|
|
<b>Salsa!</b>
|
2008-02-18 02:33:50 +00:00
|
|
|
Special autoloading Foo...
|
2008-02-17 00:19:27 +00:00
|
|
|
Autoloading Bar...
|