You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1011B

  1. --TEST--
  2. HTMLPurifier.auto.php using spl_autoload_register with user registration loading test
  3. --SKIPIF--
  4. <?php
  5. if (!function_exists('spl_autoload_register')) {
  6. echo "skip - spl_autoload_register() not available";
  7. }
  8. --FILE--
  9. <?php
  10. function my_autoload($class) {
  11. echo "Autoloading $class...
  12. ";
  13. eval("class $class {}");
  14. return true;
  15. }
  16. class MyClass {
  17. public static function myAutoload($class) {
  18. if ($class == 'Foo') {
  19. echo "Special autoloading Foo...
  20. ";
  21. eval("class $class {}");
  22. }
  23. }
  24. }
  25. spl_autoload_register(array('MyClass', 'myAutoload'));
  26. spl_autoload_register('my_autoload');
  27. require '../library/HTMLPurifier.auto.php';
  28. require 'HTMLPurifier/PHPT/loading/_autoload.inc';
  29. $config = HTMLPurifier_Config::createDefault();
  30. $purifier = new HTMLPurifier($config);
  31. echo $purifier->purify('<b>Salsa!') . "
  32. ";
  33. // purposely invoke older autoloads
  34. $foo = new Foo();
  35. $bar = new Bar();
  36. --EXPECT--
  37. <b>Salsa!</b>
  38. Special autoloading Foo...
  39. Autoloading Bar...