Make WordPress Core


Ignore:
Timestamp:
10/20/2023 01:27:56 PM (20 months 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/getid3.lib.php

    r54376 r56975  
    122122        }
    123123        // if integers are 64-bit - no other check required
    124         if ($hasINT64 || (($num <= PHP_INT_MAX) && ($num >= PHP_INT_MIN))) { // phpcs:ignore PHPCompatibility.Constants.NewConstants.php_int_minFound
     124        if ($hasINT64 || (($num <= PHP_INT_MAX) && ($num >= PHP_INT_MIN))) {
    125125            return true;
    126126        }
    127127        return false;
     128    }
     129
     130    /**
     131     * Perform a division, guarding against division by zero
     132     *
     133     * @param float|int $numerator
     134     * @param float|int $denominator
     135     * @param float|int $fallback
     136     * @return float|int
     137     */
     138    public static function SafeDiv($numerator, $denominator, $fallback = 0) {
     139        return $denominator ? $numerator / $denominator : $fallback;
    128140    }
    129141
     
    135147    public static function DecimalizeFraction($fraction) {
    136148        list($numerator, $denominator) = explode('/', $fraction);
    137         return $numerator / ($denominator ? $denominator : 1);
     149        return (int) $numerator / ($denominator ? $denominator : 1);
    138150    }
    139151
     
    872884     */
    873885    public static function iconv_fallback_iso88591_utf8($string, $bom=false) {
    874         if (function_exists('utf8_encode')) {
    875             return utf8_encode($string);
    876         }
    877         // utf8_encode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support)
    878886        $newcharstring = '';
    879887        if ($bom) {
     
    944952     */
    945953    public static function iconv_fallback_utf8_iso88591($string) {
    946         if (function_exists('utf8_decode')) {
    947             return utf8_decode($string);
    948         }
    949         // utf8_decode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support)
    950954        $newcharstring = '';
    951955        $offset = 0;
Note: See TracChangeset for help on using the changeset viewer.