Make WordPress Core

Ticket #49922: 49922.4.diff

File 49922.4.diff, 8.7 KB (added by desrosj, 5 years ago)
  • phpcompat.xml.dist

    diff --git a/phpcompat.xml.dist b/phpcompat.xml.dist
    index 3ff7f8b302..5af8e2a503 100644
    a b  
    7474        </rule>
    7575
    7676        <!-- Whitelist the WP DB Class for use of `mysql_` extension in PHP < 7.0. -->
    77         <rule ref="PHPCompatibility.Extensions.RemovedExtensions">
     77        <rule ref="PHPCompatibility.Extensions.RemovedExtensions.mysql_DeprecatedRemoved">
    7878                <exclude-pattern>/src/wp-includes/wp-db\.php</exclude-pattern>
    7979        </rule>
    8080</ruleset>
  • src/wp-admin/includes/class-ftp.php

    diff --git a/src/wp-admin/includes/class-ftp.php b/src/wp-admin/includes/class-ftp.php
    index 8e2624cedc..cb8a033631 100644
    a b function PopError(){ 
    899899$mod_sockets = extension_loaded( 'sockets' );
    900900if ( ! $mod_sockets && function_exists( 'dl' ) && is_callable( 'dl' ) ) {
    901901        $prefix = ( PHP_SHLIB_SUFFIX == 'dll' ) ? 'php_' : '';
    902         @dl( $prefix . 'sockets.' . PHP_SHLIB_SUFFIX );
     902        @dl( $prefix . 'sockets.' . PHP_SHLIB_SUFFIX ); // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.dlDeprecated
    903903        $mod_sockets = extension_loaded( 'sockets' );
    904904}
    905905
  • src/wp-includes/ID3/module.audio-video.quicktime.php

    diff --git a/src/wp-includes/ID3/module.audio-video.quicktime.php b/src/wp-includes/ID3/module.audio-video.quicktime.php
    index cfe8ff5a8c..3c66199b1b 100644
    a b public function Analyze() { 
    114114                        foreach ($info['quicktime']['comments']['location.ISO6709'] as $ISO6709string) {
    115115                                $ISO6709parsed = array('latitude'=>false, 'longitude'=>false, 'altitude'=>false);
    116116                                if (preg_match('#^([\\+\\-])([0-9]{2}|[0-9]{4}|[0-9]{6})(\\.[0-9]+)?([\\+\\-])([0-9]{3}|[0-9]{5}|[0-9]{7})(\\.[0-9]+)?(([\\+\\-])([0-9]{3}|[0-9]{5}|[0-9]{7})(\\.[0-9]+)?)?/$#', $ISO6709string, $matches)) {
    117                                         @list($dummy, $lat_sign, $lat_deg, $lat_deg_dec, $lon_sign, $lon_deg, $lon_deg_dec, $dummy, $alt_sign, $alt_deg, $alt_deg_dec) = $matches;
     117                                        @list($dummy, $lat_sign, $lat_deg, $lat_deg_dec, $lon_sign, $lon_deg, $lon_deg_dec, $dummy, $alt_sign, $alt_deg, $alt_deg_dec) = $matches; // phpcs:ignore PHPCompatibility.Lists.AssignmentOrder.Affected
    118118
    119119                                        if (strlen($lat_deg) == 2) {        // [+-]DD.D
    120120                                                $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim($lat_deg, '0').$lat_deg_dec);
  • src/wp-includes/capabilities.php

    diff --git a/src/wp-includes/capabilities.php b/src/wp-includes/capabilities.php
    index 24b0aa9e0a..e3c28a1cf1 100644
    a b function map_meta_cap( $cap, $user_id, ...$args ) { 
    290290                case 'edit_user_meta':
    291291                case 'delete_user_meta':
    292292                case 'add_user_meta':
    293                         list( $_, $object_type, $_ ) = explode( '_', $cap );
    294                         $object_id                   = (int) $args[0];
     293                        $object_type = explode( '_', $cap )[1];
     294                        $object_id   = (int) $args[0];
    295295
    296296                        $object_subtype = get_object_subtype( $object_type, $object_id );
    297297
  • src/wp-includes/class-requests.php

    diff --git a/src/wp-includes/class-requests.php b/src/wp-includes/class-requests.php
    index e9773800cb..34f7b6121b 100644
    a b protected static function get_transport($capabilities = array()) { 
    187187
    188188                // Don't search for a transport if it's already been done for these $capabilities
    189189                if (isset(self::$transport[$cap_string]) && self::$transport[$cap_string] !== null) {
    190                         return new self::$transport[$cap_string]();
     190                        $class = self::$transport[$cap_string];
     191                        return new $class();
    191192                }
    192193                // @codeCoverageIgnoreEnd
    193194
    protected static function get_transport($capabilities = array()) { 
    214215                        throw new Requests_Exception('No working transports found', 'notransport', self::$transports);
    215216                }
    216217
    217                 return new self::$transport[$cap_string]();
     218                $class = self::$transport[$cap_string];
     219                return new $class();
    218220        }
    219221
    220222        /**#@+
  • src/wp-includes/class-simplepie.php

    diff --git a/src/wp-includes/class-simplepie.php b/src/wp-includes/class-simplepie.php
    index 651bf60e3c..6bb5bf75fc 100644
    a b public function __call($method, $args) 
    31653165                }
    31663166
    31673167                $class = get_class($this);
    3168                 $trace = debug_backtrace();
     3168                $trace = debug_backtrace(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
    31693169                $file = $trace[0]['file'];
    31703170                $line = $trace[0]['line'];
    31713171                trigger_error("Call to undefined method $class::$method() in $file on line $line", E_USER_ERROR);
  • src/wp-includes/cron.php

    diff --git a/src/wp-includes/cron.php b/src/wp-includes/cron.php
    index 7337ba307e..6f50cc7f95 100644
    a b function wp_clear_scheduled_hook( $hook, $args = array() ) { 
    402402        // Previously, this function took the arguments as discrete vars rather than an array like the rest of the API.
    403403        if ( ! is_array( $args ) ) {
    404404                _deprecated_argument( __FUNCTION__, '3.0.0', __( 'This argument has changed to an array to match the behavior of the other cron functions.' ) );
    405                 $args = array_slice( func_get_args(), 1 );
     405                $args = array_slice( func_get_args(), 1 ); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
    406406        }
    407407
    408408        /**
  • src/wp-includes/functions.php

    diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
    index c319965fb9..35c1e2e2f3 100644
    a b function mbstring_binary_safe_encoding( $reset = false ) { 
    66276627        static $overloaded = null;
    66286628
    66296629        if ( is_null( $overloaded ) ) {
    6630                 $overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 );
     6630                $overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 ); // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
    66316631        }
    66326632
    66336633        if ( false === $overloaded ) {
  • src/wp-includes/plugin.php

    diff --git a/src/wp-includes/plugin.php b/src/wp-includes/plugin.php
    index dc4ec0deb1..2a97c9eba5 100644
    a b function apply_filters_ref_array( $tag, $args ) { 
    231231        // Do 'all' actions first.
    232232        if ( isset( $wp_filter['all'] ) ) {
    233233                $wp_current_filter[] = $tag;
    234                 $all_args            = func_get_args();
     234                $all_args            = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
    235235                _wp_call_all_hook( $all_args );
    236236        }
    237237
    function do_action( $tag, ...$arg ) { 
    453453        // Do 'all' actions first.
    454454        if ( isset( $wp_filter['all'] ) ) {
    455455                $wp_current_filter[] = $tag;
    456                 $all_args            = func_get_args();
     456                $all_args            = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
    457457                _wp_call_all_hook( $all_args );
    458458        }
    459459
    function do_action_ref_array( $tag, $args ) { 
    526526        // Do 'all' actions first.
    527527        if ( isset( $wp_filter['all'] ) ) {
    528528                $wp_current_filter[] = $tag;
    529                 $all_args            = func_get_args();
     529                $all_args            = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
    530530                _wp_call_all_hook( $all_args );
    531531        }
    532532
  • src/wp-includes/pomo/streams.php

    diff --git a/src/wp-includes/pomo/streams.php b/src/wp-includes/pomo/streams.php
    index 8d8a2edcc7..52228d9120 100644
    a b class POMO_Reader { 
    1818                 * PHP5 constructor.
    1919                 */
    2020                function __construct() {
    21                         $this->is_overloaded = ( ( ini_get( 'mbstring.func_overload' ) & 2 ) != 0 ) && function_exists( 'mb_substr' );
     21                        $this->is_overloaded = ( ( ini_get( 'mbstring.func_overload' ) & 2 ) != 0 ) && function_exists( 'mb_substr' ); // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
    2222                        $this->_pos          = 0;
    2323                }
    2424
  • src/wp-includes/rss.php

    diff --git a/src/wp-includes/rss.php b/src/wp-includes/rss.php
    index 208ca72004..ffc2494789 100644
    a b function map_attrs($k, $v) { 
    385385        }
    386386
    387387        function error( $errormsg, $lvl = E_USER_WARNING ) {
    388                 // append PHP's error message if track_errors enabled
    389                 if ( isset($php_errormsg) ) {
    390                         $errormsg .= " ($php_errormsg)";
    391                 }
    392388                if ( MAGPIE_DEBUG ) {
    393389                        trigger_error( $errormsg, $lvl);
    394390                } else {
    function file_name ($url) { 
    821817        Purpose:        register error
    822818\*=======================================================================*/
    823819        function error ($errormsg, $lvl=E_USER_WARNING) {
    824                 // append PHP's error message if track_errors enabled
    825                 if ( isset($php_errormsg) ) {
    826                         $errormsg .= " ($php_errormsg)";
    827                 }
    828820                $this->ERROR = $errormsg;
    829821                if ( MAGPIE_DEBUG ) {
    830822                        trigger_error( $errormsg, $lvl);