summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--UPGRADING2
-rw-r--r--Zend/tests/bug26697.phpt2
-rw-r--r--Zend/tests/bug31102.phpt2
-rw-r--r--Zend/tests/bug33116.phpt2
-rw-r--r--Zend/tests/bug37138.phpt2
-rw-r--r--Zend/tests/bug39003.phpt2
-rw-r--r--Zend/tests/bug49908.phpt2
-rw-r--r--Zend/tests/bug61011.phpt2
-rw-r--r--Zend/tests/catch.phpt2
-rw-r--r--Zend/tests/errmsg_012.phpt11
-rw-r--r--Zend/tests/instanceof.phpt2
-rw-r--r--Zend/tests/is_a.phpt2
-rw-r--r--Zend/zend_compile.c11
-rw-r--r--Zend/zend_compile.h1
-rw-r--r--Zend/zend_execute_API.c12
-rw-r--r--Zend/zend_string.h1
-rw-r--r--ext/phar/tests/fatal_error_webphar.phpt2
-rw-r--r--ext/phar/tests/phar_commitwrite.phpt14
-rw-r--r--ext/phar/tests/phar_create_in_cwd.phpt14
-rw-r--r--ext/phar/tests/tar/phar_commitwrite.phpt14
-rw-r--r--ext/phar/tests/zip/phar_commitwrite.phpt14
-rw-r--r--ext/spl/php_spl.c16
22 files changed, 48 insertions, 84 deletions
diff --git a/UPGRADING b/UPGRADING
index eee50fee3e..0cd8feea5d 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -29,6 +29,8 @@ PHP 8.0 UPGRADE NOTES
longer available. The error_get_last() function may be used instead.
. Removed the ability to define case-insensitive constants. The third
argument to define() may no longer be true.
+ . Removed ability to specify an autoloader using an __autoload() function.
+ spl_autoload_register() should be used instead.
. Removed create_function(). Anonymous functions may be used instead.
. Removed each(). foreach or ArrayIterator should be used instead.
. Removed ability to unbind $this from closures that were created from a
diff --git a/Zend/tests/bug26697.phpt b/Zend/tests/bug26697.phpt
index fe269c0364..c0a4850e55 100644
--- a/Zend/tests/bug26697.phpt
+++ b/Zend/tests/bug26697.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #26697 (calling class_exists on a nonexistent class in __autoload results in segfault)
+Bug #26697 (calling class_exists on a nonexistent class in autoloader results in segfault)
--FILE--
<?php
diff --git a/Zend/tests/bug31102.phpt b/Zend/tests/bug31102.phpt
index fd6da0f7c2..624eee52ba 100644
--- a/Zend/tests/bug31102.phpt
+++ b/Zend/tests/bug31102.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #31102 (Exception not handled when thrown inside __autoload())
+Bug #31102 (Exception not handled when thrown inside autoloader)
--FILE--
<?php
diff --git a/Zend/tests/bug33116.phpt b/Zend/tests/bug33116.phpt
index 13aae6611e..b336171165 100644
--- a/Zend/tests/bug33116.phpt
+++ b/Zend/tests/bug33116.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #33116 (crash when assigning class name to global variable in __autoload)
+Bug #33116 (crash when assigning class name to global variable in autoloader)
--FILE--
<?php
spl_autoload_register(function ($class) {
diff --git a/Zend/tests/bug37138.phpt b/Zend/tests/bug37138.phpt
index 4a084d4bb1..c0aa1fdfa8 100644
--- a/Zend/tests/bug37138.phpt
+++ b/Zend/tests/bug37138.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #37138 (__autoload tries to load callback'ed self and parent)
+Bug #37138 (autoloader tries to load callback'ed self and parent)
--FILE--
<?php
spl_autoload_register(function ($CN) { var_dump ($CN); });
diff --git a/Zend/tests/bug39003.phpt b/Zend/tests/bug39003.phpt
index dc1c69e8c7..791e11b614 100644
--- a/Zend/tests/bug39003.phpt
+++ b/Zend/tests/bug39003.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #39003 (__autoload() is called for type hinting)
+Bug #39003 (autoloader is called for type hinting)
--FILE--
<?php
diff --git a/Zend/tests/bug49908.phpt b/Zend/tests/bug49908.phpt
index 2f33080258..eda913b80e 100644
--- a/Zend/tests/bug49908.phpt
+++ b/Zend/tests/bug49908.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #49908 (throwing exception in __autoload crashes when interface is not defined)
+Bug #49908 (throwing exception in autoloader crashes when interface is not defined)
--FILE--
<?php
diff --git a/Zend/tests/bug61011.phpt b/Zend/tests/bug61011.phpt
index dc0aca64f8..b9088c68f1 100644
--- a/Zend/tests/bug61011.phpt
+++ b/Zend/tests/bug61011.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #61011 (Crash when an exception is thrown by __autoload accessing a static property)
+Bug #61011 (Crash when an exception is thrown by autoloader accessing a static property)
--FILE--
<?php
spl_autoload_register(function ($name) {
diff --git a/Zend/tests/catch.phpt b/Zend/tests/catch.phpt
index a83dd75baf..2e61fef935 100644
--- a/Zend/tests/catch.phpt
+++ b/Zend/tests/catch.phpt
@@ -1,5 +1,5 @@
--TEST--
-catch shouldn't call __autoload
+catch shouldn't call autoloader
--FILE--
<?php
diff --git a/Zend/tests/errmsg_012.phpt b/Zend/tests/errmsg_012.phpt
deleted file mode 100644
index c914125af5..0000000000
--- a/Zend/tests/errmsg_012.phpt
+++ /dev/null
@@ -1,11 +0,0 @@
---TEST--
-errmsg: __autoload() must take exactly 1 argument
---FILE--
-<?php
-
-function __autoload($a, $b) {}
-
-echo "Done\n";
-?>
---EXPECTF--
-Fatal error: __autoload() must take exactly 1 argument in %s on line %d
diff --git a/Zend/tests/instanceof.phpt b/Zend/tests/instanceof.phpt
index 97d67ff567..662185dcea 100644
--- a/Zend/tests/instanceof.phpt
+++ b/Zend/tests/instanceof.phpt
@@ -1,5 +1,5 @@
--TEST--
-instanceof shouldn't call __autoload
+instanceof shouldn't call autoloader
--FILE--
<?php
spl_autoload_register(function ($name) {
diff --git a/Zend/tests/is_a.phpt b/Zend/tests/is_a.phpt
index 3714d50a62..f37c4638a8 100644
--- a/Zend/tests/is_a.phpt
+++ b/Zend/tests/is_a.phpt
@@ -1,5 +1,5 @@
--TEST--
-is_a() and is_subclass_of() shouldn't call __autoload
+is_a() and is_subclass_of() shouldn't call autoloader
--INI--
error_reporting=14335
--FILE--
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index f744b8f987..59ff42cc30 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5702,7 +5702,6 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo
static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_ast_decl *decl, zend_bool toplevel) /* {{{ */
{
- zend_ast *params_ast = decl->child[0];
zend_string *unqualified_name, *name, *lcname, *key;
zend_op *opline;
@@ -5719,13 +5718,9 @@ 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)) {
- 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");
+ if (zend_string_equals_literal(lcname, "__autoload")) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "__autoload() is no longer supported, use spl_autoload_register() instead");
}
if (zend_string_equals_literal_ci(unqualified_name, "assert")) {
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index a835110cbd..23da64abb7 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -1004,7 +1004,6 @@ END_EXTERN_C()
#define ZEND_CALL_FUNC_NAME "__call"
#define ZEND_CALLSTATIC_FUNC_NAME "__callstatic"
#define ZEND_TOSTRING_FUNC_NAME "__tostring"
-#define ZEND_AUTOLOAD_FUNC_NAME "__autoload"
#define ZEND_INVOKE_FUNC_NAME "__invoke"
#define ZEND_DEBUGINFO_FUNC_NAME "__debuginfo"
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 12799a96e1..9215717bcc 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -903,16 +903,10 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *
}
if (!EG(autoload_func)) {
- zend_function *func = zend_fetch_function(ZSTR_KNOWN(ZEND_STR_MAGIC_AUTOLOAD));
-
- if (func) {
- EG(autoload_func) = func;
- } else {
- if (!key) {
- zend_string_release_ex(lc_name, 0);
- }
- return NULL;
+ if (!key) {
+ zend_string_release_ex(lc_name, 0);
}
+ return NULL;
}
diff --git a/Zend/zend_string.h b/Zend/zend_string.h
index 4d8017245e..9704206684 100644
--- a/Zend/zend_string.h
+++ b/Zend/zend_string.h
@@ -415,7 +415,6 @@ EMPTY_SWITCH_DEFAULT_CASE()
_(ZEND_STR_THIS, "this") \
_(ZEND_STR_VALUE, "value") \
_(ZEND_STR_KEY, "key") \
- _(ZEND_STR_MAGIC_AUTOLOAD, "__autoload") \
_(ZEND_STR_MAGIC_INVOKE, "__invoke") \
_(ZEND_STR_PREVIOUS, "previous") \
_(ZEND_STR_CODE, "code") \
diff --git a/ext/phar/tests/fatal_error_webphar.phpt b/ext/phar/tests/fatal_error_webphar.phpt
index ce3e8980ad..21df0775b0 100644
--- a/ext/phar/tests/fatal_error_webphar.phpt
+++ b/ext/phar/tests/fatal_error_webphar.phpt
@@ -1,5 +1,7 @@
--TEST--
Phar web-based phar with fatal error
+--XFAIL--
+Uses no longer supported __autoload() function, new phar needed
--INI--
default_charset=UTF-8
--SKIPIF--
diff --git a/ext/phar/tests/phar_commitwrite.phpt b/ext/phar/tests/phar_commitwrite.phpt
index 8d7068f19a..56d3498d54 100644
--- a/ext/phar/tests/phar_commitwrite.phpt
+++ b/ext/phar/tests/phar_commitwrite.phpt
@@ -12,10 +12,9 @@ $p['file1.txt'] = 'hi';
$p->stopBuffering();
var_dump(strlen($p->getStub()));
$p->setStub("<?php
-function __autoload(\$class)
-{
+spl_autoload_register(function(\$class) {
include 'phar://' . str_replace('_', '/', \$class);
-}
+});
Phar::mapPhar('brandnewphar.phar');
include 'phar://brandnewphar.phar/startup.php';
__HALT_COMPILER();
@@ -28,13 +27,12 @@ var_dump($p->getStub());
unlink(dirname(__FILE__) . '/brandnewphar.phar');
__HALT_COMPILER();
?>
---EXPECT--
+--EXPECTF--
int(6641)
-string(200) "<?php
-function __autoload($class)
-{
+string(%d) "<?php
+spl_autoload_register(function($class) {
include 'phar://' . str_replace('_', '/', $class);
-}
+});
Phar::mapPhar('brandnewphar.phar');
include 'phar://brandnewphar.phar/startup.php';
__HALT_COMPILER(); ?>
diff --git a/ext/phar/tests/phar_create_in_cwd.phpt b/ext/phar/tests/phar_create_in_cwd.phpt
index 0e0903d1dd..c1ed9555ed 100644
--- a/ext/phar/tests/phar_create_in_cwd.phpt
+++ b/ext/phar/tests/phar_create_in_cwd.phpt
@@ -13,10 +13,9 @@ try {
$p['file1.txt'] = 'hi';
var_dump(strlen($p->getStub()));
$p->setStub("<?php
-function __autoload(\$class)
-{
+spl_autoload_register(function(\$class) {
include 'phar://' . str_replace('_', '/', \$class);
-}
+});
Phar::mapPhar('brandnewphar.phar');
include 'phar://brandnewphar.phar/startup.php';
__HALT_COMPILER();
@@ -31,13 +30,12 @@ __HALT_COMPILER();
<?php
unlink(dirname(__FILE__) . '/brandnewphar.phar');
?>
---EXPECT--
+--EXPECTF--
int(6641)
-string(200) "<?php
-function __autoload($class)
-{
+string(%d) "<?php
+spl_autoload_register(function($class) {
include 'phar://' . str_replace('_', '/', $class);
-}
+});
Phar::mapPhar('brandnewphar.phar');
include 'phar://brandnewphar.phar/startup.php';
__HALT_COMPILER(); ?>
diff --git a/ext/phar/tests/tar/phar_commitwrite.phpt b/ext/phar/tests/tar/phar_commitwrite.phpt
index cdfc449c1c..6d785d287f 100644
--- a/ext/phar/tests/tar/phar_commitwrite.phpt
+++ b/ext/phar/tests/tar/phar_commitwrite.phpt
@@ -12,10 +12,9 @@ $p['file1.txt'] = 'hi';
$p->stopBuffering();
var_dump($p->getStub());
$p->setStub("<?php
-function __autoload(\$class)
-{
+spl_autoload_register(function(\$class) {
include 'phar://' . str_replace('_', '/', \$class);
-}
+});
Phar::mapPhar('brandnewphar.phar');
include 'phar://brandnewphar.phar/startup.php';
__HALT_COMPILER();
@@ -28,14 +27,13 @@ var_dump($p->isFileFormat(Phar::TAR));
<?php
unlink(dirname(__FILE__) . '/brandnewphar.phar.tar');
?>
---EXPECT--
+--EXPECTF--
string(60) "<?php // tar-based phar archive stub file
__HALT_COMPILER();"
-string(200) "<?php
-function __autoload($class)
-{
+string(%d) "<?php
+spl_autoload_register(function($class) {
include 'phar://' . str_replace('_', '/', $class);
-}
+});
Phar::mapPhar('brandnewphar.phar');
include 'phar://brandnewphar.phar/startup.php';
__HALT_COMPILER(); ?>
diff --git a/ext/phar/tests/zip/phar_commitwrite.phpt b/ext/phar/tests/zip/phar_commitwrite.phpt
index cb7fa0f35c..7a7499eb28 100644
--- a/ext/phar/tests/zip/phar_commitwrite.phpt
+++ b/ext/phar/tests/zip/phar_commitwrite.phpt
@@ -12,10 +12,9 @@ $p['file1.txt'] = 'hi';
$p->stopBuffering();
var_dump($p->getStub());
$p->setStub("<?php
-function __autoload(\$class)
-{
+spl_autoload_register(function(\$class) {
include 'phar://' . str_replace('_', '/', \$class);
-}
+});
Phar::mapPhar('brandnewphar.phar');
include 'phar://brandnewphar.phar/startup.php';
__HALT_COMPILER();
@@ -28,14 +27,13 @@ var_dump($p->isFileFormat(Phar::ZIP));
<?php
unlink(dirname(__FILE__) . '/brandnewphar.phar.zip');
?>
---EXPECT--
+--EXPECTF--
string(60) "<?php // zip-based phar archive stub file
__HALT_COMPILER();"
-string(200) "<?php
-function __autoload($class)
-{
+string(%d) "<?php
+spl_autoload_register(function($class) {
include 'phar://' . str_replace('_', '/', $class);
-}
+});
Phar::mapPhar('brandnewphar.phar');
include 'phar://brandnewphar.phar/startup.php';
__HALT_COMPILER(); ?>
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index c8c45b0d9d..bc81dc3ba2 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -302,7 +302,7 @@ static int spl_autoload(zend_string *class_name, zend_string *lc_name, const cha
} /* }}} */
/* {{{ proto void spl_autoload(string class_name [, string file_extensions])
- Default implementation for __autoload() */
+ Default autoloader implementation */
PHP_FUNCTION(spl_autoload)
{
int pos_len, pos1_len;
@@ -494,7 +494,7 @@ PHP_FUNCTION(spl_autoload_call)
} while (0)
/* {{{ proto bool spl_autoload_register([mixed autoload_function [, bool throw [, bool prepend]]])
- Register given function as __autoload() implementation */
+ Register given function as autoloader */
PHP_FUNCTION(spl_autoload_register)
{
zend_string *func_name;
@@ -668,7 +668,7 @@ skip:
} /* }}} */
/* {{{ proto bool spl_autoload_unregister(mixed autoload_function)
- Unregister given function as __autoload() implementation */
+ Unregister given function as autoloader */
PHP_FUNCTION(spl_autoload_unregister)
{
zend_string *func_name = NULL;
@@ -752,7 +752,7 @@ PHP_FUNCTION(spl_autoload_unregister)
} /* }}} */
/* {{{ proto false|array spl_autoload_functions()
- Return all registered __autoload() functionns */
+ Return all registered autoloader functions */
PHP_FUNCTION(spl_autoload_functions)
{
zend_function *fptr;
@@ -763,14 +763,6 @@ PHP_FUNCTION(spl_autoload_functions)
}
if (!EG(autoload_func)) {
- if ((fptr = zend_hash_find_ptr(EG(function_table), ZSTR_KNOWN(ZEND_STR_MAGIC_AUTOLOAD)))) {
- zval tmp;
-
- array_init(return_value);
- ZVAL_STR_COPY(&tmp, ZSTR_KNOWN(ZEND_STR_MAGIC_AUTOLOAD));
- zend_hash_next_index_insert_new(Z_ARR_P(return_value), &tmp);
- return;
- }
RETURN_FALSE;
}