Make WordPress Core


Ignore:
Timestamp:
10/20/2023 01:27:56 PM (3 years ago)
Author:
SergeyBiryukov
Message:

External Libraries: Update getID3 to version 1.9.23.

The latest version includes numerous bug fixes, a few new features, as well as various improvements for PHP 8.1 and PHP 8.2 support.

This commit also includes PHPCS adjustments previously made for a passing PHP Compatibility scan.

References:

Follow-up to [47601], [48278], [52254], [54376].

Props jrf.
Fixes #59683.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ID3/module.tag.id3v2.php

    r54376 r56975  
    14951495                                                }
    14961496                                        }
    1497                                 } while (false);
     1497                                } while (false); // @phpstan-ignore-line
    14981498                        }
    14991499
    … …  
    37543754         */
    37553755        public static function IsANumber($numberstring, $allowdecimal=false, $allownegative=false) {
    3756                 for ($i = 0; $i < strlen($numberstring); $i++) {
    3757                         if ((chr($numberstring[$i]) < chr('0')) || (chr($numberstring[$i]) > chr('9'))) {
    3758                                 if (($numberstring[$i] == '.') && $allowdecimal) {
    3759                                         // allowed
    3760                                 } elseif (($numberstring[$i] == '-') && $allownegative && ($i == 0)) {
    3761                                         // allowed
    3762                                 } else {
    3763                                         return false;
    3764                                 }
    3765                         }
    3766                 }
    3767                 return true;
     3756                $pattern  = '#^';
     3757                $pattern .= ($allownegative ? '\\-?' : '');
     3758                $pattern .= '[0-9]+';
     3759                $pattern .= ($allowdecimal  ? '(\\.[0-9]+)?' : '');
     3760                $pattern .= '$#';
     3761                return preg_match($pattern, $numberstring);
    37683762        }
    37693763
    … …  
    37743768         */
    37753769        public static function IsValidDateStampString($datestamp) {
    3776                 if (strlen($datestamp) != 8) {
    3777                         return false;
    3778                 }
    3779                 if (!self::IsANumber($datestamp, false)) {
     3770                if (!preg_match('#^[12][0-9]{3}[01][0-9][0123][0-9]$#', $datestamp)) {
    37803771                        return false;
    37813772                }
Note: See TracChangeset for help on using the changeset viewer.