1--TEST-- 2Ensure __autoload() allows for recursive calls if the class name differs. 3--FILE-- 4<?php 5spl_autoload_register(function ($name) { 6 echo "IN: autoload($name)\n"; 7 8 static $i = 0; 9 if ($i++ > 10) { 10 echo "-> Recursion detected - as expected.\n"; 11 return; 12 } 13 14 class_exists('UndefinedClass' . $i); 15 16 echo "OUT: autoload($name)\n"; 17}); 18 19var_dump(class_exists('UndefinedClass0')); 20?> 21--EXPECTF-- 22IN: autoload(UndefinedClass0) 23IN: autoload(UndefinedClass1) 24IN: autoload(UndefinedClass2) 25IN: autoload(UndefinedClass3) 26IN: autoload(UndefinedClass4) 27IN: autoload(UndefinedClass5) 28IN: autoload(UndefinedClass6) 29IN: autoload(UndefinedClass7) 30IN: autoload(UndefinedClass8) 31IN: autoload(UndefinedClass9) 32IN: autoload(UndefinedClass10) 33IN: autoload(UndefinedClass11) 34-> Recursion detected - as expected. 35OUT: autoload(UndefinedClass10) 36OUT: autoload(UndefinedClass9) 37OUT: autoload(UndefinedClass8) 38OUT: autoload(UndefinedClass7) 39OUT: autoload(UndefinedClass6) 40OUT: autoload(UndefinedClass5) 41OUT: autoload(UndefinedClass4) 42OUT: autoload(UndefinedClass3) 43OUT: autoload(UndefinedClass2) 44OUT: autoload(UndefinedClass1) 45OUT: autoload(UndefinedClass0) 46bool(false) 47