com php-src: Deprecate __autoload(): Zend/tests/bug 26697.phpt Zend/tests/bug31102.phpt Zend/tests/bug33116.phpt Zend/tests/bug37 138.phpt Zend/tests/bug39003.phpt Zend/ tests/bug39542.phpt Zend/tests/bug42798 .phpt Zend/tests/bug46665.phpt Zend/tests/bug 47714.phpt Zend/tests/bug49908.phpt Zend/tests/bug55007.phpt Zend/tests/bug61 011.phpt Zend/tests/bug62907.phpt Zend/ tests/bug63305.phpt Zend/tests/bug65254 .phpt Zend/tests/bug71163.phpt Zend/tests/ca

[email protected] (Nikita Popov)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    162aa1a5fc96b3dd7e3420c6882607b361801fbd
Author:    Nikita Popov <[email protected]>         Mon, 30 Jan 2017 22:28:17 +0100
Parents:   eaeecc523b665cfa856a376b9c55ca7fc9b7b596
Branches:  master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=162aa1a5fc96b3dd7e3420c6882607b361801fbd

Log:
Deprecate __autoload()

Changed paths:
  M  Zend/tests/bug26697.phpt
  M  Zend/tests/bug31102.phpt
  M  Zend/tests/bug33116.phpt
  M  Zend/tests/bug37138.phpt
  M  Zend/tests/bug39003.phpt
  M  Zend/tests/bug39542.phpt
  M  Zend/tests/bug42798.phpt
  M  Zend/tests/bug46665.phpt
  M  Zend/tests/bug47714.phpt
  M  Zend/tests/bug49908.phpt
  M  Zend/tests/bug55007.phpt
  M  Zend/tests/bug61011.phpt
  M  Zend/tests/bug62907.phpt
  M  Zend/tests/bug63305.phpt
  M  Zend/tests/bug65254.phpt
  M  Zend/tests/bug71163.phpt
  M  Zend/tests/call_user_func_002.phpt
  M  Zend/tests/catch.phpt
  M  Zend/tests/class_alias_007.phpt
  M  Zend/tests/instanceof.phpt
  M  Zend/tests/is_a.phpt
  M  Zend/zend_compile.c
  M  ext/phar/tests/fatal_error_webphar.phpt
  M  ext/reflection/tests/007.phpt
  M  ext/reflection/tests/bug26640.phpt
  M  ext/reflection/tests/bug29268.phpt
  M  ext/soap/tests/bugs/bug28751.phpt
  M  ext/spl/tests/class_implements_variation.phpt
  M  ext/spl/tests/class_uses_variation.phpt
  M  ext/spl/tests/spl_003.phpt
  M  ext/standard/incomplete_class.c
  M  ext/standard/tests/class_object/class_exists_basic_001.phpt
  M  ext/standard/tests/class_object/class_exists_variation_001.phpt
  M  ext/standard/tests/class_object/class_exists_variation_002.phpt
  M  ext/standard/tests/class_object/get_declared_classes_variation1.phpt
  M  ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt
  M  ext/standard/tests/class_object/get_declared_traits_variation1.phpt
  M  ext/standard/tests/class_object/get_parent_class_variation_002.phpt
  M  ext/standard/tests/class_object/interface_exists_variation3.phpt
  M  ext/standard/tests/class_object/interface_exists_variation4.phpt
  M  ext/standard/tests/class_object/is_a.phpt
  M  ext/standard/tests/class_object/is_subclass_of_variation_001.phpt
  M  ext/standard/tests/class_object/is_subclass_of_variation_002.phpt
  M  ext/standard/tests/class_object/is_subclass_of_variation_004.phpt
  M  ext/standard/tests/class_object/method_exists_basic_003.phpt
  M  ext/standard/tests/class_object/method_exists_variation_001.phpt
  M  ext/standard/tests/class_object/method_exists_variation_002.phpt
  M  ext/standard/tests/class_object/property_exists_variation1.phpt
  M  ext/standard/tests/class_object/trait_exists_basic_001.phpt
  M  ext/standard/tests/class_object/trait_exists_variation_001.phpt
  M  ext/standard/tests/class_object/trait_exists_variation_002.phpt
  M  ext/standard/tests/general_functions/bug35229.phpt
  M  ext/standard/tests/serialize/005.phpt
  M  ext/standard/tests/serialize/bug30234.phpt
  M  ext/standard/tests/serialize/bug62836_1.phpt
  M  ext/standard/tests/serialize/bug69152.phpt
  M  ext/standard/tests/serialize/bug70213.phpt
  M  ext/standard/tests/serialize/incomplete_class.phpt
  M  ext/standard/tests/serialize/serialization_objects_005.phpt
  M  ext/standard/tests/serialize/serialization_objects_006.phpt
  M  ext/standard/tests/serialize/serialization_objects_007.phpt
  M  ext/xsl/tests/bug33853.phpt
  M  tests/classes/autoload_001.phpt
  M  tests/classes/autoload_002.phpt
  M  tests/classes/autoload_003.phpt
  M  tests/classes/autoload_004.phpt
  M  tests/classes/autoload_005.phpt
  M  tests/classes/autoload_006.phpt
  M  tests/classes/autoload_007.phpt
  M  tests/classes/autoload_008.phpt
  M  tests/classes/autoload_009.phpt
  M  tests/classes/autoload_010.phpt
  M  tests/classes/autoload_011.phpt
  M  tests/classes/autoload_012.phpt
  M  tests/classes/autoload_013.phpt
  M  tests/classes/autoload_014.phpt
  M  tests/classes/autoload_015.phpt
  M  tests/classes/autoload_016.phpt
  M  tests/classes/autoload_017.phpt
  M  tests/classes/autoload_018.phpt
  M  tests/classes/autoload_019.phpt
  M  tests/classes/autoload_020.phpt
  M  tests/classes/autoload_021.phpt
diff_162aa1a5fc96b3dd7e3420c6882607b361801fbd.txt (text/plain, 80.8 KB)
diff --git a/Zend/tests/bug26697.phpt b/Zend/tests/bug26697.phpt
index 8266a23..8dda170 100644
--- a/Zend/tests/bug26697.phpt
+++ b/Zend/tests/bug26697.phpt
@@ -1,24 +1,21 @@
 --TEST--
 Bug #26697 (calling class_exists on a nonexistent class in __autoload results in segfault)
---SKIPIF--
-<?php if (function_exists('__autoload')) die('skip __autoload() declared in auto_prepend_file');?>
 --FILE--
 <?php
 
-function __autoload($name)
-{
+spl_autoload_register(function ($name) {
 	echo __METHOD__ . "($name)\n";
 	var_dump(class_exists('NotExistingClass'));
 	echo __METHOD__ . "($name), done\n";
-}
+});
 
 var_dump(class_exists('NotExistingClass'));
 
 ?>
 ===DONE===
 --EXPECTF--
-__autoload(NotExistingClass)
+{closure}(NotExistingClass)
 bool(false)
-__autoload(NotExistingClass), done
+{closure}(NotExistingClass), done
 bool(false)
 ===DONE===
diff --git a/Zend/tests/bug31102.phpt b/Zend/tests/bug31102.phpt
index 5de01f7..fd6da0f 100644
--- a/Zend/tests/bug31102.phpt
+++ b/Zend/tests/bug31102.phpt
@@ -5,8 +5,7 @@ Bug #31102 (Exception not handled when thrown inside __autoload())
 
 $test = 0;
 
-function __autoload($class)
-{
+spl_autoload_register(function ($class) {
 	global $test;
 
 	echo __METHOD__ . "($class,$test)\n";
@@ -22,7 +21,7 @@ function __autoload($class)
 	case 3:
 		return;
 	}
-}
+});
 
 while($test++ < 5)
 {
@@ -39,11 +38,11 @@ while($test++ < 5)
 ===DONE===
 <?php exit(0); ?>
 --EXPECTF--
-__autoload(Test1,1)
+{closure}(Test1,1)
 Caught: Test1::__construct
-__autoload(Test2,2)
-Caught: __autoload
-__autoload(Test3,3)
+{closure}(Test2,2)
+Caught: {closure}
+{closure}(Test3,3)
 
 Fatal error: Uncaught Error: Class 'Test3' not found in %sbug31102.php(%d) : eval()'d code:1
 Stack trace:
diff --git a/Zend/tests/bug33116.phpt b/Zend/tests/bug33116.phpt
index aa714a1..13aae66 100644
--- a/Zend/tests/bug33116.phpt
+++ b/Zend/tests/bug33116.phpt
@@ -2,11 +2,10 @@
 Bug #33116 (crash when assigning class name to global variable in __autoload)
 --FILE--
 <?php
-function __autoload($class)
-{
+spl_autoload_register(function ($class) {
   $GLOBALS['include'][] = $class;
   eval("class DefClass{}");
-}
+});
 
 $a = new DefClass;
 print_r($a);
diff --git a/Zend/tests/bug37138.phpt b/Zend/tests/bug37138.phpt
index f8503f8..e39ad19 100644
--- a/Zend/tests/bug37138.phpt
+++ b/Zend/tests/bug37138.phpt
@@ -2,7 +2,7 @@
 Bug #37138 (__autoload tries to load callback'ed self and parent)
 --FILE--
 <?php
-function __autoload ($CN) {var_dump ($CN);}
+spl_autoload_register(function ($CN) { var_dump ($CN); });
 class st {
 	public static function e () {echo ("EHLO\n");}
 	public static function e2 () {call_user_func (array ('self', 'e'));}
diff --git a/Zend/tests/bug39003.phpt b/Zend/tests/bug39003.phpt
index add1451..01761fa 100644
--- a/Zend/tests/bug39003.phpt
+++ b/Zend/tests/bug39003.phpt
@@ -10,10 +10,9 @@ class ClassName
 
 function test (OtherClassName $object) { }
 
-function __autoload($class)
-{
+spl_autoload_register(function ($class) {
     var_dump("__autload($class)");
-}
+});
 
 $obj = new ClassName;
 test($obj);
diff --git a/Zend/tests/bug39542.phpt b/Zend/tests/bug39542.phpt
index 13ddc0a..2008fe1 100644
--- a/Zend/tests/bug39542.phpt
+++ b/Zend/tests/bug39542.phpt
@@ -10,11 +10,11 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
 	set_include_path(dirname(__FILE__).'/bug39542:.');
 }
 
-function __autoload($class) {
+spl_autoload_register(function ($class) {
     if (!require_once($class.'.php')) {
         error_log('Error: Autoload class: '.$class.' not found!');
     }
-}
+});
 
 new bug39542();
 
diff --git a/Zend/tests/bug42798.phpt b/Zend/tests/bug42798.phpt
index 1c45867..1141a30 100644
--- a/Zend/tests/bug42798.phpt
+++ b/Zend/tests/bug42798.phpt
@@ -2,10 +2,10 @@
 Bug #42798 (_autoload() not triggered for classes used in method signature)
 --FILE--
 <?php
-function __autoload($className) {
+spl_autoload_register(function ($className) {
     print "$className\n";
     exit();
-}
+});
 
 function foo($c = ok::constant) {
 }
diff --git a/Zend/tests/bug46665.phpt b/Zend/tests/bug46665.phpt
index 1f82454..954dbfa 100644
--- a/Zend/tests/bug46665.phpt
+++ b/Zend/tests/bug46665.phpt
@@ -3,12 +3,13 @@ Bug #46665 (Triggering autoload with a variable classname causes truncated autol
 --FILE--
 <?php
 
-$baz = '\\Foo\\Bar\\Baz';
-new $baz();
-function __autoload($class) {
+spl_autoload_register(function ($class) {
     var_dump($class);
     require __DIR__ .'/bug46665_autoload.inc';
-}
+});
+
+$baz = '\\Foo\\Bar\\Baz';
+new $baz();
 
 ?>
 --EXPECTF--
diff --git a/Zend/tests/bug47714.phpt b/Zend/tests/bug47714.phpt
index e8ef8c3..546da44 100644
--- a/Zend/tests/bug47714.phpt
+++ b/Zend/tests/bug47714.phpt
@@ -10,11 +10,7 @@ function au($class) {
               }');
 }
 
-function __autoload($class) {
-        au($class);
-}
-
-//spl_autoload_register('au');
+spl_autoload_register('au');
 
 set_exception_handler(function($exception) {
         $h = new handler();
diff --git a/Zend/tests/bug49908.phpt b/Zend/tests/bug49908.phpt
index 4f2b5b7..6999b9e 100644
--- a/Zend/tests/bug49908.phpt
+++ b/Zend/tests/bug49908.phpt
@@ -3,7 +3,7 @@ Bug #49908 (throwing exception in __autoload crashes when interface is not defin
 --FILE--
 <?php
 
-function __autoload($className) {
+spl_autoload_register(function ($className) {
 	var_dump($className);
 	
 	if ($className == 'Foo') {
@@ -11,7 +11,7 @@ function __autoload($className) {
 	} else {
 		throw new Exception($className);
 	}
-}
+});
 
 new Foo;
 
@@ -22,7 +22,9 @@ string(3) "Bar"
 
 Fatal error: Uncaught Exception: Bar in %s:%d
 Stack trace:
-#0 %s(7): __autoload('Bar')
-#1 %s(13): __autoload('Foo')
-#2 {main}
+#0 [internal function]: {closure}('Bar')
+#1 %s(%d): spl_autoload_call('Bar')
+#2 [internal function]: {closure}('Foo')
+#3 %s(%d): spl_autoload_call('Foo')
+#4 {main}
   thrown in %s on line %d
diff --git a/Zend/tests/bug55007.phpt b/Zend/tests/bug55007.phpt
index 425ce8f..c3fb3c4 100644
--- a/Zend/tests/bug55007.phpt
+++ b/Zend/tests/bug55007.phpt
@@ -3,10 +3,10 @@ Bug #55007 (compiler fail after previous fail)
 --FILE--
 <?php
 
-function __autoload($classname) {
+spl_autoload_register(function ($classname) {
   if ('CompileErrorClass'==$classname) eval('class CompileErrorClass { function foo() { $a[]; } }');
   if ('MyErrorHandler'==$classname) eval('class MyErrorHandler { function __construct() { print "My error handler runs.\n"; } }');
-}
+});
 
 function shutdown() {
   new MyErrorHandler();
diff --git a/Zend/tests/bug61011.phpt b/Zend/tests/bug61011.phpt
index bce0e33..1e91a55 100644
--- a/Zend/tests/bug61011.phpt
+++ b/Zend/tests/bug61011.phpt
@@ -2,9 +2,10 @@
 Bug #61011 (Crash when an exception is thrown by __autoload accessing a static property)
 --FILE--
 <?php
-function __autoload($name) {
+spl_autoload_register(function ($name) {
 	throw new Exception($name);
-}
+});
+
 try { 
 	echo AAA::$a; //zend_fetch_var_address_helper
 } catch (Exception $e) {
diff --git a/Zend/tests/bug62907.phpt b/Zend/tests/bug62907.phpt
index 53ab17c..c47c34b 100644
--- a/Zend/tests/bug62907.phpt
+++ b/Zend/tests/bug62907.phpt
@@ -2,7 +2,7 @@
 Bug #62907 (Double free when use traits)
 --FILE--
 <?php
-function __autoload($name) {
+spl_autoload_register(function ($name) {
     if ($name == "B") {
         eval ("abstract class B extends A { }");
     } else if ($name == "A") {
@@ -11,7 +11,7 @@ function __autoload($name) {
         eval ("trait T { public function __construct() { } }"); 
     } 
     return TRUE;
-} 
+});
 
 class C extends B {
     public function __construct() {
diff --git a/Zend/tests/bug63305.phpt b/Zend/tests/bug63305.phpt
index 4bd3a4d..bd18ccb 100644
--- a/Zend/tests/bug63305.phpt
+++ b/Zend/tests/bug63305.phpt
@@ -2,9 +2,8 @@
 Bug #63305 (zend_mm_heap corrupted with traits)
 --FILE--
 <?php
-new Attachment("");
 
-function __autoload($class) {
+spl_autoload_register(function ($class) {
     switch ($class) {
     case "Attachment":
         eval(<<<'PHP'
@@ -36,7 +35,9 @@ PHP
         break;
     }
     return TRUE;
-}
+});
+
+new Attachment("");
 echo "okey";
 ?>
 --EXPECT--
diff --git a/Zend/tests/bug65254.phpt b/Zend/tests/bug65254.phpt
index d2ebba4..d58759b 100644
--- a/Zend/tests/bug65254.phpt
+++ b/Zend/tests/bug65254.phpt
@@ -2,12 +2,11 @@
 Bug #65254 (Exception not catchable when exception thrown in autoload with a namespace)
 --FILE--
 <?php
-function __autoload($class)
-{
+spl_autoload_register(function ($class) {
     eval("namespace ns_test; class test {}");
 
     throw new \Exception('abcd');
-}
+});
 
 try
 {
diff --git a/Zend/tests/bug71163.phpt b/Zend/tests/bug71163.phpt
index 102b1b9..2f6cbd5 100644
--- a/Zend/tests/bug71163.phpt
+++ b/Zend/tests/bug71163.phpt
@@ -2,10 +2,10 @@
 Bug #71163 (Segmentation Fault (cleanup_unfinished_calls))
 --FILE--
 <?php
-function __autoload($name) { 
+spl_autoload_register(function ($name) { 
 	eval ("class $name extends Exception { public static function foo() {}}");
 	throw new Exception("boom");
-}
+});
 
 function test2() {
 	try {
diff --git a/Zend/tests/call_user_func_002.phpt b/Zend/tests/call_user_func_002.phpt
index 0bf3d39..454c6fd 100644
--- a/Zend/tests/call_user_func_002.phpt
+++ b/Zend/tests/call_user_func_002.phpt
@@ -3,9 +3,9 @@ Testing call_user_func() with autoload and passing invalid params
 --FILE--
 <?php
 
-function __autoload($class) {
+spl_autoload_register(function ($class) {
 	var_dump($class);
-}
+});
 
 call_user_func(array('foo', 'bar'));
 call_user_func(array('', 'bar'));
diff --git a/Zend/tests/catch.phpt b/Zend/tests/catch.phpt
index 0ec5cf7..a83dd75 100644
--- a/Zend/tests/catch.phpt
+++ b/Zend/tests/catch.phpt
@@ -2,11 +2,11 @@
 catch shouldn't call __autoload
 --FILE--
 <?php
-function __autoload($name) {
+
+spl_autoload_register(function ($name) {
 	echo("AUTOLOAD '$name'\n");
 	eval("class $name {}");
-}
-
+});
 
 try {
 } catch (A $e) {
diff --git a/Zend/tests/class_alias_007.phpt b/Zend/tests/class_alias_007.phpt
index 247398e..edcc096 100644
--- a/Zend/tests/class_alias_007.phpt
+++ b/Zend/tests/class_alias_007.phpt
@@ -3,9 +3,9 @@ Testing class_alias() using autoload
 --FILE--
 <?php
 
-function __autoload($a) {
+spl_autoload_register(function ($a) {
 	class foo { }
-}
+});
 
 class_alias('foo', 'bar', 1);
 
diff --git a/Zend/tests/instanceof.phpt b/Zend/tests/instanceof.phpt
index 8bcbede..97d67ff 100644
--- a/Zend/tests/instanceof.phpt
+++ b/Zend/tests/instanceof.phpt
@@ -2,10 +2,10 @@
 instanceof shouldn't call __autoload
 --FILE--
 <?php
-function __autoload($name) {
+spl_autoload_register(function ($name) {
 	echo("AUTOLOAD '$name'\n");
 	eval("class $name {}");
-}
+});
 
 class A {
 }
diff --git a/Zend/tests/is_a.phpt b/Zend/tests/is_a.phpt
index f4161f2..3714d50 100644
--- a/Zend/tests/is_a.phpt
+++ b/Zend/tests/is_a.phpt
@@ -4,10 +4,10 @@ is_a() and is_subclass_of() shouldn't call __autoload
 error_reporting=14335
 --FILE--
 <?php
-function __autoload($name) {
+spl_autoload_register(function ($name) {
 	echo("AUTOLOAD '$name'\n");
 	eval("class $name {}");
-}
+});
 
 class BASE {
 }
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index c289fef..9a904ee 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5523,11 +5523,13 @@ static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_as
 		}
 	}
 
-	if (zend_string_equals_literal(lcname, ZEND_AUTOLOAD_FUNC_NAME)
-		&& zend_ast_get_list(params_ast)->children != 1
-	) {
-		zend_error_noreturn(E_COMPILE_ERROR, "%s() must take exactly 1 argument",
-			ZEND_AUTOLOAD_FUNC_NAME);
+	if (zend_string_equals_literal(lcname, ZEND_AUTOLOAD_FUNC_NAME)) {
+		if (zend_ast_get_list(params_ast)->children != 1) {
+			zend_error_noreturn(E_COMPILE_ERROR, "%s() must take exactly 1 argument",
+				ZEND_AUTOLOAD_FUNC_NAME);
+		}
+
+		zend_error(E_DEPRECATED, "__autoload() is deprecated, use spl_autoload_register() instead");
 	}
 
 	key = zend_build_runtime_definition_key(lcname, decl->lex_pos);
diff --git a/ext/phar/tests/fatal_error_webphar.phpt b/ext/phar/tests/fatal_error_webphar.phpt
index dd6e096..3db8634 100644
--- a/ext/phar/tests/fatal_error_webphar.phpt
+++ b/ext/phar/tests/fatal_error_webphar.phpt
@@ -13,6 +13,7 @@ files/pear2coverage.phar.php
 --EXPECTHEADERS--
 Content-type: text/html; charset=UTF-8
 --EXPECTF--
+Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in %s on line %d
 string(9) "\Web\View"
 
 Parse error: syntax error, unexpected %s, expecting %s in phar://%r([A-Za-z]:)?%r/%sfatal_error_webphar.php/Web/View.php on line 380
diff --git a/ext/reflection/tests/007.phpt b/ext/reflection/tests/007.phpt
index d920417..8dfc2e8 100644
--- a/ext/reflection/tests/007.phpt
+++ b/ext/reflection/tests/007.phpt
@@ -53,10 +53,9 @@ function test($class)
 	echo "\n";
 }
 
-function __autoload($class)
-{
+spl_autoload_register(function ($class) {
 	echo __FUNCTION__ . "($class)\n";
-}
+});
 
 test('Class_does_not_exist');
 
@@ -94,7 +93,7 @@ test('WithCtorWithArgs');
 --EXPECTF--
 
 ====>Class_does_not_exist
-__autoload(Class_does_not_exist)
+{closure}(Class_does_not_exist)
 string(41) "Class Class_does_not_exist does not exist"
 ====>NoCtor
 ====>newInstance()
diff --git a/ext/reflection/tests/bug26640.phpt b/ext/reflection/tests/bug26640.phpt
index e375fd4..8a93d72 100644
--- a/ext/reflection/tests/bug26640.phpt
+++ b/ext/reflection/tests/bug26640.phpt
@@ -3,8 +3,7 @@ Reflection Bug #26640 (__autoload() not invoked by Reflection classes)
 --FILE--
 <?php
 
-function __autoload($c)
-{
+spl_autoload_register(function ($c) {
 	class autoload_class
 	{
 		public function __construct()
@@ -12,7 +11,7 @@ function __autoload($c)
 			print "autoload success\n";
 		}
 	}
-}
+});
 
 $a = new ReflectionClass('autoload_class');
 
diff --git a/ext/reflection/tests/bug29268.phpt b/ext/reflection/tests/bug29268.phpt
index d8efc0b..0ab7e33 100644
--- a/ext/reflection/tests/bug29268.phpt
+++ b/ext/reflection/tests/bug29268.phpt
@@ -2,10 +2,10 @@
 Reflection Bug #29268 (__autoload() not called with reflectionProperty->getClass())
 --FILE--
 <?php
-function __autoload($classname) {
+spl_autoload_register(function ($classname) {
 	echo "__autoload($classname)\n";
 	eval("class $classname {}");
-}
+});
 
 class B{
 	public function doit(A $a){
diff --git a/ext/soap/tests/bugs/bug28751.phpt b/ext/soap/tests/bugs/bug28751.phpt
index 697ebd8..88187eb 100644
--- a/ext/soap/tests/bugs/bug28751.phpt
+++ b/ext/soap/tests/bugs/bug28751.phpt
@@ -4,13 +4,13 @@ Bug #28751 (SoapServer does not call _autoload())
 <?php require_once('skipif.inc'); ?>
 --FILE--
 <?php
-function __autoload($className) {
+spl_autoload_register(function ($className) {
 	class SoapServerActions {
     function test() {
       return "Hello World";
     }
 	}
-}
+});
 
 $server = new SoapServer(NULL, array('uri'=>"http://testuri.org"));
 $server->setClass("SoapServerActions");
diff --git a/ext/spl/tests/class_implements_variation.phpt b/ext/spl/tests/class_implements_variation.phpt
index 84a52ab..4d9e886 100644
--- a/ext/spl/tests/class_implements_variation.phpt
+++ b/ext/spl/tests/class_implements_variation.phpt
@@ -15,15 +15,14 @@ class fs {}
 var_dump(class_implements(new fs));
 var_dump(class_implements('fs'));
 
+spl_autoload_register(function ($classname) {
+   echo "attempting to autoload $classname\n";
+});
+
 echo "\n--- testing autoload ---\n";
 var_dump(class_implements('non_existent'));
 var_dump(class_implements('non_existent2', false));
 
-
-function __autoload($classname) {
-   echo "attempting to autoload $classname\n";
-}
-
 ?>
 ===DONE===
 --EXPECTF--
diff --git a/ext/spl/tests/class_uses_variation.phpt b/ext/spl/tests/class_uses_variation.phpt
index 1a13521..3424e13 100644
--- a/ext/spl/tests/class_uses_variation.phpt
+++ b/ext/spl/tests/class_uses_variation.phpt
@@ -15,15 +15,14 @@ class fs {}
 var_dump(class_uses(new fs));
 var_dump(class_uses('fs'));
 
+spl_autoload_register(function ($classname) {
+   echo "attempting to autoload $classname\n";
+});
+
 echo "\n--- testing autoload ---\n";
 var_dump(class_uses('non_existent'));
 var_dump(class_uses('non_existent2', false));
 
-
-function __autoload($classname) {
-   echo "attempting to autoload $classname\n";
-}
-
 ?>
 ===DONE===
 --EXPECTF--
diff --git a/ext/spl/tests/spl_003.phpt b/ext/spl/tests/spl_003.phpt
index e92a41a..3dd9ab3 100644
--- a/ext/spl/tests/spl_003.phpt
+++ b/ext/spl/tests/spl_003.phpt
@@ -2,6 +2,11 @@
 SPL: class_parents() and class_implements()
 --FILE--
 <?php
+
+spl_autoload_register(function ($cname) {
+    var_dump($cname);
+});
+
 class a{}
 class b extends a{}
 class c extends b{}
@@ -24,10 +29,6 @@ var_dump(class_implements(new a),
          class_implements("bbb", 0)
 );
 
-function __autoload($cname) {
-    var_dump($cname);
-}
-
 ?>
 ===DONE===
 <?php exit(0); ?>
diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c
index db9b25e..252a9cb 100644
--- a/ext/standard/incomplete_class.c
+++ b/ext/standard/incomplete_class.c
@@ -27,8 +27,8 @@
 		"access a property of an incomplete object. " \
 		"Please ensure that the class definition \"%s\" of the object " \
 		"you are trying to operate on was loaded _before_ " \
-		"unserialize() gets called or provide a __autoload() function " \
-		"to load the class definition "
+		"unserialize() gets called or provide an autoloader " \
+		"to load the class definition"
 
 static zend_object_handlers php_incomplete_object_handlers;
 
diff --git a/ext/standard/tests/class_object/class_exists_basic_001.phpt b/ext/standard/tests/class_object/class_exists_basic_001.phpt
index 4cb6cbd..208a895 100644
--- a/ext/standard/tests/class_object/class_exists_basic_001.phpt
+++ b/ext/standard/tests/class_object/class_exists_basic_001.phpt
@@ -10,9 +10,9 @@ Test class_exists() function : basic functionality
 
 echo "*** Testing class_exists() : basic functionality ***\n";
 
-function __autoload($className) {
-	echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+	echo "In autoload($className)\n";
+});
 
 echo "Calling class_exists() on non-existent class with autoload explicitly enabled:\n";
 var_dump( class_exists('C', true) );
@@ -34,7 +34,7 @@ echo "Done";
 --EXPECTF--
 *** Testing class_exists() : basic functionality ***
 Calling class_exists() on non-existent class with autoload explicitly enabled:
-In __autoload(C)
+In autoload(C)
 bool(false)
 
 Calling class_exists() on existing class with autoload explicitly enabled:
@@ -47,9 +47,9 @@ Calling class_exists() on existing class with autoload explicitly disabled:
 bool(true)
 
 Calling class_exists() on non-existent class with autoload unspecified:
-In __autoload(E)
+In autoload(E)
 bool(false)
 
 Calling class_exists() on existing class with autoload unspecified:
 bool(true)
-Done
\ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/class_exists_variation_001.phpt b/ext/standard/tests/class_object/class_exists_variation_001.phpt
index 5f51b4b..b847c02 100644
--- a/ext/standard/tests/class_object/class_exists_variation_001.phpt
+++ b/ext/standard/tests/class_object/class_exists_variation_001.phpt
@@ -8,9 +8,9 @@ Test class_exists() function : usage variations - unexpected types for argument
  * Alias to functions: 
  */
 
-function __autoload($className) {
-	echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+	echo "In autoload($className)\n";
+});
 
 function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
 	echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -88,15 +88,15 @@ Error: 8 - Undefined variable: undefined_var, %s(67)
 Error: 8 - Undefined variable: unset_var, %s(70)
 
 Arg value 0 
-In __autoload(0)
+In autoload(0)
 bool(false)
 
 Arg value 1 
-In __autoload(1)
+In autoload(1)
 bool(false)
 
 Arg value 12345 
-In __autoload(12345)
+In autoload(12345)
 bool(false)
 
 Arg value -2345 
@@ -109,7 +109,7 @@ Arg value -10.5
 bool(false)
 
 Arg value 101234567000 
-In __autoload(101234567000)
+In autoload(101234567000)
 bool(false)
 
 Arg value 1.07654321E-9 
@@ -150,14 +150,14 @@ Arg value
 bool(false)
 
 Arg value 1 
-In __autoload(1)
+In autoload(1)
 bool(false)
 
 Arg value  
 bool(false)
 
 Arg value 1 
-In __autoload(1)
+In autoload(1)
 bool(false)
 
 Arg value  
@@ -179,4 +179,4 @@ bool(false)
 
 Arg value  
 bool(false)
-Done
\ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/class_exists_variation_002.phpt b/ext/standard/tests/class_object/class_exists_variation_002.phpt
index 954e4d8..ee6832c 100644
--- a/ext/standard/tests/class_object/class_exists_variation_002.phpt
+++ b/ext/standard/tests/class_object/class_exists_variation_002.phpt
@@ -8,9 +8,9 @@ Test class_exists() function : usage variations  - unexpected types for argument
  * Alias to functions: 
  */
 
-function __autoload($className) {
-	echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+	echo "In autoload($className)\n";
+});
 
 function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
 	echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -95,35 +95,35 @@ Arg value 0
 bool(false)
 
 Arg value 1 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value 12345 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value -2345 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value 10.5 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value -10.5 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value 101234567000 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value 1.07654321E-9 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value 0.5 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 Error: 8 - Array to string conversion, %sclass_exists_variation_002.php(%d)
 
@@ -158,14 +158,14 @@ Arg value
 bool(false)
 
 Arg value 1 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value  
 bool(false)
 
 Arg value 1 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value  
@@ -178,11 +178,11 @@ Arg value
 bool(false)
 
 Arg value string 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value string 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 Error: 4096 - Object of class stdClass could not be converted to string, %s(80)
 
@@ -195,4 +195,4 @@ bool(false)
 
 Arg value  
 bool(false)
-Done
\ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/get_declared_classes_variation1.phpt b/ext/standard/tests/class_object/get_declared_classes_variation1.phpt
index 259f5dc..3853bb6 100644
--- a/ext/standard/tests/class_object/get_declared_classes_variation1.phpt
+++ b/ext/standard/tests/class_object/get_declared_classes_variation1.phpt
@@ -11,9 +11,9 @@ Test get_declared_classes() function : testing autoloaded classes
 
 echo "*** Testing get_declared_classes() : testing autoloaded classes ***\n";
 
-function __autoload($class_name) {
+spl_autoload_register(function ($class_name) {
     require_once $class_name . '.inc';
-}
+});
 
 echo "\n-- before instance is declared --\n";
 var_dump(in_array('AutoLoaded', get_declared_classes()));
diff --git a/ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt b/ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt
index 56e6161..12c92df 100644
--- a/ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt
+++ b/ext/standard/tests/class_object/get_declared_interfaces_variation1.phpt
@@ -11,9 +11,9 @@ Test get_declared_interfaces() function : autoloading of interfaces
 
 echo "*** Testing get_declared_interfaces() : autoloading of interfaces ***\n";
 
-function __autoload($class_name) {
+spl_autoload_register(function ($class_name) {
     require_once $class_name . '.inc';
-}
+});
 
 echo "\n-- before interface is used --\n";
 var_dump(in_array('AutoInterface', get_declared_interfaces()));
diff --git a/ext/standard/tests/class_object/get_declared_traits_variation1.phpt b/ext/standard/tests/class_object/get_declared_traits_variation1.phpt
index bedd37a..6ea3edf 100644
--- a/ext/standard/tests/class_object/get_declared_traits_variation1.phpt
+++ b/ext/standard/tests/class_object/get_declared_traits_variation1.phpt
@@ -11,9 +11,9 @@ Test get_declared_traits() function : testing autoloaded traits
 
 echo "*** Testing get_declared_traits() : testing autoloaded traits ***\n";
 
-function __autoload($trait_name) {
+spl_autoload_register(function ($trait_name) {
     require_once $trait_name . '.inc';
-}
+});
 
 echo "\n-- before instance is declared --\n";
 var_dump(in_array('AutoTrait', get_declared_traits()));
diff --git a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt
index 0d19e22..97f8481 100644
--- a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt
+++ b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt
@@ -8,9 +8,9 @@ Test get_parent_class() function : usage variations  - unexpected argument type.
  * Alias to functions: 
  */
 
-function __autoload($className) {
-	echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+	echo "In autoload($className)\n";
+});
 
 function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
 	echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -160,11 +160,11 @@ Arg value
 bool(false)
 
 Arg value string 
-In __autoload(string)
+In autoload(string)
 bool(false)
 
 Arg value String 
-In __autoload(String)
+In autoload(String)
 bool(false)
 Error: 4096 - Object of class stdClass could not be converted to string, %s(77)
 
@@ -176,4 +176,4 @@ bool(false)
 
 Arg value  
 bool(false)
-Done
\ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/interface_exists_variation3.phpt b/ext/standard/tests/class_object/interface_exists_variation3.phpt
index d25d74b..5119945 100644
--- a/ext/standard/tests/class_object/interface_exists_variation3.phpt
+++ b/ext/standard/tests/class_object/interface_exists_variation3.phpt
@@ -10,9 +10,9 @@ Test interface_exists() function : autoloaded interface
 
 echo "*** Testing interface_exists() : autoloaded interface ***\n";
 
-function __autoload($class_name) {
+spl_autoload_register(function ($class_name) {
     require_once $class_name . '.inc';
-}
+});
 
 echo "\n-- no autoloading --\n";
 var_dump(interface_exists("AutoInterface", false));
@@ -32,4 +32,4 @@ bool(false)
 -- with autoloading --
 bool(true)
 
-DONE
\ No newline at end of file
+DONE
diff --git a/ext/standard/tests/class_object/interface_exists_variation4.phpt b/ext/standard/tests/class_object/interface_exists_variation4.phpt
index c059805..ca78739 100644
--- a/ext/standard/tests/class_object/interface_exists_variation4.phpt
+++ b/ext/standard/tests/class_object/interface_exists_variation4.phpt
@@ -10,10 +10,9 @@ Test interface_exists() function : test autoload default value
 
 echo "*** Testing interface_exists() : test autoload default value ***\n";
 
-function __autoload($class_name) {
+spl_autoload_register(function ($class_name) {
     require_once $class_name . '.inc';
-}
-
+});
 
 var_dump(interface_exists("AutoInterface"));
 
@@ -24,4 +23,4 @@ echo "\nDONE\n";
 *** Testing interface_exists() : test autoload default value ***
 bool(true)
 
-DONE
\ No newline at end of file
+DONE
diff --git a/ext/standard/tests/class_object/is_a.phpt b/ext/standard/tests/class_object/is_a.phpt
index db74cdc..99794ca 100644
--- a/ext/standard/tests/class_object/is_a.phpt
+++ b/ext/standard/tests/class_object/is_a.phpt
@@ -60,13 +60,10 @@ $t->test();
 $t = new derived_a();
 $t->test();
 
-eval('
-  function __autoload($name)
-  {
-      echo ">>>> In __autoload: ";
-      var_dump($name);
-  }
-');
+spl_autoload_register(function ($name) {
+    echo ">>>> In autoload: ";
+    var_dump($name);
+});
 
 echo "NOW WITH AUTOLOAD\n\n";
 
@@ -201,11 +198,11 @@ is_subclass_of( OBJECT:base, base) =                        no
 is_subclass_of( STRING:base, base) =                        no
 is_subclass_of( STRING:base, base,false) =                  no
 >>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_a( STRING:undefB, base,true) =                           no
 is_a( STRING:undefB, base) =                                no
 is_subclass_of( STRING:undefB, base,false) =                no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_subclass_of( STRING:undefB, base) =                      no
 
 >>> With Defined class
@@ -216,11 +213,11 @@ is_subclass_of( OBJECT:base, derived_a) =                   no
 is_subclass_of( STRING:base, derived_a) =                   no
 is_subclass_of( STRING:base, derived_a,false) =             no
 >>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_a( STRING:undefB, derived_a,true) =                      no
 is_a( STRING:undefB, derived_a) =                           no
 is_subclass_of( STRING:undefB, derived_a,false) =           no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_subclass_of( STRING:undefB, derived_a) =                 no
 
 >>> With Defined class
@@ -231,11 +228,11 @@ is_subclass_of( OBJECT:base, if_a) =                        no
 is_subclass_of( STRING:base, if_a) =                        no
 is_subclass_of( STRING:base, if_a,false) =                  no
 >>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_a( STRING:undefB, if_a,true) =                           no
 is_a( STRING:undefB, if_a) =                                no
 is_subclass_of( STRING:undefB, if_a,false) =                no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_subclass_of( STRING:undefB, if_a) =                      no
 
 >>> With Defined class
@@ -246,11 +243,11 @@ is_subclass_of( OBJECT:base, undefA) =                      no
 is_subclass_of( STRING:base, undefA) =                      no
 is_subclass_of( STRING:base, undefA,false) =                no
 >>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_a( STRING:undefB, undefA,true) =                         no
 is_a( STRING:undefB, undefA) =                              no
 is_subclass_of( STRING:undefB, undefA,false) =              no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_subclass_of( STRING:undefB, undefA) =                    no
 
 
@@ -262,11 +259,11 @@ is_subclass_of( OBJECT:derived_a, base) =                   yes
 is_subclass_of( STRING:derived_a, base) =                   yes
 is_subclass_of( STRING:derived_a, base,false) =             no
 >>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_a( STRING:undefB, base,true) =                           no
 is_a( STRING:undefB, base) =                                no
 is_subclass_of( STRING:undefB, base,false) =                no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_subclass_of( STRING:undefB, base) =                      no
 
 >>> With Defined class
@@ -277,11 +274,11 @@ is_subclass_of( OBJECT:derived_a, derived_a) =              no
 is_subclass_of( STRING:derived_a, derived_a) =              no
 is_subclass_of( STRING:derived_a, derived_a,false) =        no
 >>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_a( STRING:undefB, derived_a,true) =                      no
 is_a( STRING:undefB, derived_a) =                           no
 is_subclass_of( STRING:undefB, derived_a,false) =           no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_subclass_of( STRING:undefB, derived_a) =                 no
 
 >>> With Defined class
@@ -292,11 +289,11 @@ is_subclass_of( OBJECT:derived_a, if_a) =                   yes
 is_subclass_of( STRING:derived_a, if_a) =                   yes
 is_subclass_of( STRING:derived_a, if_a,false) =             no
 >>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_a( STRING:undefB, if_a,true) =                           no
 is_a( STRING:undefB, if_a) =                                no
 is_subclass_of( STRING:undefB, if_a,false) =                no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_subclass_of( STRING:undefB, if_a) =                      no
 
 >>> With Defined class
@@ -307,11 +304,11 @@ is_subclass_of( OBJECT:derived_a, undefA) =                 no
 is_subclass_of( STRING:derived_a, undefA) =                 no
 is_subclass_of( STRING:derived_a, undefA,false) =           no
 >>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_a( STRING:undefB, undefA,true) =                         no
 is_a( STRING:undefB, undefA) =                              no
 is_subclass_of( STRING:undefB, undefA,false) =              no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_subclass_of( STRING:undefB, undefA) =                    no
 
 
@@ -323,11 +320,11 @@ is_subclass_of( OBJECT:derived_b, base) =                   yes
 is_subclass_of( STRING:derived_b, base) =                   yes
 is_subclass_of( STRING:derived_b, base,false) =             no
 >>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_a( STRING:undefB, base,true) =                           no
 is_a( STRING:undefB, base) =                                no
 is_subclass_of( STRING:undefB, base,false) =                no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_subclass_of( STRING:undefB, base) =                      no
 
 >>> With Defined class
@@ -338,11 +335,11 @@ is_subclass_of( OBJECT:derived_b, derived_a) =              no
 is_subclass_of( STRING:derived_b, derived_a) =              no
 is_subclass_of( STRING:derived_b, derived_a,false) =        no
 >>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_a( STRING:undefB, derived_a,true) =                      no
 is_a( STRING:undefB, derived_a) =                           no
 is_subclass_of( STRING:undefB, derived_a,false) =           no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_subclass_of( STRING:undefB, derived_a) =                 no
 
 >>> With Defined class
@@ -353,11 +350,11 @@ is_subclass_of( OBJECT:derived_b, if_a) =                   yes
 is_subclass_of( STRING:derived_b, if_a) =                   yes
 is_subclass_of( STRING:derived_b, if_a,false) =             no
 >>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_a( STRING:undefB, if_a,true) =                           no
 is_a( STRING:undefB, if_a) =                                no
 is_subclass_of( STRING:undefB, if_a,false) =                no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_subclass_of( STRING:undefB, if_a) =                      no
 
 >>> With Defined class
@@ -368,9 +365,9 @@ is_subclass_of( OBJECT:derived_b, undefA) =                 no
 is_subclass_of( STRING:derived_b, undefA) =                 no
 is_subclass_of( STRING:derived_b, undefA,false) =           no
 >>> With Undefined
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_a( STRING:undefB, undefA,true) =                         no
 is_a( STRING:undefB, undefA) =                              no
 is_subclass_of( STRING:undefB, undefA,false) =              no
->>>> In __autoload: string(6) "undefB"
+>>>> In autoload: string(6) "undefB"
 is_subclass_of( STRING:undefB, undefA) =                    no
diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt
index 201d878..b1cb553 100644
--- a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt
+++ b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt
@@ -8,9 +8,9 @@ Test is_subclass_of() function : usage variations  - unexpected type for arg 1
  * Alias to functions: 
  */
 // Note: basic use cases in Zend/tests/is_a.phpt
-function __autoload($className) {
-	echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+	echo "In autoload($className)\n";
+});
 
 function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
 	echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -161,11 +161,11 @@ Arg value
 bool(false)
 
 Arg value string 
-In __autoload(string)
+In autoload(string)
 bool(false)
 
 Arg value String 
-In __autoload(String)
+In autoload(String)
 bool(false)
 
 Arg value  
@@ -173,4 +173,4 @@ bool(false)
 
 Arg value  
 bool(false)
-Done
\ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt
index 9bb712b..85f6976 100644
--- a/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt
+++ b/ext/standard/tests/class_object/is_subclass_of_variation_002.phpt
@@ -8,9 +8,9 @@ Test is_subclass_of() function : usage variations  - unexpected type for arg 2
  * Alias to functions: 
  */
 
-function __autoload($className) {
-	echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+	echo "In autoload($className)\n";
+});
 
 function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
 	echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -173,4 +173,4 @@ bool(false)
 
 Arg value  
 bool(false)
-Done
\ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt
index 65ae8a4..adecd50 100644
--- a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt
+++ b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt
@@ -8,9 +8,9 @@ Test is_subclass_of() function : usage variations  - unexpected type for arg 1 w
  * Alias to functions: 
  */
 // Note: basic use cases in Zend/tests/is_a.phpt
-function __autoload($className) {
-	echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+	echo "In autoload($className)\n";
+});
 
 function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
 	echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -161,11 +161,11 @@ Arg value
 bool(false)
 
 Arg value string 
-In __autoload(string)
+In autoload(string)
 bool(false)
 
 Arg value String 
-In __autoload(String)
+In autoload(String)
 bool(false)
 
 Arg value  
@@ -173,4 +173,4 @@ bool(false)
 
 Arg value  
 bool(false)
-Done
\ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/method_exists_basic_003.phpt b/ext/standard/tests/class_object/method_exists_basic_003.phpt
index 32f62b7..3ac1795 100644
--- a/ext/standard/tests/class_object/method_exists_basic_003.phpt
+++ b/ext/standard/tests/class_object/method_exists_basic_003.phpt
@@ -8,15 +8,15 @@ method_exists() on non-existent class, with __autoload().
  * Alias to functions: 
  */
 
-function __autoload($name) {
-	echo "In __autoload($name)\n"; 
-} 
+spl_autoload_register(function ($name) {
+	echo "In autoload($name)\n"; 
+});
 
 var_dump(method_exists('UndefC', 'func'));
 
 echo "Done";
 ?>
 --EXPECTF--
-In __autoload(UndefC)
+In autoload(UndefC)
 bool(false)
-Done
\ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/method_exists_variation_001.phpt b/ext/standard/tests/class_object/method_exists_variation_001.phpt
index 1947c76..b41a1a1 100644
--- a/ext/standard/tests/class_object/method_exists_variation_001.phpt
+++ b/ext/standard/tests/class_object/method_exists_variation_001.phpt
@@ -8,9 +8,9 @@ Test method_exists() function : usage variations  - unexpected type for arg 1
  * Alias to functions: 
  */
 
-function __autoload($className) {
-	echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+	echo "In autoload($className)\n";
+});
 
 function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
 	echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -160,11 +160,11 @@ Arg value
 bool(false)
 
 Arg value string 
-In __autoload(string)
+In autoload(string)
 bool(false)
 
 Arg value String 
-In __autoload(String)
+In autoload(String)
 bool(false)
 
 Arg value  
@@ -172,4 +172,4 @@ bool(false)
 
 Arg value  
 bool(false)
-Done
\ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/method_exists_variation_002.phpt b/ext/standard/tests/class_object/method_exists_variation_002.phpt
index b1204e8..5c924bd 100644
--- a/ext/standard/tests/class_object/method_exists_variation_002.phpt
+++ b/ext/standard/tests/class_object/method_exists_variation_002.phpt
@@ -8,9 +8,9 @@ Test method_exists() function : usage variations  - unexpected type for arg 2
  * Alias to functions: 
  */
 
-function __autoload($className) {
-	echo "In __autoload($className)\n";
-}
+spl_autoload_register(function ($className) {
+	echo "In autoload($className)\n";
+});
 
 function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
 	echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -173,4 +173,4 @@ bool(false)
 
 Arg value  
 bool(false)
-Done
\ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/property_exists_variation1.phpt b/ext/standard/tests/class_object/property_exists_variation1.phpt
index 1505a4b..1830440 100644
--- a/ext/standard/tests/class_object/property_exists_variation1.phpt
+++ b/ext/standard/tests/class_object/property_exists_variation1.phpt
@@ -10,9 +10,9 @@ Test property_exists() function : class auto loading
 
 echo "*** Testing property_exists() : class auto loading ***\n";
 
-function __autoload($class_name) {
+spl_autoload_register(function ($class_name) {
     require_once $class_name . '.inc';
-}
+});
 
 echo "\ntesting property in autoloaded class\n";
 var_dump(property_exists("AutoTest", "bob"));
@@ -30,4 +30,4 @@ bool(true)
 
 testing __get magic method
 bool(false)
-===DONE===
\ No newline at end of file
+===DONE===
diff --git a/ext/standard/tests/class_object/trait_exists_basic_001.phpt b/ext/standard/tests/class_object/trait_exists_basic_001.phpt
index 19616ab..6e1d452 100644
--- a/ext/standard/tests/class_object/trait_exists_basic_001.phpt
+++ b/ext/standard/tests/class_object/trait_exists_basic_001.phpt
@@ -10,9 +10,9 @@ Test trait_exists() function : basic functionality
 
 echo "*** Testing trait_exists() : basic functionality ***\n";
 
-function __autoload($traitName) {
-	echo "In __autoload($traitName)\n";
-}
+spl_autoload_register(function ($traitName) {
+	echo "In autoload($traitName)\n";
+});
 
 trait MyTrait {}
 
@@ -36,7 +36,7 @@ echo "Done";
 --EXPECTF--
 *** Testing trait_exists() : basic functionality ***
 Calling trait_exists() on non-existent trait with autoload explicitly enabled:
-In __autoload(C)
+In autoload(C)
 bool(false)
 
 Calling trait_exists() on existing trait with autoload explicitly enabled:
@@ -49,9 +49,9 @@ Calling trait_exists() on existing trait with autoload explicitly disabled:
 bool(true)
 
 Calling trait_exists() on non-existent trait with autoload unspecified:
-In __autoload(E)
+In autoload(E)
 bool(false)
 
 Calling trait_exists() on existing trait with autoload unspecified:
 bool(true)
-Done
\ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/trait_exists_variation_001.phpt b/ext/standard/tests/class_object/trait_exists_variation_001.phpt
index 81df711..4fd2b8d 100644
--- a/ext/standard/tests/class_object/trait_exists_variation_001.phpt
+++ b/ext/standard/tests/class_object/trait_exists_variation_001.phpt
@@ -8,9 +8,9 @@ Test trait_exists() function : usage variations - unexpected types for argument
  * Alias to functions: 
  */
 
-function __autoload($traitName) {
-	echo "In __autoload($traitName)\n";
-}
+spl_autoload_register(function ($traitName) {
+	echo "In autoload($traitName)\n";
+});
 
 function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
 	echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -88,15 +88,15 @@ Error: 8 - Undefined variable: undefined_var, %s(67)
 Error: 8 - Undefined variable: unset_var, %s(70)
 
 Arg value 0 
-In __autoload(0)
+In autoload(0)
 bool(false)
 
 Arg value 1 
-In __autoload(1)
+In autoload(1)
 bool(false)
 
 Arg value 12345 
-In __autoload(12345)
+In autoload(12345)
 bool(false)
 
 Arg value -2345 
@@ -109,7 +109,7 @@ Arg value -10.5
 bool(false)
 
 Arg value 101234567000 
-In __autoload(101234567000)
+In autoload(101234567000)
 bool(false)
 
 Arg value 1.07654321E-9 
@@ -150,14 +150,14 @@ Arg value
 bool(false)
 
 Arg value 1 
-In __autoload(1)
+In autoload(1)
 bool(false)
 
 Arg value  
 bool(false)
 
 Arg value 1 
-In __autoload(1)
+In autoload(1)
 bool(false)
 
 Arg value  
@@ -179,4 +179,4 @@ bool(false)
 
 Arg value  
 bool(false)
-Done
\ No newline at end of file
+Done
diff --git a/ext/standard/tests/class_object/trait_exists_variation_002.phpt b/ext/standard/tests/class_object/trait_exists_variation_002.phpt
index 365efff..50f2a02 100644
--- a/ext/standard/tests/class_object/trait_exists_variation_002.phpt
+++ b/ext/standard/tests/class_object/trait_exists_variation_002.phpt
@@ -8,9 +8,9 @@ Test trait_exists() function : usage variations  - unexpected types for argument
  * Alias to functions: 
  */
 
-function __autoload($traitName) {
-	echo "In __autoload($traitName)\n";
-}
+spl_autoload_register(function ($traitName) {
+	echo "In autoload($traitName)\n";
+});
 
 function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
 	echo "Error: $err_no - $err_msg, $filename($linenum)\n";
@@ -95,35 +95,35 @@ Arg value 0
 bool(false)
 
 Arg value 1 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value 12345 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value -2345 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value 10.5 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value -10.5 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value 101234567000 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value 1.07654321E-9 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value 0.5 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 Error: 8 - Array to string conversion, %strait_exists_variation_002.php(%d)
 
@@ -158,14 +158,14 @@ Arg value
 bool(false)
 
 Arg value 1 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value  
 bool(false)
 
 Arg value 1 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value  
@@ -178,11 +178,11 @@ Arg value
 bool(false)
 
 Arg value string 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 
 Arg value string 
-In __autoload(string_val)
+In autoload(string_val)
 bool(false)
 Error: 4096 - Object of class stdClass could not be converted to string, %s(80)
 
@@ -195,4 +195,4 @@ bool(false)
 
 Arg value  
 bool(false)
-Done
\ No newline at end of file
+Done
diff --git a/ext/standard/tests/general_functions/bug35229.phpt b/ext/standard/tests/general_functions/bug35229.phpt
index c3c273d..8e8895d 100644
--- a/ext/standard/tests/general_functions/bug35229.phpt
+++ b/ext/standard/tests/general_functions/bug35229.phpt
@@ -8,8 +8,7 @@ class test2 {
   }
 }
 
-function __autoload($class)
-{
+spl_autoload_register(function ($class) {
 	eval('class test1 extends test2 {}');
 
 	test1::use_stack(
@@ -17,7 +16,7 @@ function __autoload($class)
     11,12,13,14,15,16,17,18,19,20,
     21,22,23,24,25,26,27,28,29,30
   );
-}
+});
 
 call_user_func(array('test1', 'use_stack'),
   1,2,3,4,5,6,7,8,9,10,
diff --git a/ext/standard/tests/serialize/005.phpt b/ext/standard/tests/serialize/005.phpt
index 2df2701..1702a44 100644
--- a/ext/standard/tests/serialize/005.phpt
+++ b/ext/standard/tests/serialize/005.phpt
@@ -31,12 +31,11 @@ function unserializer($class_name)
 		eval("class TestNANew2 extends TestNew {}");
 		break;
 	default:
-		echo "Try __autoload()\n";
-		if (!function_exists('__autoload'))
-		{
-			eval('function __autoload($class_name) { do_autoload($class_name); }');
+		echo "Try autoloader\n";
+		if (!spl_autoload_functions()) {
+			spl_autoload_register(function ($class_name) { do_autoload($class_name); });
 		}
-		__autoload($class_name);
+		spl_autoload_call($class_name);
 		break;
 	}
 }
@@ -123,7 +122,7 @@ var_dump(unserialize('C:10:"TestNANew2":0:{}'));
 echo "===AutoOld===\n";
 var_dump(unserialize('O:19:"autoload_implements":0:{}'));
 
-// Now we have __autoload(), that will be called before the old style header.
+// Now we have an autoloader, that will be called before the old style header.
 // If the old style handler also fails to register the class then the object
 // becomes an incomplete class instance.
 
@@ -168,7 +167,7 @@ object(TestNANew2)#%d (0) {
 }
 ===AutoOld===
 unserializer(autoload_implements)
-Try __autoload()
+Try autoloader
 do_autoload(autoload_interface)
 do_autoload(autoload_implements)
 object(autoload_implements)#%d (0) {
@@ -176,7 +175,7 @@ object(autoload_implements)#%d (0) {
 ===AutoNA===
 do_autoload(autoload_not_available)
 unserializer(autoload_not_available)
-Try __autoload()
+Try autoloader
 do_autoload(autoload_not_available)
 do_autoload(autoload_not_available)
 
diff --git a/ext/standard/tests/serialize/bug30234.phpt b/ext/standard/tests/serialize/bug30234.phpt
index 9b40cc5..ae3a0b2 100644
--- a/ext/standard/tests/serialize/bug30234.phpt
+++ b/ext/standard/tests/serialize/bug30234.phpt
@@ -7,11 +7,10 @@ Bug #30234 (__autoload() not invoked for interfaces)
 --FILE--
 <?php
 
-function __autoload($class_name)
-{
+spl_autoload_register(function ($class_name) {
 	require_once(dirname(__FILE__) . '/' . strtolower($class_name) . '.p5c');
 	echo __FUNCTION__ . '(' . $class_name . ")\n";
-}
+});
 
 var_dump(interface_exists('autoload_interface', false));
 var_dump(class_exists('autoload_implements', false));
@@ -30,8 +29,8 @@ var_dump(class_exists('autoload_implements', false));
 --EXPECTF--
 bool(false)
 bool(false)
-__autoload(autoload_interface)
-__autoload(Autoload_Implements)
+{closure}(autoload_interface)
+{closure}(Autoload_Implements)
 object(autoload_implements)#%d (0) {
 }
 bool(true)
diff --git a/ext/standard/tests/serialize/bug62836_1.phpt b/ext/standard/tests/serialize/bug62836_1.phpt
index 7291046..7d03e9f 100644
--- a/ext/standard/tests/serialize/bug62836_1.phpt
+++ b/ext/standard/tests/serialize/bug62836_1.phpt
@@ -3,10 +3,10 @@ Bug #62836 (Seg fault or broken object references on unserialize())
 --FILE--
 <?php
 $serialized_object='O:1:"A":4:{s:1:"b";O:1:"B":0:{}s:2:"b1";r:2;s:1:"c";O:1:"B":0:{}s:2:"c1";r:4;}';
-function __autoload($name) {
+spl_autoload_register(function ($name) {
     unserialize("i:4;");
     eval("class $name {} ");
-}
+});
 
 print_r(unserialize($serialized_object));
 echo "okey";
diff --git a/ext/standard/tests/serialize/bug69152.phpt b/ext/standard/tests/serialize/bug69152.phpt
index b766c0a..c4dbcd6 100644
--- a/ext/standard/tests/serialize/bug69152.phpt
+++ b/ext/standard/tests/serialize/bug69152.phpt
@@ -13,4 +13,4 @@ Exception in %s:%d
 Stack trace:
 #0 {main}
 
-Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line %d
+Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
diff --git a/ext/standard/tests/serialize/bug70213.phpt b/ext/standard/tests/serialize/bug70213.phpt
index c01d362..fd7d400 100644
--- a/ext/standard/tests/serialize/bug70213.phpt
+++ b/ext/standard/tests/serialize/bug70213.phpt
@@ -6,9 +6,9 @@ Bug #70213: Unserialize context shared on double class lookup
 ini_set('unserialize_callback_func', 'evil');
 
 function evil() {
-	function __autoload($arg) {
+	spl_autoload_register(function ($arg) {
         var_dump(unserialize('R:1;'));
-    }
+    });
 }
 
 var_dump(unserialize('a:2:{i:0;i:42;i:1;O:4:"evil":0:{}}'));
@@ -23,7 +23,7 @@ array(2) {
   [0]=>
   int(42)
   [1]=>
-  object(__PHP_Incomplete_Class)#1 (1) {
+  object(__PHP_Incomplete_Class)#2 (1) {
     ["__PHP_Incomplete_Class_Name"]=>
     string(4) "evil"
   }
diff --git a/ext/standard/tests/serialize/incomplete_class.phpt b/ext/standard/tests/serialize/incomplete_class.phpt
index 8280485..7e6aa7b 100644
--- a/ext/standard/tests/serialize/incomplete_class.phpt
+++ b/ext/standard/tests/serialize/incomplete_class.phpt
@@ -17,11 +17,11 @@ echo "Done\n";
 object(__PHP_Incomplete_Class)#%d (0) {
 }
 
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line %d
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
 
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line %d
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
 NULL
 
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line %d
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
 NULL
 Done
diff --git a/ext/standard/tests/serialize/serialization_objects_005.phpt b/ext/standard/tests/serialize/serialization_objects_005.phpt
index 9800168..fd58b03 100644
--- a/ext/standard/tests/serialize/serialization_objects_005.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_005.phpt
@@ -90,31 +90,31 @@ object(__PHP_Incomplete_Class)#%d (2) {
 }
 bool(true)
 
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 43
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
 NULL
 
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 46
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
 
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 47
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
 NULL
 
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 49
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
 NULL
 
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 50
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
 string(9) "p.changed"
 
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 53
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
 bool(false)
 
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 54
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
 
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 55
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
 bool(false)
 
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 56
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
 
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 57
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
 NULL
 
-Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 59
+Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
diff --git a/ext/standard/tests/serialize/serialization_objects_006.phpt b/ext/standard/tests/serialize/serialization_objects_006.phpt
index e223f4e..918e59d 100644
--- a/ext/standard/tests/serialize/serialization_objects_006.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_006.phpt
@@ -23,6 +23,6 @@ echo "Done";
 object(__PHP_Incomplete_Class)#%d (0) {
 }
 
-Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 15
+Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
 NULL
-Done
\ No newline at end of file
+Done
diff --git a/ext/standard/tests/serialize/serialization_objects_007.phpt b/ext/standard/tests/serialize/serialization_objects_007.phpt
index 9cba9d1..2837e1e 100644
--- a/ext/standard/tests/serialize/serialization_objects_007.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_007.phpt
@@ -13,9 +13,9 @@ Ensure __autoload is called twice if unserialize_callback_func is defined.
  * Alias to functions: 
  */
 
-function __autoload($name) {
-	echo "in __autoload($name)\n";
-}
+spl_autoload_register(function ($name) {
+	echo "in autoload($name)\n";
+});
 
 ini_set('unserialize_callback_func','check');
 
@@ -30,13 +30,13 @@ var_dump($o);
 echo "Done";
 ?>
 --EXPECTF--
-in __autoload(FOO)
+in autoload(FOO)
 in check(FOO)
-in __autoload(FOO)
+in autoload(FOO)
 
 Warning: unserialize(): Function check() hasn't defined the class it was called for in %s on line 23
 object(__PHP_Incomplete_Class)#%d (1) {
   ["__PHP_Incomplete_Class_Name"]=>
   string(3) "FOO"
 }
-Done
\ No newline at end of file
+Done
diff --git a/ext/xsl/tests/bug33853.phpt b/ext/xsl/tests/bug33853.phpt
index bcf30f6..16d7f73 100644
--- a/ext/xsl/tests/bug33853.phpt
+++ b/ext/xsl/tests/bug33853.phpt
@@ -5,10 +5,10 @@ Bug #33853 (php:function call __autoload with lowercase param)
 --FILE--
 <?php
 
-function __autoload($className) {
+spl_autoload_register(function ($className) {
         var_dump($className);
         exit();
-}
+});
 
 $xsl = new DomDocument();
 $xsl->loadXML('<?xml version="1.0" encoding="iso-8859-1" ?>
diff --git a/tests/classes/autoload_001.phpt b/tests/classes/autoload_001.phpt
index 6b520b7..6c09c4e 100644
--- a/tests/classes/autoload_001.phpt
+++ b/tests/classes/autoload_001.phpt
@@ -7,17 +7,16 @@ ZE2 Autoload and class_exists
 --FILE--
 <?php
 
-function __autoload($class_name)
-{
+spl_autoload_register(function ($class_name) {
 	require_once(dirname(__FILE__) . '/' . $class_name . '.p5c');
-	echo __FUNCTION__ . '(' . $class_name . ")\n";
-}
+	echo 'autoload(' . $class_name . ")\n";
+});
 
 var_dump(class_exists('autoload_root'));
 
 ?>
 ===DONE===
 --EXPECT--
-__autoload(autoload_root)
+autoload(autoload_root)
 bool(true)
 ===DONE===
diff --git a/tests/classes/autoload_002.phpt b/tests/classes/autoload_002.phpt
index 582cb46..ecb1a44 100644
--- a/tests/classes/autoload_002.phpt
+++ b/tests/classes/autoload_002.phpt
@@ -7,18 +7,17 @@ ZE2 Autoload and get_class_methods
 --FILE--
 <?php
 
-function __autoload($class_name)
-{
+spl_autoload_register(function ($class_name) {
 	require_once(dirname(__FILE__) . '/' . $class_name . '.p5c');
-	echo __FUNCTION__ . '(' . $class_name . ")\n";
-}
+	echo 'autoload(' . $class_name . ")\n";
+});
 
 var_dump(get_class_methods('autoload_root'));
 
 ?>
 ===DONE===
 --EXPECT--
-__autoload(autoload_root)
+autoload(autoload_root)
 array(1) {
   [0]=>
   string(12) "testFunction"
diff --git a/tests/classes/autoload_003.phpt b/tests/classes/autoload_003.phpt
index 41e877c..f79b85a 100644
--- a/tests/classes/autoload_003.phpt
+++ b/tests/classes/autoload_003.phpt
@@ -7,18 +7,17 @@ ZE2 Autoload and derived classes
 --FILE--
 <?php
 
-function __autoload($class_name)
-{
+spl_autoload_register(function ($class_name) {
 	require_once(dirname(__FILE__) . '/' . $class_name . '.p5c');
-	echo __FUNCTION__ . '(' . $class_name . ")\n";
-}
+	echo 'autoload(' . $class_name . ")\n";
+});
 
 var_dump(class_exists('autoload_derived'));
 
 ?>
 ===DONE===
 --EXPECT--
-__autoload(autoload_root)
-__autoload(autoload_derived)
+autoload(autoload_root)
+autoload(autoload_derived)
 bool(true)
 ===DONE===
diff --git a/tests/classes/autoload_004.phpt b/tests/classes/autoload_004.phpt
index 88b10b5..1f754ca 100644
--- a/tests/classes/autoload_004.phpt
+++ b/tests/classes/autoload_004.phpt
@@ -7,12 +7,11 @@ ZE2 Autoload and recursion
 --FILE--
 <?php
 
-function __autoload($class_name)
-{
+spl_autoload_register(function ($class_name) {
 	var_dump(class_exists($class_name));
 	require_once(dirname(__FILE__) . '/' . $class_name . '.p5c');
-	echo __FUNCTION__ . '(' . $class_name . ")\n";
-}
+	echo 'autoload(' . $class_name . ")\n";
+});
 
 var_dump(class_exists('autoload_derived'));
 
@@ -21,7 +20,7 @@ var_dump(class_exists('autoload_derived'));
 --EXPECT--
 bool(false)
 bool(false)
-__autoload(autoload_root)
-__autoload(autoload_derived)
+autoload(autoload_root)
+autoload(autoload_derived)
 bool(true)
 ===DONE===
diff --git a/tests/classes/autoload_005.phpt b/tests/classes/autoload_005.phpt
index c574139..26f4d6a 100644
--- a/tests/classes/autoload_005.phpt
+++ b/tests/classes/autoload_005.phpt
@@ -7,12 +7,11 @@ ZE2 Autoload from destructor
 --FILE--
 <?php
 
-function __autoload($class_name)
-{
+spl_autoload_register(function ($class_name) {
 	var_dump(class_exists($class_name, false));
 	require_once(dirname(__FILE__) . '/' . $class_name . '.p5c');
-	echo __FUNCTION__ . '(' . $class_name . ")\n";
-}
+	echo 'autoload(' . $class_name . ")\n";
+});
 
 var_dump(class_exists('autoload_derived', false));
 var_dump(class_exists('autoload_derived', false));
@@ -37,8 +36,8 @@ bool(false)
 Test::__destruct
 bool(false)
 bool(false)
-__autoload(autoload_root)
-__autoload(autoload_derived)
+autoload(autoload_root)
+autoload(autoload_derived)
 object(autoload_derived)#%d (0) {
 }
 ===DONE===
diff --git a/tests/classes/autoload_006.phpt b/tests/classes/autoload_006.phpt
index 173b87d..092e2e2 100644
--- a/tests/classes/autoload_006.phpt
+++ b/tests/classes/autoload_006.phpt
@@ -7,11 +7,10 @@ ZE2 Autoload from destructor
 --FILE--
 <?php
 
-function __autoload($class_name)
-{
+spl_autoload_register(function ($class_name) {
 	require_once(dirname(__FILE__) . '/' . strtolower($class_name) . '.p5c');
-	echo __FUNCTION__ . '(' . $class_name . ")\n";
-}
+	echo 'autoload(' . $class_name . ")\n";
+});
 
 var_dump(interface_exists('autoload_interface', false));
 var_dump(class_exists('autoload_implements', false));
@@ -29,8 +28,8 @@ var_dump(class_exists('autoload_implements', false));
 --EXPECTF--
 bool(false)
 bool(false)
-__autoload(autoload_interface)
-__autoload(Autoload_Implements)
+autoload(autoload_interface)
+autoload(Autoload_Implements)
 object(autoload_implements)#%d (0) {
 }
 bool(true)
diff --git a/tests/classes/autoload_007.phpt b/tests/classes/autoload_007.phpt
index 5652c12..ba542a1 100644
--- a/tests/classes/autoload_007.phpt
+++ b/tests/classes/autoload_007.phpt
@@ -2,14 +2,13 @@
 Ensure instanceof does not trigger autoload.
 --FILE--
 <?php
-  function __autoload($name)
-  {
-      echo "In autoload: ";
-      var_dump($name);
-  }
-  
-  $a = new stdClass;
-  var_dump($a instanceof UndefC);
+spl_autoload_register(function ($name) {
+  echo "In autoload: ";
+  var_dump($name);
+});
+
+$a = new stdClass;
+var_dump($a instanceof UndefC);
 ?>
 --EXPECTF--
 bool(false)
diff --git a/tests/classes/autoload_008.phpt b/tests/classes/autoload_008.phpt
index 75a9cd0..1f3f075 100644
--- a/tests/classes/autoload_008.phpt
+++ b/tests/classes/autoload_008.phpt
@@ -2,25 +2,24 @@
 Ensure catch blocks for unknown exception types do not trigger autoload.
 --FILE--
 <?php
-  function __autoload($name)
-  {
-      echo "In autoload: ";
-      var_dump($name);
-  }
-  
-  function f()
-  {
-      throw new Exception();
-  }
-  try {
-      f();
-  }
-  catch (UndefC $u) {
-      echo "In UndefClass catch block.\n";
-  }
-  catch (Exception $e) {
-      echo "In Exception catch block. Autoload should not have been triggered.\n";
-  }
+spl_autoload_register(function ($name) {
+  echo "In autoload: ";
+  var_dump($name);
+});
+
+function f()
+{
+  throw new Exception();
+}
+try {
+  f();
+}
+catch (UndefC $u) {
+  echo "In UndefClass catch block.\n";
+}
+catch (Exception $e) {
+  echo "In Exception catch block. Autoload should not have been triggered.\n";
+}
 ?>
 --EXPECTF--
 In Exception catch block. Autoload should not have been triggered.
diff --git a/tests/classes/autoload_009.phpt b/tests/classes/autoload_009.phpt
index 150f3ec..ebe691c 100644
--- a/tests/classes/autoload_009.phpt
+++ b/tests/classes/autoload_009.phpt
@@ -2,16 +2,15 @@
 Ensure type hints for unknown types do not trigger autoload. 
 --FILE--
 <?php
-  function __autoload($name)
-  {
-      echo "In autoload: ";
-      var_dump($name);
-  }
-  
-  function f(UndefClass $x)
-  {
-  }
-  f(new stdClass);
+spl_autoload_register(function ($name) {
+  echo "In autoload: ";
+  var_dump($name);
+});
+
+function f(UndefClass $x)
+{
+}
+f(new stdClass);
 ?>
 --EXPECTF--
 Fatal error: Uncaught TypeError: Argument 1 passed to f() must be an instance of UndefClass, instance of stdClass given, called in %s on line %d and defined in %s:%d
diff --git a/tests/classes/autoload_010.phpt b/tests/classes/autoload_010.phpt
index 104f688..e65c256 100644
--- a/tests/classes/autoload_010.phpt
+++ b/tests/classes/autoload_010.phpt
@@ -2,15 +2,14 @@
 Ensure implements does trigger autoload.
 --FILE--
 <?php
-  function __autoload($name)
-  {
-      echo "In autoload: ";
-      var_dump($name);
-  }
-  
-  class C implements UndefI
-  {
-  }
+spl_autoload_register(function ($name) {
+  echo "In autoload: ";
+  var_dump($name);
+});
+
+class C implements UndefI
+{
+}
 ?>
 --EXPECTF--
 In autoload: string(6) "UndefI"
diff --git a/tests/classes/autoload_011.phpt b/tests/classes/autoload_011.phpt
index 86858d5..aaea38c 100644
--- a/tests/classes/autoload_011.phpt
+++ b/tests/classes/autoload_011.phpt
@@ -2,15 +2,14 @@
 Ensure extends does trigger autoload.
 --FILE--
 <?php
-  function __autoload($name)
-  {
-      echo "In autoload: ";
-      var_dump($name);
-  }
-  
-  class C extends UndefBase
-  {
-  }
+spl_autoload_register(function ($name) {
+  echo "In autoload: ";
+  var_dump($name);
+});
+
+class C extends UndefBase
+{
+}
 ?>
 --EXPECTF--
 In autoload: string(9) "UndefBase"
diff --git a/tests/classes/autoload_012.phpt b/tests/classes/autoload_012.phpt
index d6750b7..4fc41c8 100644
--- a/tests/classes/autoload_012.phpt
+++ b/tests/classes/autoload_012.phpt
@@ -2,12 +2,11 @@
 Ensure callback methods in unknown classes trigger autoload.
 --FILE--
 <?php
-  function __autoload($name)
-  {
-      echo "In autoload: ";
-      var_dump($name);
-  }
-  call_user_func("UndefC::test");
+spl_autoload_register(function ($name) {
+  echo "In autoload: ";
+  var_dump($name);
+});
+call_user_func("UndefC::test");
 ?>
 --EXPECTF--
 In autoload: string(6) "UndefC"
diff --git a/tests/classes/autoload_013.phpt b/tests/classes/autoload_013.phpt
index 4309cea..a63b129 100644
--- a/tests/classes/autoload_013.phpt
+++ b/tests/classes/autoload_013.phpt
@@ -4,18 +4,17 @@ Ensure the ReflectionClass constructor triggers autoload.
 <?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
-  function __autoload($name)
-  {
-      echo "In autoload: ";
-      var_dump($name);
-  }
-  
-  try {
-      new ReflectionClass("UndefC");
-  }
-  catch (ReflectionException $e) {
-      echo $e->getMessage();
-  }
+spl_autoload_register(function ($name) {
+  echo "In autoload: ";
+  var_dump($name);
+});
+
+try {
+  new ReflectionClass("UndefC");
+}
+catch (ReflectionException $e) {
+  echo $e->getMessage();
+}
 ?>
 --EXPECTF--
 In autoload: string(6) "UndefC"
diff --git a/tests/classes/autoload_014.phpt b/tests/classes/autoload_014.phpt
index a3f04b7..3eb0484 100644
--- a/tests/classes/autoload_014.phpt
+++ b/tests/classes/autoload_014.phpt
@@ -4,18 +4,17 @@ Ensure the ReflectionMethod constructor triggers autoload.
 <?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
-  function __autoload($name)
-  {
-      echo "In autoload: ";
-      var_dump($name);
-  }
-  
-  try {
-      new ReflectionMethod("UndefC::test");
-  }
-  catch (ReflectionException $e) {
-      echo $e->getMessage();
-  }
+spl_autoload_register(function ($name) {
+  echo "In autoload: ";
+  var_dump($name);
+});
+
+try {
+  new ReflectionMethod("UndefC::test");
+}
+catch (ReflectionException $e) {
+  echo $e->getMessage();
+}
 ?>
 --EXPECTF--
 In autoload: string(6) "UndefC"
diff --git a/tests/classes/autoload_015.phpt b/tests/classes/autoload_015.phpt
index 2b14a0d..edff01c 100644
--- a/tests/classes/autoload_015.phpt
+++ b/tests/classes/autoload_015.phpt
@@ -4,18 +4,17 @@ Ensure the ReflectionProperty constructor triggers autoload.
 <?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
-  function __autoload($name)
-  {
-      echo "In autoload: ";
-      var_dump($name);
-  }
-  
-  try {
-      new ReflectionProperty('UndefC', 'p');
-  }
-  catch (ReflectionException $e) {
-      echo $e->getMessage();
-  }
+spl_autoload_register(function ($name) {
+  echo "In autoload: ";
+  var_dump($name);
+});
+
+try {
+  new ReflectionProperty('UndefC', 'p');
+}
+catch (ReflectionException $e) {
+  echo $e->getMessage();
+}
 ?>
 --EXPECTF--
 In autoload: string(6) "UndefC"
diff --git a/tests/classes/autoload_016.phpt b/tests/classes/autoload_016.phpt
index 60263ba..d1ff885 100644
--- a/tests/classes/autoload_016.phpt
+++ b/tests/classes/autoload_016.phpt
@@ -4,19 +4,18 @@ Ensure ReflectionClass::getProperty() triggers autoload
 <?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
-  function __autoload($name)
-  {
-      echo "In autoload: ";
-      var_dump($name);
-  }
+spl_autoload_register(function ($name) {
+  echo "In autoload: ";
+  var_dump($name);
+});
 
-  $rc = new ReflectionClass("stdClass");
-  
-  try {
-    $rc->getProperty("UndefC::p");
-  } catch (ReflectionException $e) {
-      echo $e->getMessage();
-  }
+$rc = new ReflectionClass("stdClass");
+
+try {
+$rc->getProperty("UndefC::p");
+} catch (ReflectionException $e) {
+  echo $e->getMessage();
+}
 ?>
 --EXPECTF--
 In autoload: string(6) "undefc"
diff --git a/tests/classes/autoload_017.phpt b/tests/classes/autoload_017.phpt
index d5ce2bd..8e1aeac 100644
--- a/tests/classes/autoload_017.phpt
+++ b/tests/classes/autoload_017.phpt
@@ -4,19 +4,18 @@ Ensure ReflectionClass::implementsInterface triggers autoload.
 <?php extension_loaded('reflection') or die('skip'); ?>
 --FILE--
 <?php
-  function __autoload($name)
-  {
-      echo "In autoload: ";
-      var_dump($name);
-  }
+spl_autoload_register(function ($name) {
+  echo "In autoload: ";
+  var_dump($name);
+});
 
-  $rc = new ReflectionClass("stdClass");
-  
-  try {
-    $rc->implementsInterface("UndefI");
-  } catch (ReflectionException $e) {
-    echo $e->getMessage();
-  }
+$rc = new ReflectionClass("stdClass");
+
+try {
+  $rc->implementsInterface("UndefI");
+} catch (ReflectionException $e) {
+  echo $e->getMessage();
+}
 ?>
 --EXPECTF--
 In autoload: string(6) "UndefI"
diff --git a/tests/classes/autoload_018.phpt b/tests/classes/autoload_018.phpt
index 59e20e2..2099499 100644
--- a/tests/classes/autoload_018.phpt
+++ b/tests/classes/autoload_018.phpt
@@ -2,47 +2,46 @@
 Ensure __autoload() allows for recursive calls if the class name differs.
 --FILE--
 <?php
-  function __autoload($name)
-  {
-      echo "IN:  " . __METHOD__ . "($name)\n";
-      
-      static $i = 0;
-      if ($i++ > 10) {
-          echo "-> Recursion detected - as expected.\n";
-          return;
-      }
-      
-      class_exists('UndefinedClass' . $i);
-      
-      echo "OUT: " . __METHOD__ . "($name)\n";
+spl_autoload_register(function ($name) {
+  echo "IN:  autoload($name)\n";
+  
+  static $i = 0;
+  if ($i++ > 10) {
+      echo "-> Recursion detected - as expected.\n";
+      return;
   }
   
-  var_dump(class_exists('UndefinedClass0'));
+  class_exists('UndefinedClass' . $i);
+  
+  echo "OUT: autoload($name)\n";
+});
+
+var_dump(class_exists('UndefinedClass0'));
 ?>
 --EXPECTF--
-IN:  __autoload(UndefinedClass0)
-IN:  __autoload(UndefinedClass1)
-IN:  __autoload(UndefinedClass2)
-IN:  __autoload(UndefinedClass3)
-IN:  __autoload(UndefinedClass4)
-IN:  __autoload(UndefinedClass5)
-IN:  __autoload(UndefinedClass6)
-IN:  __autoload(UndefinedClass7)
-IN:  __autoload(UndefinedClass8)
-IN:  __autoload(UndefinedClass9)
-IN:  __autoload(UndefinedClass10)
-IN:  __autoload(UndefinedClass11)
+IN:  autoload(UndefinedClass0)
+IN:  autoload(UndefinedClass1)
+IN:  autoload(UndefinedClass2)
+IN:  autoload(UndefinedClass3)
+IN:  autoload(UndefinedClass4)
+IN:  autoload(UndefinedClass5)
+IN:  autoload(UndefinedClass6)
+IN:  autoload(UndefinedClass7)
+IN:  autoload(UndefinedClass8)
+IN:  autoload(UndefinedClass9)
+IN:  autoload(UndefinedClass10)
+IN:  autoload(UndefinedClass11)
 -> Recursion detected - as expected.
-OUT: __autoload(UndefinedClass10)
-OUT: __autoload(UndefinedClass9)
-OUT: __autoload(UndefinedClass8)
-OUT: __autoload(UndefinedClass7)
-OUT: __autoload(UndefinedClass6)
-OUT: __autoload(UndefinedClass5)
-OUT: __autoload(UndefinedClass4)
-OUT: __autoload(UndefinedClass3)
-OUT: __autoload(UndefinedClass2)
-OUT: __autoload(UndefinedClass1)
-OUT: __autoload(UndefinedClass0)
+OUT: autoload(UndefinedClass10)
+OUT: autoload(UndefinedClass9)
+OUT: autoload(UndefinedClass8)
+OUT: autoload(UndefinedClass7)
+OUT: autoload(UndefinedClass6)
+OUT: autoload(UndefinedClass5)
+OUT: autoload(UndefinedClass4)
+OUT: autoload(UndefinedClass3)
+OUT: autoload(UndefinedClass2)
+OUT: autoload(UndefinedClass1)
+OUT: autoload(UndefinedClass0)
 bool(false)
 
diff --git a/tests/classes/autoload_019.phpt b/tests/classes/autoload_019.phpt
index 7836320..b9bcd6e 100644
--- a/tests/classes/autoload_019.phpt
+++ b/tests/classes/autoload_019.phpt
@@ -2,13 +2,12 @@
 Ensure __autoload() recursion is guarded for multiple lookups of same class using difference case.
 --FILE--
 <?php
-  function __autoload($name)
-  {
-      echo __FUNCTION__ . " $name\n";
-      class_exists("undefinedCLASS");
-  }
-  
-  class_exists("unDefinedClass");
+spl_autoload_register(function ($name) {
+  echo "autoload $name\n";
+  class_exists("undefinedCLASS");
+});
+
+class_exists("unDefinedClass");
 ?>
 --EXPECTF--
-__autoload unDefinedClass
+autoload unDefinedClass
diff --git a/tests/classes/autoload_020.phpt b/tests/classes/autoload_020.phpt
index a88e561..7cecff0 100644
--- a/tests/classes/autoload_020.phpt
+++ b/tests/classes/autoload_020.phpt
@@ -2,12 +2,11 @@
 Ensure __autoload() is triggered during unserialization.
 --FILE--
 <?php
-  function __autoload($name)
-  {
-      echo "in autoload: $name\n";
-  }
-  
-  var_dump(unserialize('O:1:"C":0:{}'));
+spl_autoload_register(function ($name) {
+  echo "in autoload: $name\n";
+});
+
+var_dump(unserialize('O:1:"C":0:{}'));
 ?>
 --EXPECTF--
 in autoload: C
diff --git a/tests/classes/autoload_021.phpt b/tests/classes/autoload_021.phpt
index 3237627..f3dd8ff 100644
--- a/tests/classes/autoload_021.phpt
+++ b/tests/classes/autoload_021.phpt
@@ -2,9 +2,9 @@
 Validation of class names in the autoload process
 --FILE--
 <?php
-function __autoload($name) {
+spl_autoload_register(function ($name) {
 	echo "$name\n";
-}
+});
 $a = "../BUG";
 $x = new $a;
 echo "BUG\n";
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.