Make WordPress Core

Changeset 56975

Timestamp:
10/20/2023 01:27:56 PM (9 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.

Location:
trunk/src/wp-includes/ID3
Files:
1 deleted
13 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
     132
     133
     134
     135
     136
     137
     138
     139
    128140    }
    129141
     
    135147    public static function DecimalizeFraction($fraction) {
    136148        list($numerator, $denominator) = explode('/', $fraction);
    137         return $numerator / ($denominator ? $denominator : 1);
     149        return $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;
  • trunk/src/wp-includes/ID3/getid3.php

    r54376 r56975  
    388388    protected $startup_warning = '';
    389389
    390     const VERSION           = '1.9.22-202207161647';
     390    const VERSION           = '1.9.2';
    391391    const FREAD_BUFFER_SIZE = 32768;
    392392
     
    439439        }
    440440
    441         // check for magic quotes in PHP < 7.4.0 (when these functions became deprecated)
    442         if (version_compare(PHP_VERSION, '7.4.0', '<')) {
     441        // check for magic quotes in PHP < )
     442        if (version_compare(PHP_VERSION, '.4.0', '<')) {
    443443            // Check for magic_quotes_runtime
    444444            if (function_exists('get_magic_quotes_runtime')) {
    445445                // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_runtimeDeprecated
    446                 if (get_magic_quotes_runtime()) {
     446                if (get_magic_quotes_runtime()) {
    447447                    $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";
    448448                }
     
    451451            if (function_exists('get_magic_quotes_gpc')) {
    452452                // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.get_magic_quotes_gpcDeprecated
    453                 if (get_magic_quotes_gpc()) {
     453                if (get_magic_quotes_gpc()) {
    454454                    $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";
    455455                }
     
    14651465                            'module'    => 'xz',
    14661466                            'mime_type' => 'application/x-xz',
     1467
     1468
     1469
     1470
     1471
     1472
     1473
     1474
     1475
     1476
    14671477                            'fail_id3'  => 'ERROR',
    14681478                            'fail_ape'  => 'ERROR',
     
    19831993        $BitrateUncompressed = $this->info['video']['resolution_x'] * $this->info['video']['resolution_y'] * $this->info['video']['bits_per_sample'] * $FrameRate;
    19841994
    1985         $this->info['video']['compression_ratio'] = $BitrateCompressed / $BitrateUncompressed;
     1995        $this->info['video']['compression_ratio'] = ;
    19861996        return true;
    19871997    }
     
    21892199
    21902200    /**
     2201
     2202
    21912203     * @return int|bool
    21922204     */
     
    22002212    /**
    22012213     * @param int $bytes
     2214
     2215
    22022216     *
    22032217     * @return string|false
     
    22462260     * @param int $whence
    22472261     *
     2262
     2263
    22482264     * @return int
    22492265     *
     
    22872303
    22882304    /**
     2305
     2306
    22892307     * @return string|false
    22902308     *
     
    23422360
    23432361    /**
     2362
     2363
    23442364     * @return bool
    23452365     */
  • trunk/src/wp-includes/ID3/license.txt

    r46587 r56975  
    2121Mozilla MPL: https://www.mozilla.org/MPL/2.0/                (v2)
    2222
    23 getID3 Commercial License: https://www.getid3.org/#gCL (payment required)
     23getID3 Commercial License: https://www.getid3.org/#gCL
     24(no longer available, existing licenses remain valid)
    2425
    2526*****************************************************************
  • trunk/src/wp-includes/ID3/module.audio-video.asf.php

    r54376 r56975  
    194194
    195195                        //$info['bitrate'] = $thisfile_asf_filepropertiesobject['max_bitrate'];
    196                         $info['bitrate'] = ((isset($thisfile_asf_filepropertiesobject['filesize']) ? $thisfile_asf_filepropertiesobject['filesize'] : $info['filesize']) * 8) / $info['playtime_seconds'];
     196                        $info['bitrate'] = ;
    197197                    }
    198198                    break;
     
    10671067                        }
    10681068
    1069                         if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
     1069                        if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
    10701070                            foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) {
    10711071                                if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) {
     
    11531153                        $thisfile_asf_videomedia_currentstream['format_data']['codec_data']       = substr($streamdata['type_specific_data'], $videomediaoffset);
    11541154
    1155                         if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
     1155                        if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
    11561156                            foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) {
    11571157                                if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) {
  • trunk/src/wp-includes/ID3/module.audio-video.matroska.php

    r52254 r56975  
    293293                        $track_info['display_y']    = (isset($trackarray['DisplayHeight']) ? $trackarray['DisplayHeight'] : $trackarray['PixelHeight']);
    294294
    295                         if (isset($trackarray['PixelCropBottom'])) { $track_info['crop_bottom'] = $trackarray['PixelCropBottom']; }
    296                         if (isset($trackarray['PixelCropTop']))    { $track_info['crop_top']    = $trackarray['PixelCropTop']; }
    297                         if (isset($trackarray['PixelCropLeft']))   { $track_info['crop_left']   = $trackarray['PixelCropLeft']; }
    298                         if (isset($trackarray['PixelCropRight']))  { $track_info['crop_right']  = $trackarray['PixelCropRight']; }
    299                         if (isset($trackarray['DefaultDuration'])) { $track_info['frame_rate']  = round(1000000000 / $trackarray['DefaultDuration'], 3); }
    300                         if (isset($trackarray['CodecName']))       { $track_info['codec']       = $trackarray['CodecName']; }
     295                        if (isset($trackarray['PixelCropBottom'])) { $track_info['crop_bottom'] = $trackarray['PixelCropBottom']; }
     296                        if (isset($trackarray['PixelCropTop']))    { $track_info['crop_top']    = $trackarray['PixelCropTop']; }
     297                        if (isset($trackarray['PixelCropLeft']))   { $track_info['crop_left']   = $trackarray['PixelCropLeft']; }
     298                        if (isset($trackarray['PixelCropRight']))  { $track_info['crop_right']  = $trackarray['PixelCropRight']; }
     299                        if (($trackarray['DefaultDuration'])) { $track_info['frame_rate']  = round(1000000000 / $trackarray['DefaultDuration'], 3); }
     300                        if (isset($trackarray['CodecName']))       { $track_info['codec']       = $trackarray['CodecName']; }
    301301
    302302                        switch ($trackarray['CodecID']) {
  • trunk/src/wp-includes/ID3/module.audio-video.quicktime.php

    r54376 r56975  
    153153                        $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0').$lat_deg_dec / 60);
    154154                    } elseif (strlen($lat_deg) == 6) {  // [+-]DDMMSS.S
    155                         $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lat_deg, 4, 2), '0').$lat_deg_dec / 3600);
     155                        $ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lat_deg, 4, 2), '0').$lat_deg_dec / 3600);
    156156                    }
    157157
     
    161161                        $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0').$lon_deg_dec / 60);
    162162                    } elseif (strlen($lon_deg) == 7) {  // [+-]DDDMMSS.S
    163                         $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lon_deg, 4, 2), '0').$lon_deg_dec / 3600);
     163                        $ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lon_deg, 4, 2), '0').$lon_deg_dec / 3600);
    164164                    }
    165165
     
    169169                        $ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval(ltrim(substr($alt_deg, 2, 2), '0').$alt_deg_dec / 60);
    170170                    } elseif (strlen($alt_deg) == 7) {  // [+-]DDDMMSS.S
    171                         $ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval(ltrim(substr($alt_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($alt_deg, 4, 2), '0').$alt_deg_dec / 3600);
     171                        $ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval(ltrim(substr($alt_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($alt_deg, 4, 2), '0').$alt_deg_dec / 3600);
    172172                    }
    173173
     
    333333                        } elseif (isset($value_array['time_to_sample_table'])) {
    334334                            foreach ($value_array['time_to_sample_table'] as $key2 => $value_array2) {
    335                                 if (isset($value_array2['sample_count']) && isset($value_array2['sample_duration']) && ($value_array2['sample_duration'] > 0)) {
     335                                if (isset($value_array2['sample_count']) && isset($value_array2['sample_duration']) && ($value_array2['sample_duration'] > 0)) {
    336336                                    $framerate  = round($info['quicktime']['time_scale'] / $value_array2['sample_duration'], 3);
    337337                                    $framecount = $value_array2['sample_count'];
     
    777777
    778778                case 'stsd': // Sample Table Sample Description atom
    779                     $atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
    780                     $atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
     779                    $atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
     780                    $atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
    781781                    $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
    782782
     
    806806                        $atom_structure['sample_description_table'][$i]['data']             =                           substr($atom_data, $stsdEntriesDataOffset, ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2));
    807807                        $stsdEntriesDataOffset += ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2);
    808 
    809808                        if (substr($atom_structure['sample_description_table'][$i]['data'],  1, 54) == 'application/octet-stream;type=com.parrot.videometadata') {
    810809                            // special handling for apparently-malformed (TextMetaDataSampleEntry?) data for some version of Parrot drones
     
    894893
    895894                                    case 'mp4a':
    896                                     default:
     895                                        $atom_structure['sample_description_table'][$i]['subatoms'] = $this->QuicktimeParseContainerAtom(substr($atom_structure['sample_description_table'][$i]['data'], 20), $baseoffset + $stsdEntriesDataOffset - 20 - 16, $atomHierarchy, $ParseAllPossibleAtoms);
     896
    897897                                        $info['quicktime']['audio']['codec']       = $this->QuicktimeAudioCodecLookup($atom_structure['sample_description_table'][$i]['data_format']);
    898898                                        $info['quicktime']['audio']['sample_rate'] = $atom_structure['sample_description_table'][$i]['audio_sample_rate'];
     
    919919                                                break;
    920920                                        }
     921
     922
     923
    921924                                        break;
    922925                                }
     
    16671670                        $atom_structure['data'] = $atom_data;
    16681671                        $atom_structure['image_mime'] = 'image/jpeg';
    1669                         $atom_structure['description'] = isset($descriptions[$atomname]) ? $descriptions[$atomname] : 'Nikon preview image';
     1672                        $atom_structure['description'] = ;
    16701673                        $info['quicktime']['comments']['picture'][] = array(
    16711674                            'image_mime' => $atom_structure['image_mime'],
     
    16841687                    $makerNoteVersion = '';
    16851688                    for ($i = 0, $iMax = strlen($atom_data); $i < $iMax; ++$i) {
    1686                         if (ord($atom_data[$i]) >= 0x00 && ord($atom_data[$i]) <= 0x1F) {
     1689                        if (ord($atom_data[$i]) <= 0x1F) {
    16871690                            $makerNoteVersion .= ' '.ord($atom_data[$i]);
    16881691                        } else {
     
    21012104                    break;
    21022105
     2106
     2107
     2108
     2109
     2110
     2111
     2112
     2113
     2114
     2115
     2116
     2117
     2118
     2119
     2120
     2121
     2122
     2123
     2124
     2125
     2126
     2127
     2128
     2129
     2130
     2131
     2132
     2133
     2134
     2135
     2136
     2137
     2138
     2139
     2140
     2141
     2142
     2143
     2144
     2145
     2146
     2147
     2148
     2149
     2150
     2151
     2152
     2153
     2154
     2155
     2156
     2157
     2158
     2159
     2160
     2161
     2162
     2163
     2164
     2165
     2166
     2167
     2168
     2169
     2170
     2171
     2172
     2173
     2174
     2175
     2176
     2177
     2178
     2179
     2180
     2181
     2182
     2183
     2184
     2185
     2186
     2187
     2188
     2189
     2190
     2191
     2192
     2193
     2194
     2195
     2196
    21032197
    21042198// AVIF-related - https://docs.rs/avif-parse/0.13.2/src/avif_parse/boxes.rs.html
     
    29923086    }
    29933087
     3088
    29943089    /**
    29953090     * @param array $info
  • trunk/src/wp-includes/ID3/module.audio-video.riff.php

    r54376 r56975  
    215215
    216216                    if (empty($info['playtime_seconds'])) { // may already be set (e.g. DTS-WAV)
    217                         $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $thisfile_audio['bitrate']);
     217                        $info['playtime_seconds'] = $thisfile_audio['bitrate']);
    218218                    }
    219219
     
    441441                        if (isset($parsedXML['SPEED']['MASTER_SPEED'])) {
    442442                            @list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['MASTER_SPEED']);
    443                             $thisfile_riff_WAVE['iXML'][0]['master_speed'] = $numerator / ($denominator ? $denominator : 1000);
     443                            $thisfile_riff_WAVE['iXML'][0]['master_speed'] = $numerator / ($denominator ? $denominator : 1000);
    444444                        }
    445445                        if (isset($parsedXML['SPEED']['TIMECODE_RATE'])) {
    446446                            @list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['TIMECODE_RATE']);
    447                             $thisfile_riff_WAVE['iXML'][0]['timecode_rate'] = $numerator / ($denominator ? $denominator : 1000);
     447                            $thisfile_riff_WAVE['iXML'][0]['timecode_rate'] = $numerator / ($denominator ? $denominator : 1000);
    448448                        }
    449449                        if (isset($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO']) && !empty($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) && !empty($thisfile_riff_WAVE['iXML'][0]['timecode_rate'])) {
     
    522522                if (!isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) {
    523523                    $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate'];
    524                     $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $thisfile_audio['bitrate']);
     524                    $info['playtime_seconds'] = (float) $thisfile_audio['bitrate']);
    525525                }
    526526
     
    532532                    // Reset to the way it was - RIFF parsing will have messed this up
    533533                    $info['avdataend']        = $Original['avdataend'];
    534                     $thisfile_audio['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
     534                    $thisfile_audio['bitrate'] = ;
    535535
    536536                    $this->fseek($info['avdataoffset'] - 44);
     
    633633                }
    634634                if ($info['avdataend'] > $info['filesize']) {
    635                     switch (!empty($thisfile_audio_dataformat) ? $thisfile_audio_dataformat : '') {
     635                    switch () {
    636636                        case 'wavpack': // WavPack
    637637                        case 'lpac':    // LPAC
     
    673673                    }
    674674                }
    675                 if (isset($thisfile_audio_dataformat) && ($thisfile_audio_dataformat == 'ac3')) {
     675                if () {
    676676                    unset($thisfile_audio['bits_per_sample']);
    677677                    if (!empty($info['ac3']['bitrate']) && ($info['ac3']['bitrate'] != $thisfile_audio['bitrate'])) {
     
    782782                    $thisfile_riff_video_current = &$thisfile_riff_video[$streamindex];
    783783
    784                     if ($thisfile_riff_raw_avih['dwWidth'] > 0) {
     784                    if ($thisfile_riff_raw_avih['dwWidth'] > 0) {
    785785                        $thisfile_riff_video_current['frame_width'] = $thisfile_riff_raw_avih['dwWidth'];
    786786                        $thisfile_video['resolution_x']             = $thisfile_riff_video_current['frame_width'];
    787787                    }
    788                     if ($thisfile_riff_raw_avih['dwHeight'] > 0) {
     788                    if ($thisfile_riff_raw_avih['dwHeight'] > 0) {
    789789                        $thisfile_riff_video_current['frame_height'] = $thisfile_riff_raw_avih['dwHeight'];
    790790                        $thisfile_video['resolution_y']              = $thisfile_riff_video_current['frame_height'];
    791791                    }
    792                     if ($thisfile_riff_raw_avih['dwTotalFrames'] > 0) {
     792                    if ($thisfile_riff_raw_avih['dwTotalFrames'] > 0) {
    793793                        $thisfile_riff_video_current['total_frames'] = $thisfile_riff_raw_avih['dwTotalFrames'];
    794794                        $thisfile_video['total_frames']              = $thisfile_riff_video_current['total_frames'];
     
    19141914                                        unset($RIFFchunk[$chunkname][$thisindex]);
    19151915                                    }
    1916                                     if (isset($RIFFchunk[$chunkname]) && empty($RIFFchunk[$chunkname])) {
     1916                                    if () {
    19171917                                        unset($RIFFchunk[$chunkname]);
    19181918                                    }
     
    20352035            if (isset($RIFFinfoArray[$key])) {
    20362036                foreach ($RIFFinfoArray[$key] as $commentid => $commentdata) {
    2037                     if (trim($commentdata['data']) != '') {
     2037                    if (trim($commentdata['data']) != '') {
    20382038                        if (isset($CommentsTargetArray[$value])) {
    20392039                            $CommentsTargetArray[$value][] =     trim($commentdata['data']);
  • trunk/src/wp-includes/ID3/module.audio.mp3.php

    r54376 r56975  
    13811381                            $Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]] = isset($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]) ? ++$Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]] : 1;
    13821382                            if (++$frames_scanned >= $max_frames_scan) {
    1383                                 $pct_data_scanned = ($this->ftell() - $info['avdataoffset']) / ($info['avdataend'] - $info['avdataoffset']);
     1383                                $pct_data_scanned = $info['avdataend'] - $info['avdataoffset']);
    13841384                                $this->warning('too many MPEG audio frames to scan, only scanned first '.$max_frames_scan.' frames ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.');
    13851385                                foreach ($Distribution as $key1 => $value1) {
    13861386                                    foreach ($value1 as $key2 => $value2) {
    1387                                         $Distribution[$key1][$key2] = round($value2 / $pct_data_scanned);
     1387                                        $Distribution[$key1][$key2] = ;
    13881388                                    }
    13891389                                }
     
    14761476        $FirstFrameThisfileInfo = null;
    14771477        while ($SynchSeekOffset < $sync_seek_buffer_size) {
    1478             if ((($avdataoffset + $SynchSeekOffset)  < $info['avdataend']) && !feof($this->getid3->fp)) {
     1478            if ((($avdataoffset + $SynchSeekOffset)  < $info['avdataend']) && !)) {
    14791479
    14801480                if ($SynchSeekOffset > $sync_seek_buffer_size) {
     
    14881488                    }
    14891489                    if (empty($info['mpeg'])) {
    1490                         unset($info['mpeg']);
    1491                     }
    1492                     return false;
    1493 
    1494                 } elseif (feof($this->getid3->fp)) {
    1495 
    1496                     $this->error('Could not find valid MPEG audio synch before end of file');
    1497                     if (isset($info['audio']['bitrate'])) {
    1498                         unset($info['audio']['bitrate']);
    1499                     }
    1500                     if (isset($info['mpeg']['audio'])) {
    1501                         unset($info['mpeg']['audio']);
    1502                     }
    1503                     if (isset($info['mpeg']) && (!is_array($info['mpeg']) || (count($info['mpeg']) == 0))) {
    15041490                        unset($info['mpeg']);
    15051491                    }
     
    16531639                                $frames_scanned++;
    16541640                                if ($frames_scan_per_segment && (++$frames_scanned_this_segment >= $frames_scan_per_segment)) {
    1655                                     $this_pct_scanned = ($this->ftell() - $scan_start_offset[$current_segment]) / ($info['avdataend'] - $info['avdataoffset']);
     1641                                    $this_pct_scanned = $info['avdataend'] - $info['avdataoffset']);
    16561642                                    if (($current_segment == 0) && (($this_pct_scanned * $max_scan_segments) >= 1)) {
    16571643                                        // file likely contains < $max_frames_scan, just scan as one segment
     
    17441730        }
    17451731        $info['audio']['channels']        = $info['mpeg']['audio']['channels'];
     1732
     1733
     1734
     1735
    17461736        $info['audio']['channelmode']     = $info['mpeg']['audio']['channelmode'];
    17471737        $info['audio']['sample_rate']     = $info['mpeg']['audio']['sample_rate'];
  • trunk/src/wp-includes/ID3/module.audio.ogg.php

    r54376 r56975  
    211211
    212212            $info['ogg']['skeleton']['fishead']['version']          = $info['ogg']['skeleton']['fishead']['raw']['version_major'].'.'.$info['ogg']['skeleton']['fishead']['raw']['version_minor'];
    213             $info['ogg']['skeleton']['fishead']['presentationtime'] = $info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator'] / $info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator'];
    214             $info['ogg']['skeleton']['fishead']['basetime']         = $info['ogg']['skeleton']['fishead']['raw']['basetime_numerator']         / $info['ogg']['skeleton']['fishead']['raw']['basetime_denominator'];
     213            $info['ogg']['skeleton']['fishead']['presentationtime'] = ;
     214            $info['ogg']['skeleton']['fishead']['basetime']         = ;
    215215            $info['ogg']['skeleton']['fishead']['utc']              = $info['ogg']['skeleton']['fishead']['raw']['utc'];
    216216
     
    289289                $info['audio']['channels']        = $info['flac']['STREAMINFO']['channels'];
    290290                $info['audio']['bits_per_sample'] = $info['flac']['STREAMINFO']['bits_per_sample'];
    291                 $info['playtime_seconds']         = $info['flac']['STREAMINFO']['samples_stream'] / $info['flac']['STREAMINFO']['sample_rate'];
     291                $info['playtime_seconds']         = ;
    292292            }
    293293
     
    360360                }
    361361                if (!empty($info['audio']['sample_rate'])) {
    362                     $info['ogg']['bitrate_average'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / ($info['ogg']['samples'] / $info['audio']['sample_rate']);
     362                    $info['ogg']['bitrate_average'] = (($info['avdataend'] - $info['avdataoffset']) * 8) ;
    363363                }
    364364            }
     
    535535        $filedata = $this->fread($this->getid3->fread_buffer_size());
    536536        $filedataoffset = 0;
    537         while ((substr($filedata, $filedataoffset++, 4) != 'OggS')) {
     537        while () {
    538538            if (($this->ftell() - $oggheader['page_start_offset']) >= $this->getid3->fread_buffer_size()) {
    539539                // should be found before here
    540540                return false;
    541541            }
    542             if ((($filedataoffset + 28) > strlen($filedata)) || (strlen($filedata) < 28)) {
     542            if (()) {
    543543                if ($this->feof() || (($filedata .= $this->fread($this->getid3->fread_buffer_size())) === '')) {
    544544                    // get some more data, unless eof, in which case fail
  • trunk/src/wp-includes/ID3/module.tag.apetag.php

    r52254 r56975  
    268268                case 'cover art (recording)':
    269269                case 'cover art (studio)':
    270                     // list of possible cover arts from http://taglib-sharp.sourcearchive.com/documentation/2.0.3.0-2/Ape_2Tag_8cs-source.html
     270                    // list of possible cover arts from http
    271271                    if (is_array($thisfile_ape_items_current['data'])) {
    272272                        $this->warning('APEtag "'.$item_key.'" should be flagged as Binary data, but was incorrectly flagged as UTF-8');
     
    333333                            unset($comments_picture_data);
    334334                        }
    335                     } while (false);
     335                    } while (false);
    336336                    break;
    337337
  • trunk/src/wp-includes/ID3/module.tag.id3v1.php

    r52254 r56975  
    6767                unset($ParsedID3v1['genreid']);
    6868            }
    69             if (isset($ParsedID3v1['genre']) && (empty($ParsedID3v1['genre']) || ($ParsedID3v1['genre'] == 'Unknown'))) {
     69            if ()) {
    7070                unset($ParsedID3v1['genre']);
    7171            }
  • trunk/src/wp-includes/ID3/module.tag.id3v2.php

    r54376 r56975  
    14951495                        }
    14961496                    }
    1497                 } while (false);
     1497                } while (false);
    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        }
  • trunk/src/wp-includes/ID3/readme.txt

    r52254 r56975  
    2121Mozilla MPL: https://www.mozilla.org/MPL/2.0/                (v2)
    2222
    23 getID3 Commercial License: https://www.getid3.org/#gCL (payment required)
     23getID3 Commercial License: https://www.getid3.org/#gCL
     24(no longer available, existing licenses remain valid)
    2425
    2526*****************************************************************
Note: See TracChangeset for help on using the changeset viewer.