From 162aa1a5fc96b3dd7e3420c6882607b361801fbd Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 30 Jan 2017 22:28:17 +0100 Subject: [PATCH] Deprecate __autoload() --- Zend/tests/bug26697.phpt | 11 +-- Zend/tests/bug31102.phpt | 13 ++-- Zend/tests/bug33116.phpt | 5 +- Zend/tests/bug37138.phpt | 2 +- Zend/tests/bug39003.phpt | 5 +- Zend/tests/bug39542.phpt | 4 +- Zend/tests/bug42798.phpt | 4 +- Zend/tests/bug46665.phpt | 9 ++- Zend/tests/bug47714.phpt | 6 +- Zend/tests/bug49908.phpt | 12 +-- Zend/tests/bug55007.phpt | 4 +- Zend/tests/bug61011.phpt | 5 +- Zend/tests/bug62907.phpt | 4 +- Zend/tests/bug63305.phpt | 7 +- Zend/tests/bug65254.phpt | 5 +- Zend/tests/bug71163.phpt | 4 +- Zend/tests/call_user_func_002.phpt | 4 +- Zend/tests/catch.phpt | 6 +- Zend/tests/class_alias_007.phpt | 4 +- Zend/tests/instanceof.phpt | 4 +- Zend/tests/is_a.phpt | 4 +- Zend/zend_compile.c | 12 +-- ext/phar/tests/fatal_error_webphar.phpt | 1 + ext/reflection/tests/007.phpt | 7 +- ext/reflection/tests/bug26640.phpt | 5 +- ext/reflection/tests/bug29268.phpt | 4 +- ext/soap/tests/bugs/bug28751.phpt | 4 +- ext/spl/tests/class_implements_variation.phpt | 9 +-- ext/spl/tests/class_uses_variation.phpt | 9 +-- ext/spl/tests/spl_003.phpt | 9 ++- ext/standard/incomplete_class.c | 4 +- .../class_object/class_exists_basic_001.phpt | 12 +-- .../class_exists_variation_001.phpt | 20 ++--- .../class_exists_variation_002.phpt | 32 ++++---- .../get_declared_classes_variation1.phpt | 4 +- .../get_declared_interfaces_variation1.phpt | 4 +- .../get_declared_traits_variation1.phpt | 4 +- .../get_parent_class_variation_002.phpt | 12 +-- .../interface_exists_variation3.phpt | 6 +- .../interface_exists_variation4.phpt | 7 +- ext/standard/tests/class_object/is_a.phpt | 59 +++++++-------- .../is_subclass_of_variation_001.phpt | 12 +-- .../is_subclass_of_variation_002.phpt | 8 +- .../is_subclass_of_variation_004.phpt | 12 +-- .../class_object/method_exists_basic_003.phpt | 10 +-- .../method_exists_variation_001.phpt | 12 +-- .../method_exists_variation_002.phpt | 8 +- .../property_exists_variation1.phpt | 6 +- .../class_object/trait_exists_basic_001.phpt | 12 +-- .../trait_exists_variation_001.phpt | 20 ++--- .../trait_exists_variation_002.phpt | 32 ++++---- .../tests/general_functions/bug35229.phpt | 5 +- ext/standard/tests/serialize/005.phpt | 15 ++-- ext/standard/tests/serialize/bug30234.phpt | 9 +-- ext/standard/tests/serialize/bug62836_1.phpt | 4 +- ext/standard/tests/serialize/bug69152.phpt | 2 +- ext/standard/tests/serialize/bug70213.phpt | 6 +- .../tests/serialize/incomplete_class.phpt | 6 +- .../serialize/serialization_objects_005.phpt | 22 +++--- .../serialize/serialization_objects_006.phpt | 4 +- .../serialize/serialization_objects_007.phpt | 12 +-- ext/xsl/tests/bug33853.phpt | 4 +- tests/classes/autoload_001.phpt | 9 +-- tests/classes/autoload_002.phpt | 9 +-- tests/classes/autoload_003.phpt | 11 ++- tests/classes/autoload_004.phpt | 11 ++- tests/classes/autoload_005.phpt | 11 ++- tests/classes/autoload_006.phpt | 11 ++- tests/classes/autoload_007.phpt | 15 ++-- tests/classes/autoload_008.phpt | 37 +++++----- tests/classes/autoload_009.phpt | 19 +++-- tests/classes/autoload_010.phpt | 17 ++--- tests/classes/autoload_011.phpt | 17 ++--- tests/classes/autoload_012.phpt | 11 ++- tests/classes/autoload_013.phpt | 23 +++--- tests/classes/autoload_014.phpt | 23 +++--- tests/classes/autoload_015.phpt | 23 +++--- tests/classes/autoload_016.phpt | 23 +++--- tests/classes/autoload_017.phpt | 23 +++--- tests/classes/autoload_018.phpt | 73 +++++++++---------- tests/classes/autoload_019.phpt | 15 ++-- tests/classes/autoload_020.phpt | 11 ++- tests/classes/autoload_021.phpt | 4 +- 83 files changed, 465 insertions(+), 498 deletions(-) diff --git a/Zend/tests/bug26697.phpt b/Zend/tests/bug26697.phpt index 8266a23e34e..8dda17028a1 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-- - --FILE-- ===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 5de01f72826..fd6da0f7c26 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=== --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 aa714a1f85a..13aae6611ed 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-- --EXPECTF-- diff --git a/Zend/tests/bug47714.phpt b/Zend/tests/bug47714.phpt index e8ef8c330fe..546da44a86c 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 4f2b5b7cb29..6999b9e0aab 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-- --EXPECT-- diff --git a/Zend/tests/bug65254.phpt b/Zend/tests/bug65254.phpt index d2ebba4d97f..d58759bfd44 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-- 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 dd6e0961a9f..3db863470ab 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 d9204171b56..8dfc2e8bcc3 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 e375fd4f89b..8a93d722475 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-- getClass()) --FILE-- --FILE-- "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 84a52ab2dac..4d9e88622d1 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 1a13521eaf4..3424e13397d 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 e92a41ae46c..3dd9ab3482a 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-- ===DONE=== diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c index db9b25ef123..252a9cb6e19 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 4cb6cbd3278..208a895e6bd 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 5f51b4bd93d..b847c0285c2 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 954e4d8cbc5..ee6832cf3eb 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 259f5dc0f8b..3853bb62292 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 56e6161b239..12c92df7fa1 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 bedd37a3dbe..6ea3edfa79d 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 0d19e223640..97f848168d5 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 d25d74bc41a..5119945bac8 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 c0598056234..ca787396f76 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 db74cdcc9ae..99794cafb29 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 201d8789ea8..b1cb553abdc 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 9bb712b7574..85f697654d1 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 65ae8a4e231..adecd5003dd 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 32f62b7e4ba..3ac17951499 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 1947c76ac5e..b41a1a11aed 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 b1204e833d8..5c924bdc5a0 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 1505a4bafa5..18304406218 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 19616ab5c5a..6e1d45227da 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 81df711cfa1..4fd2b8d5afe 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 365efffe41b..50f2a0256ff 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 c3c273dfeef..8e8895dd592 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 2df270154dc..1702a44f516 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 9b40cc54b31..ae3a0b2f556 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-- 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 82804855160..7e6aa7b39f7 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 9800168ca2c..fd58b0323ab 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 e223f4ee12b..918e59d0aac 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 9cba9d13b51..2837e1ec466 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 bcf30f65a36..16d7f73ced3 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-- loadXML(' diff --git a/tests/classes/autoload_001.phpt b/tests/classes/autoload_001.phpt index 6b520b701af..6c09c4e04d3 100644 --- a/tests/classes/autoload_001.phpt +++ b/tests/classes/autoload_001.phpt @@ -7,17 +7,16 @@ ZE2 Autoload and class_exists --FILE-- ===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 582cb460f4c..ecb1a445124 100644 --- a/tests/classes/autoload_002.phpt +++ b/tests/classes/autoload_002.phpt @@ -7,18 +7,17 @@ ZE2 Autoload and get_class_methods --FILE-- ===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 41e877cdd9b..f79b85a9f03 100644 --- a/tests/classes/autoload_003.phpt +++ b/tests/classes/autoload_003.phpt @@ -7,18 +7,17 @@ ZE2 Autoload and derived classes --FILE-- ===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 88b10b50d70..1f754ca0303 100644 --- a/tests/classes/autoload_004.phpt +++ b/tests/classes/autoload_004.phpt @@ -7,12 +7,11 @@ ZE2 Autoload and recursion --FILE-- --EXPECTF-- bool(false) diff --git a/tests/classes/autoload_008.phpt b/tests/classes/autoload_008.phpt index 75a9cd05204..1f3f0758436 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-- --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 150f3ec2019..ebe691ca281 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-- --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 104f6888c8a..e65c2565a2e 100644 --- a/tests/classes/autoload_010.phpt +++ b/tests/classes/autoload_010.phpt @@ -2,15 +2,14 @@ Ensure implements does trigger autoload. --FILE-- --EXPECTF-- In autoload: string(6) "UndefI" diff --git a/tests/classes/autoload_011.phpt b/tests/classes/autoload_011.phpt index 86858d5f1dd..aaea38c6f0e 100644 --- a/tests/classes/autoload_011.phpt +++ b/tests/classes/autoload_011.phpt @@ -2,15 +2,14 @@ Ensure extends does trigger autoload. --FILE-- --EXPECTF-- In autoload: string(9) "UndefBase" diff --git a/tests/classes/autoload_012.phpt b/tests/classes/autoload_012.phpt index d6750b760dc..4fc41c85f5a 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-- --EXPECTF-- In autoload: string(6) "UndefC" diff --git a/tests/classes/autoload_013.phpt b/tests/classes/autoload_013.phpt index 4309cea1763..a63b1295624 100644 --- a/tests/classes/autoload_013.phpt +++ b/tests/classes/autoload_013.phpt @@ -4,18 +4,17 @@ Ensure the ReflectionClass constructor triggers autoload. --FILE-- 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 a3f04b7b572..3eb0484ec34 100644 --- a/tests/classes/autoload_014.phpt +++ b/tests/classes/autoload_014.phpt @@ -4,18 +4,17 @@ Ensure the ReflectionMethod constructor triggers autoload. --FILE-- 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 2b14a0de056..edff01c91a3 100644 --- a/tests/classes/autoload_015.phpt +++ b/tests/classes/autoload_015.phpt @@ -4,18 +4,17 @@ Ensure the ReflectionProperty constructor triggers autoload. --FILE-- 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 60263ba95a2..d1ff8857467 100644 --- a/tests/classes/autoload_016.phpt +++ b/tests/classes/autoload_016.phpt @@ -4,19 +4,18 @@ Ensure ReflectionClass::getProperty() triggers autoload --FILE-- 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 d5ce2bd0e6d..8e1aeac748b 100644 --- a/tests/classes/autoload_017.phpt +++ b/tests/classes/autoload_017.phpt @@ -4,19 +4,18 @@ Ensure ReflectionClass::implementsInterface triggers autoload. --FILE-- 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 59e20e2a608..2099499e118 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-- 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 783632013b5..b9bcd6e6d1f 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-- --EXPECTF-- -__autoload unDefinedClass +autoload unDefinedClass diff --git a/tests/classes/autoload_020.phpt b/tests/classes/autoload_020.phpt index a88e561238f..7cecff07cbb 100644 --- a/tests/classes/autoload_020.phpt +++ b/tests/classes/autoload_020.phpt @@ -2,12 +2,11 @@ Ensure __autoload() is triggered during unserialization. --FILE-- --EXPECTF-- in autoload: C diff --git a/tests/classes/autoload_021.phpt b/tests/classes/autoload_021.phpt index 32376273809..f3dd8ff26de 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--