diff options
83 files changed, 465 insertions, 498 deletions
diff --git a/Zend/tests/bug26697.phpt b/Zend/tests/bug26697.phpt index 8266a23e34..8dda17028a 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 5de01f7282..fd6da0f7c2 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 aa714a1f85..13aae6611e 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 f8503f8da9..e39ad199a1 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 add14512c8..01761faa98 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 13ddc0a91f..2008fe140a 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 1c45867722..1141a30503 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 1f82454387..954dbfaefb 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 e8ef8c330f..546da44a86 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 4f2b5b7cb2..6999b9e0aa 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 425ce8f296..c3fb3c47f9 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 bce0e33209..1e91a55078 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 53ab17cb32..c47c34bbe7 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 4bd3a4dbeb..bd18ccbb1c 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 d2ebba4d97..d58759bfd4 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 102b1b93ec..2f6cbd5a45 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 0bf3d39376..454c6fda96 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 0ec5cf7590..a83dd75baf 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 247398e2ed..edcc096ade 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 8bcbede999..97d67ff567 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 f4161f2390..3714d50a62 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 c289fefb9e..9a904eefa8 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 dd6e0961a9..3db863470a 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 d9204171b5..8dfc2e8bcc 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 e375fd4f89..8a93d72247 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 d8efc0b06e..0ab7e332b2 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 697ebd882a..88187eb109 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 84a52ab2da..4d9e88622d 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 1a13521eaf..3424e13397 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 e92a41ae46..3dd9ab3482 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 db9b25ef12..252a9cb6e1 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 4cb6cbd327..208a895e6b 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 5f51b4bd93..b847c0285c 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 954e4d8cbc..ee6832cf3e 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 259f5dc0f8..3853bb6229 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 56e6161b23..12c92df7fa 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 bedd37a3db..6ea3edfa79 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 0d19e22364..97f848168d 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 d25d74bc41..5119945bac 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 c059805623..ca787396f7 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 db74cdcc9a..99794cafb2 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 201d8789ea..b1cb553abd 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 9bb712b757..85f697654d 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 65ae8a4e23..adecd5003d 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 32f62b7e4b..3ac1795149 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 1947c76ac5..b41a1a11ae 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 b1204e833d..5c924bdc5a 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 1505a4bafa..1830440621 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 19616ab5c5..6e1d45227d 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 81df711cfa..4fd2b8d5af 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 365efffe41..50f2a0256f 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 c3c273dfee..8e8895dd59 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 2df270154d..1702a44f51 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 9b40cc54b3..ae3a0b2f55 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 7291046410..7d03e9fd18 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 b766c0afbd..c4dbcd6926 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 c01d362be0..fd7d4001f8 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 8280485516..7e6aa7b39f 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 9800168ca2..fd58b0323a 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 e223f4ee12..918e59d0aa 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 9cba9d13b5..2837e1ec46 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 bcf30f65a3..16d7f73ced 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 6b520b701a..6c09c4e04d 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 582cb460f4..ecb1a44512 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 41e877cdd9..f79b85a9f0 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 88b10b50d7..1f754ca030 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 c5741396d5..26f4d6ae10 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 173b87db04..092e2e2252 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 5652c120cc..ba542a1450 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 75a9cd0520..1f3f075843 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 150f3ec201..ebe691ca28 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 104f6888c8..e65c2565a2 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 86858d5f1d..aaea38c6f0 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 d6750b760d..4fc41c85f5 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 4309cea176..a63b129562 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 a3f04b7b57..3eb0484ec3 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 2b14a0de05..edff01c91a 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 60263ba95a..d1ff885746 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 d5ce2bd0e6..8e1aeac748 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 59e20e2a60..2099499e11 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 783632013b..b9bcd6e6d1 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 a88e561238..7cecff07cb 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 3237627380..f3dd8ff26d 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"; |