Code Modernisation: Remove the SPL autoloader polyfill.
As of PHP 5.3, the SPL extension cannot be disabled, so we no longer need this polyfill. The file is kept with a `_deprecated_file()` call, to alert any plugins or themes that may be loading it directly. Props jrf, ayeshrajans. See #47698, #46630. Built from https://develop.svn.wordpress.org/trunk@45637 git-svn-id: http://core.svn.wordpress.org/trunk@45448 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
501b5f545b
commit
21df1bda5b
|
@ -449,16 +449,6 @@ if ( ! function_exists( 'sodium_crypto_box' ) ) {
|
||||||
require ABSPATH . WPINC . '/sodium_compat/autoload.php';
|
require ABSPATH . WPINC . '/sodium_compat/autoload.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Polyfill for the SPL autoloader. In PHP 5.2 (but not 5.3 and later), SPL can
|
|
||||||
* be disabled, and PHP 7.2 raises notices if the compiler finds an __autoload()
|
|
||||||
* function declaration. Function availability is checked here, and the
|
|
||||||
* autoloader is included only if necessary.
|
|
||||||
*/
|
|
||||||
if ( ! function_exists( 'spl_autoload_register' ) ) {
|
|
||||||
require_once ABSPATH . WPINC . '/spl-autoload-compat.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! function_exists( 'is_countable' ) ) {
|
if ( ! function_exists( 'is_countable' ) ) {
|
||||||
/**
|
/**
|
||||||
* Polyfill for is_countable() function added in PHP 7.3.
|
* Polyfill for is_countable() function added in PHP 7.3.
|
||||||
|
|
|
@ -5,96 +5,10 @@
|
||||||
*
|
*
|
||||||
* See https://core.trac.wordpress.org/ticket/41134
|
* See https://core.trac.wordpress.org/ticket/41134
|
||||||
*
|
*
|
||||||
|
* @deprecated 5.3.0 No longer needed as the minimum PHP requirement has moved beyond PHP 5.3.
|
||||||
|
*
|
||||||
* @package PHP
|
* @package PHP
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! function_exists( 'spl_autoload_register' ) ) {
|
_deprecated_file( basename( __FILE__ ), '5.3.0', null, 'SPL can no longer be disabled as of PHP 5.3.' );
|
||||||
$_wp_spl_autoloaders = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Autoloader compatibility callback.
|
|
||||||
*
|
|
||||||
* @since 4.6.0
|
|
||||||
*
|
|
||||||
* @param string $classname Class to attempt autoloading.
|
|
||||||
*/
|
|
||||||
function __autoload( $classname ) {
|
|
||||||
global $_wp_spl_autoloaders;
|
|
||||||
foreach ( $_wp_spl_autoloaders as $autoloader ) {
|
|
||||||
if ( ! is_callable( $autoloader ) ) {
|
|
||||||
// Avoid the extra warning if the autoloader isn't callable.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
call_user_func( $autoloader, $classname );
|
|
||||||
|
|
||||||
// If it has been autoloaded, stop processing.
|
|
||||||
if ( class_exists( $classname, false ) ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers a function to be autoloaded.
|
|
||||||
*
|
|
||||||
* @since 4.6.0
|
|
||||||
*
|
|
||||||
* @param callable $autoload_function The function to register.
|
|
||||||
* @param bool $throw Optional. Whether the function should throw an exception
|
|
||||||
* if the function isn't callable. Default true.
|
|
||||||
* @param bool $prepend Whether the function should be prepended to the stack.
|
|
||||||
* Default false.
|
|
||||||
*/
|
|
||||||
function spl_autoload_register( $autoload_function, $throw = true, $prepend = false ) {
|
|
||||||
if ( $throw && ! is_callable( $autoload_function ) ) {
|
|
||||||
// String not translated to match PHP core.
|
|
||||||
throw new Exception( 'Function not callable' );
|
|
||||||
}
|
|
||||||
|
|
||||||
global $_wp_spl_autoloaders;
|
|
||||||
|
|
||||||
// Don't allow multiple registration.
|
|
||||||
if ( in_array( $autoload_function, $_wp_spl_autoloaders ) ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $prepend ) {
|
|
||||||
array_unshift( $_wp_spl_autoloaders, $autoload_function );
|
|
||||||
} else {
|
|
||||||
$_wp_spl_autoloaders[] = $autoload_function;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unregisters an autoloader function.
|
|
||||||
*
|
|
||||||
* @since 4.6.0
|
|
||||||
*
|
|
||||||
* @param callable $function The function to unregister.
|
|
||||||
* @return bool True if the function was unregistered, false if it could not be.
|
|
||||||
*/
|
|
||||||
function spl_autoload_unregister( $function ) {
|
|
||||||
global $_wp_spl_autoloaders;
|
|
||||||
foreach ( $_wp_spl_autoloaders as &$autoloader ) {
|
|
||||||
if ( $autoloader === $function ) {
|
|
||||||
unset( $autoloader );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the registered autoloader functions.
|
|
||||||
*
|
|
||||||
* @since 4.6.0
|
|
||||||
*
|
|
||||||
* @return array List of autoloader functions.
|
|
||||||
*/
|
|
||||||
function spl_autoload_functions() {
|
|
||||||
return $GLOBALS['_wp_spl_autoloaders'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.3-alpha-45636';
|
$wp_version = '5.3-alpha-45637';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue