Skip to content

Commit 0eb61bd

Browse files
Coding Standards: Move specific sniff exclusions for getID3 to the config file.
This aims to make future updates of the library easier. Follow-up to [47735], [47737], [47902]. See #63168. git-svn-id: https://develop.svn.wordpress.org/trunk@60800 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 70d0050 commit 0eb61bd

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

phpcompat.xml.dist

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,22 @@
7676
#############################################################################
7777
-->
7878

79+
<rule ref="PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved">
80+
<exclude-pattern>/ID3/getid3\.php$</exclude-pattern>
81+
</rule>
7982
<rule ref="PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated">
83+
<exclude-pattern>/ID3/getid3\.php$</exclude-pattern>
8084
<exclude-pattern>/PHPMailer/PHPMailer\.php$</exclude-pattern>
8185
</rule>
86+
<rule ref="PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_runtimeDeprecated">
87+
<exclude-pattern>/ID3/getid3\.php$</exclude-pattern>
88+
</rule>
89+
<rule ref="PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_gpcDeprecated">
90+
<exclude-pattern>/ID3/getid3\.php$</exclude-pattern>
91+
</rule>
92+
<rule ref="PHPCompatibility.Lists.AssignmentOrder.Affected">
93+
<exclude-pattern>/ID3/module.audio-video.quicktime\.php$</exclude-pattern>
94+
</rule>
8295
<rule ref="PHPCompatibility.Constants.RemovedConstants.intl_idna_variant_2003Deprecated">
8396
<exclude-pattern>/PHPMailer/PHPMailer\.php$</exclude-pattern>
8497
</rule>

src/wp-includes/ID3/getid3.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,31 +425,27 @@ public function __construct() {
425425
}
426426

427427
// Check safe_mode off
428-
if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved
428+
if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
429429
$this->warning('WARNING: Safe mode is on, shorten support disabled, md5data/sha1data for ogg vorbis disabled, ogg vorbos/flac tag writing disabled.');
430430
}
431431

432-
// phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
433432
if (($mbstring_func_overload = (int) ini_get('mbstring.func_overload')) && ($mbstring_func_overload & 0x02)) {
434433
// http://php.net/manual/en/mbstring.overload.php
435434
// "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"
436435
// 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.
437-
// phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
438436
$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";
439437
}
440438

441439
// check for magic quotes in PHP < 5.4.0 (when these options were removed and getters always return false)
442440
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
443441
// Check for magic_quotes_runtime
444442
if (function_exists('get_magic_quotes_runtime')) {
445-
// phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_runtimeDeprecated
446443
if (get_magic_quotes_runtime()) { // @phpstan-ignore-line
447444
$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";
448445
}
449446
}
450447
// Check for magic_quotes_gpc
451448
if (function_exists('get_magic_quotes_gpc')) {
452-
// phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_gpcDeprecated
453449
if (get_magic_quotes_gpc()) { // @phpstan-ignore-line
454450
$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";
455451
}
@@ -1790,7 +1786,6 @@ public function getHashdata($algorithm) {
17901786
// page sequence numbers likely happens for OggSpeex and OggFLAC as well, but
17911787
// currently vorbiscomment only works on OggVorbis files.
17921788

1793-
// phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved
17941789
if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
17951790

17961791
$this->warning('Failed making system call to vorbiscomment.exe - '.$algorithm.'_data is incorrect - error returned: PHP running in Safe Mode (backtick operator not available)');

src/wp-includes/ID3/module.audio-video.quicktime.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ public function Analyze() {
144144
foreach ($info['quicktime']['comments']['location.ISO6709'] as $ISO6709string) {
145145
$ISO6709parsed = array('latitude'=>false, 'longitude'=>false, 'altitude'=>false);
146146
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)) {
147-
// phpcs:ignore PHPCompatibility.Lists.AssignmentOrder.Affected
148147
@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;
149148

150149
if (strlen($lat_deg) == 2) { // [+-]DD.D

0 commit comments

Comments
 (0)