WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/01/2020 07:05:04 PM (7 months ago)
Author:
desrosj
Message:

General: Fix various issues flagged by the PHPCompatibilityWP PHPCS ruleset.

As part of the continued effort to improve PHP compatibility, the following improvments are being made:

  • Removing deprecated PHP safe_mode checks not found in bundled external libraries.
  • Change the remaining while loops using each() to foreach loops.
  • Prevent false positives from being flagged for the sodium_compat library being caused by loading this in a non-standard way.
  • Add inline comments to not flag deprecated PHP directives in the getID3 library.

Props desrosj, earnjam, dryanpress.
See #49922.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ID3/getid3.php

    r47604 r47735  
    286286
    287287        // Check safe_mode off
    288         if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
     288        if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { // phpcs:ignore  // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_runtimeDeprecated
    289289            $this->warning('WARNING: Safe mode is on, shorten support disabled, md5data/sha1data for ogg vorbis disabled, ogg vorbos/flac tag writing disabled.');
    290290        }
     
    301301            // Check for magic_quotes_runtime
    302302            if (function_exists('get_magic_quotes_runtime')) {
    303                 if (get_magic_quotes_runtime()) {
     303                if (get_magic_quotes_runtime()) { // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_runtimeDeprecated
    304304                    $this->startup_error .= 'magic_quotes_runtime must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_runtime(0) and set_magic_quotes_runtime(1).'."\n";
    305305                }
     
    307307            // Check for magic_quotes_gpc
    308308            if (function_exists('get_magic_quotes_gpc')) {
    309                 if (get_magic_quotes_gpc()) {
     309                if (get_magic_quotes_gpc()) { // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_gpcDeprecated
    310310                    $this->startup_error .= 'magic_quotes_gpc must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_gpc(0) and set_magic_quotes_gpc(1).'."\n";
    311311                }
     
    15611561            // currently vorbiscomment only works on OggVorbis files.
    15621562
    1563             if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
     1563            if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { // phpcs:ignore  // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_runtimeDeprecated
    15641564
    15651565                $this->warning('Failed making system call to vorbiscomment.exe - '.$algorithm.'_data is incorrect - error returned: PHP running in Safe Mode (backtick operator not available)');
Note: See TracChangeset for help on using the changeset viewer.