Make WordPress Core


Ignore:
Timestamp:
07/31/2017 07:49:31 PM (7 years ago)
Author:
wonderboymusic
Message:

Media: update the getID3 library to version 1.9.14 to avoid fatal errors in PHP7.

Props MyThemeShop for the initial patch.
Fixes #41496.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ID3/module.audio.ogg.php

    r32979 r41196  
    2727        // Warn about illegal tags - only vorbiscomments are allowed
    2828        if (isset($info['id3v2'])) {
    29             $info['warning'][] = 'Illegal ID3v2 tag present.';
     29            $this->warning('Illegal ID3v2 tag present.');
    3030        }
    3131        if (isset($info['id3v1'])) {
    32             $info['warning'][] = 'Illegal ID3v1 tag present.';
     32            $this->warning('Illegal ID3v1 tag present.');
    3333        }
    3434        if (isset($info['ape'])) {
    35             $info['warning'][] = 'Illegal APE tag present.';
     35            $this->warning('Illegal APE tag present.');
    3636        }
    3737
     
    4545
    4646        if ($this->ftell() >= $this->getid3->fread_buffer_size()) {
    47             $info['error'][] = 'Could not find start of Ogg page in the first '.$this->getid3->fread_buffer_size().' bytes (this might not be an Ogg-Vorbis file?)';
     47            $this->error('Could not find start of Ogg page in the first '.$this->getid3->fread_buffer_size().' bytes (this might not be an Ogg-Vorbis file?)');
    4848            unset($info['fileformat']);
    4949            unset($info['ogg']);
     
    180180                $info['video']['pixel_aspect_ratio'] = (float) $info['ogg']['pageheader']['theora']['pixel_aspect_numerator'] / $info['ogg']['pageheader']['theora']['pixel_aspect_denominator'];
    181181            }
    182 $info['warning'][] = 'Ogg Theora (v3) not fully supported in this version of getID3 ['.$this->getid3->version().'] -- bitrate, playtime and all audio data are currently unavailable';
     182$this->warning('Ogg Theora (v3) not fully supported in this version of getID3 ['.$this->getid3->version().'] -- bitrate, playtime and all audio data are currently unavailable');
    183183
    184184
     
    241241
    242242                    $info['video']['dataformat'] = 'theora1';
    243                     $info['error'][] = 'Ogg Theora (v1) not correctly handled in this version of getID3 ['.$this->getid3->version().']';
     243                    $this->error('Ogg Theora (v1) not correctly handled in this version of getID3 ['.$this->getid3->version().']');
    244244                    //break;
    245245
     
    249249
    250250                } else {
    251                     $info['error'][] = 'unexpected';
     251                    $this->error('unexpected');
    252252                    //break;
    253253                }
     
    257257            $this->fseek($oggpageinfo['page_start_offset']);
    258258
    259             $info['error'][] = 'Ogg Skeleton not correctly handled in this version of getID3 ['.$this->getid3->version().']';
     259            $this->error('Ogg Skeleton not correctly handled in this version of getID3 ['.$this->getid3->version().']');
    260260            //return false;
    261261
    262262        } else {
    263263
    264             $info['error'][] = 'Expecting either "Speex   ", "OpusHead" or "vorbis" identifier strings, found "'.substr($filedata, 0, 8).'"';
     264            $this->error('Expecting either "Speex   ", "OpusHead" or "vorbis" identifier strings, found "'.substr($filedata, 0, 8).'"');
    265265            unset($info['ogg']);
    266266            unset($info['mime_type']);
     
    285285                $flac = new getid3_flac($this->getid3);
    286286                if (!$flac->parseMETAdata()) {
    287                     $info['error'][] = 'Failed to parse FLAC headers';
     287                    $this->error('Failed to parse FLAC headers');
    288288                    return false;
    289289                }
     
    300300                $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, 0, 8); // hard-coded to 'OpusTags'
    301301                if(substr($filedata, 0, 8)  != 'OpusTags') {
    302                     $info['error'][] = 'Expected "OpusTags" as header but got "'.substr($filedata, 0, 8).'"';
     302                    $this->error('Expected "OpusTags" as header but got "'.substr($filedata, 0, 8).'"');
    303303                    return false;
    304304                }
     
    312312        if (!getid3_lib::intValueSupported($info['avdataend'])) {
    313313
    314             $info['warning'][] = 'Unable to parse Ogg end chunk file (PHP does not support file operations beyond '.round(PHP_INT_MAX / 1073741824).'GB)';
     314            $this->warning('Unable to parse Ogg end chunk file (PHP does not support file operations beyond '.round(PHP_INT_MAX / 1073741824).'GB)');
    315315
    316316        } else {
     
    324324                $info['ogg']['samples']   = $info['ogg']['pageheader']['eos']['pcm_abs_position'];
    325325                if ($info['ogg']['samples'] == 0) {
    326                     $info['error'][] = 'Corrupt Ogg file: eos.number of samples == zero';
     326                    $this->error('Corrupt Ogg file: eos.number of samples == zero');
    327327                    return false;
    328328                }
     
    343343        if (isset($info['audio']['bitrate']) && !isset($info['playtime_seconds'])) {
    344344            if ($info['audio']['bitrate'] == 0) {
    345                 $info['error'][] = 'Corrupt Ogg file: bitrate_audio == zero';
     345                $this->error('Corrupt Ogg file: bitrate_audio == zero');
    346346                return false;
    347347            }
     
    396396        $filedataoffset += 4;
    397397        if ($info['ogg']['samplerate'] == 0) {
    398             $info['error'][] = 'Corrupt Ogg file: sample rate == zero';
     398            $this->error('Corrupt Ogg file: sample rate == zero');
    399399            return false;
    400400        }
     
    444444
    445445        if ($info['ogg']['pageheader']['opus']['version'] < 1 || $info['ogg']['pageheader']['opus']['version'] > 15) {
    446             $info['error'][] = 'Unknown opus version number (only accepting 1-15)';
     446            $this->error('Unknown opus version number (only accepting 1-15)');
    447447            return false;
    448448        }
     
    452452
    453453        if ($info['ogg']['pageheader']['opus']['out_channel_count'] == 0) {
    454             $info['error'][] = 'Invalid channel count in opus header (must not be zero)';
     454            $this->error('Invalid channel count in opus header (must not be zero)');
    455455            return false;
    456456        }
     
    563563            default:
    564564                return false;
     565                break;
    565566        }
    566567
     
    581582            if ($i >= 10000) {
    582583                // https://github.com/owncloud/music/issues/212#issuecomment-43082336
    583                 $info['warning'][] = 'Unexpectedly large number ('.$CommentsCount.') of Ogg comments - breaking after reading '.$i.' comments';
     584                $this->warning('Unexpectedly large number ('.$CommentsCount.') of Ogg comments - breaking after reading '.$i.' comments');
    584585                break;
    585586            }
     
    619620            while ((strlen($commentdata) - $commentdataoffset) < $ThisFileInfo_ogg_comments_raw[$i]['size']) {
    620621                if (($ThisFileInfo_ogg_comments_raw[$i]['size'] > $info['avdataend']) || ($ThisFileInfo_ogg_comments_raw[$i]['size'] < 0)) {
    621                     $info['warning'][] = 'Invalid Ogg comment size (comment #'.$i.', claims to be '.number_format($ThisFileInfo_ogg_comments_raw[$i]['size']).' bytes) - aborting reading comments';
     622                    $this->warning('Invalid Ogg comment size (comment #'.$i.', claims to be '.number_format($ThisFileInfo_ogg_comments_raw[$i]['size']).' bytes) - aborting reading comments');
    622623                    break 2;
    623624                }
     
    643644                //$commentdata .= $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']);
    644645                if (!isset($info['ogg']['pageheader'][$VorbisCommentPage])) {
    645                     $info['warning'][] = 'undefined Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.$this->ftell();
     646                    $this->warning('undefined Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.$this->ftell());
    646647                    break;
    647648                }
    648649                $readlength = self::OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1);
    649650                if ($readlength <= 0) {
    650                     $info['warning'][] = 'invalid length Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.$this->ftell();
     651                    $this->warning('invalid length Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.$this->ftell());
    651652                    break;
    652653                }
     
    662663
    663664                // no comment?
    664                 $info['warning'][] = 'Blank Ogg comment ['.$i.']';
     665                $this->warning('Blank Ogg comment ['.$i.']');
    665666
    666667            } elseif (strstr($commentstring, '=')) {
     
    712713            } else {
    713714
    714                 $info['warning'][] = '[known problem with CDex >= v1.40, < v1.50b7] Invalid Ogg comment name/value pair ['.$i.']: '.$commentstring;
     715                $this->warning('[known problem with CDex >= v1.40, < v1.50b7] Invalid Ogg comment name/value pair ['.$i.']: '.$commentstring);
    715716
    716717            }
Note: See TracChangeset for help on using the changeset viewer.