bug40091.phpt 802 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --TEST--
  2. Bug #40091 (issue with spl_autoload_register() and 2 instances of the same class)
  3. --FILE--
  4. <?php
  5. class MyAutoloader {
  6. function __construct($directory_to_use) {}
  7. function autoload($class_name) {
  8. // code to autoload based on directory
  9. }
  10. }
  11. $autloader1 = new MyAutoloader('dir1');
  12. spl_autoload_register(array($autloader1, 'autoload'));
  13. $autloader2 = new MyAutoloader('dir2');
  14. spl_autoload_register(array($autloader2, 'autoload'));
  15. print_r(spl_autoload_functions());
  16. ?>
  17. --EXPECT--
  18. Array
  19. (
  20. [0] => Array
  21. (
  22. [0] => MyAutoloader Object
  23. (
  24. )
  25. [1] => autoload
  26. )
  27. [1] => Array
  28. (
  29. [0] => MyAutoloader Object
  30. (
  31. )
  32. [1] => autoload
  33. )
  34. )