From 7e0a63f8c5db61f3d67a75539cda28aa0bdb9e9f Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Fri, 1 May 2020 20:10:58 +0000 Subject: [PATCH] General: More PHP compatibility adjustments. In this round: - Removed references to `safe_mode` in `class-php3.php`. This was removed in PHP 5.4. - Add inline exclude comments for compatibility checks in getID3. Follow up of [47735-47736]. See #49922. git-svn-id: https://develop.svn.wordpress.org/trunk@47737 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/ID3/getid3.lib.php | 2 +- src/wp-includes/ID3/getid3.php | 8 ++++---- src/wp-includes/class-pop3.php | 6 ++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/wp-includes/ID3/getid3.lib.php b/src/wp-includes/ID3/getid3.lib.php index 7566b39da4..13c766c78d 100644 --- a/src/wp-includes/ID3/getid3.lib.php +++ b/src/wp-includes/ID3/getid3.lib.php @@ -114,7 +114,7 @@ class getid3_lib } } // if integers are 64-bit - no other check required - if ($hasINT64 || (($num <= PHP_INT_MAX) && ($num >= PHP_INT_MIN))) { + if ($hasINT64 || (($num <= PHP_INT_MAX) && ($num >= PHP_INT_MIN))) { // phpcs:ignore PHPCompatibility.Constants.NewConstants.php_int_minFound return true; } return false; diff --git a/src/wp-includes/ID3/getid3.php b/src/wp-includes/ID3/getid3.php index 4ad5df4e78..9c319bff42 100644 --- a/src/wp-includes/ID3/getid3.php +++ b/src/wp-includes/ID3/getid3.php @@ -285,15 +285,15 @@ class getID3 } // Check safe_mode off - if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_runtimeDeprecated + if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved $this->warning('WARNING: Safe mode is on, shorten support disabled, md5data/sha1data for ogg vorbis disabled, ogg vorbos/flac tag writing disabled.'); } - if (($mbstring_func_overload = (int) ini_get('mbstring.func_overload')) && ($mbstring_func_overload & 0x02)) { + if (($mbstring_func_overload = (int) ini_get('mbstring.func_overload')) && ($mbstring_func_overload & 0x02)) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated // http://php.net/manual/en/mbstring.overload.php // "mbstring.func_overload in php.ini is a positive value that represents a combination of bitmasks specifying the categories of functions to be overloaded. It should be set to 1 to overload the mail() function. 2 for string functions, 4 for regular expression functions" // getID3 cannot run when string functions are overloaded. It doesn't matter if mail() or ereg* functions are overloaded since getID3 does not use those. - $this->startup_error .= 'WARNING: php.ini contains "mbstring.func_overload = '.ini_get('mbstring.func_overload').'", getID3 cannot run with this setting (bitmask 2 (string functions) cannot be set). Recommended to disable entirely.'."\n"; + $this->startup_error .= 'WARNING: php.ini contains "mbstring.func_overload = '.ini_get('mbstring.func_overload').'", getID3 cannot run with this setting (bitmask 2 (string functions) cannot be set). Recommended to disable entirely.'."\n"; // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated } // check for magic quotes in PHP < 7.4.0 (when these functions became deprecated) @@ -1560,7 +1560,7 @@ class getID3 // page sequence numbers likely happens for OggSpeex and OggFLAC as well, but // currently vorbiscomment only works on OggVorbis files. - if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_runtimeDeprecated + if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved $this->warning('Failed making system call to vorbiscomment.exe - '.$algorithm.'_data is incorrect - error returned: PHP running in Safe Mode (backtick operator not available)'); $this->info[$algorithm.'_data'] = false; diff --git a/src/wp-includes/class-pop3.php b/src/wp-includes/class-pop3.php index 9ad185698e..3c89fe5066 100644 --- a/src/wp-includes/class-pop3.php +++ b/src/wp-includes/class-pop3.php @@ -59,8 +59,7 @@ class POP3 { if(!empty($timeout)) { settype($timeout,"integer"); $this->TIMEOUT = $timeout; - if (!ini_get('safe_mode')) - set_time_limit($timeout); + set_time_limit($timeout); } return true; } @@ -73,8 +72,7 @@ class POP3 { } function update_timer () { - if (!ini_get('safe_mode')) - set_time_limit($this->TIMEOUT); + set_time_limit($this->TIMEOUT); return true; }