Make WordPress Core

Ticket #60415: 60415.11.patch

File 60415.11.patch, 11.4 KB (added by viralsampat, 13 months ago)

I have checked above mentioned issue and founds few files. Here, I have added its patch.

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

    diff --git src/wp-includes/ID3/module.audio-video.quicktime.php src/wp-includes/ID3/module.audio-video.quicktime.php
    index d6e0eda7dd..2082186d6d 100644
    class getid3_quicktime extends getid3_handler 
    207207                                }
    208208                        }
    209209                }
    210                 if ($info['audio']['dataformat'] == 'mp4') {
     210                if ($info['audio']['dataformat'] === 'mp4') {
    211211                        $info['fileformat'] = 'mp4';
    212212                        if (empty($info['video']['resolution_x'])) {
    213213                                $info['mime_type']  = 'audio/mp4';
    class getid3_quicktime extends getid3_handler 
    289289                                                // some "ilst" atoms contain data atoms that have a numeric name, and the data is far more accessible if the returned array is compacted
    290290                                                $allnumericnames = true;
    291291                                                foreach ($atom_structure['subatoms'] as $subatomarray) {
    292                                                         if (!is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) != 1)) {
     292                                                        if (!is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) !== 1)) {
    293293                                                                $allnumericnames = false;
    294294                                                                break;
    295295                                                        }
    $this->warning('incomplete/incorrect handling of "stsd" with Parrot metadata in 
    949949                                                                                $atom_structure['sample_description_table'][$i]['video_pixel_color_type']  = (((int) $atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] > 32) ? 'grayscale' : 'color');
    950950                                                                                $atom_structure['sample_description_table'][$i]['video_pixel_color_name']  = $this->QuicktimeColorNameLookup($atom_structure['sample_description_table'][$i]['video_pixel_color_depth']);
    951951
    952                                                                                 if ($atom_structure['sample_description_table'][$i]['video_pixel_color_name'] != 'invalid') {
     952                                                                                if ($atom_structure['sample_description_table'][$i]['video_pixel_color_name'] !== 'invalid') {
    953953                                                                                        $info['quicktime']['video']['codec_fourcc']        = $atom_structure['sample_description_table'][$i]['data_format'];
    954954                                                                                        $info['quicktime']['video']['codec_fourcc_lookup'] = $this->QuicktimeVideoCodecLookup($atom_structure['sample_description_table'][$i]['data_format']);
    955955                                                                                        $info['quicktime']['video']['codec']               = (((int) $atom_structure['sample_description_table'][$i]['video_encoder_name_len'] > 0) ? $atom_structure['sample_description_table'][$i]['video_encoder_name'] : $atom_structure['sample_description_table'][$i]['data_format']);
    $this->warning('incomplete/incorrect handling of "stsd" with Parrot metadata in 
    21142114
    21152115                                        $atom_structure['ES_DescrTag'] = getid3_lib::BigEndian2Int(substr($atom_data, $esds_offset, 1));
    21162116                                        $esds_offset += 1;
    2117                                         if ($atom_structure['ES_DescrTag'] != 0x03) {
     2117                                        if ($atom_structure['ES_DescrTag'] !== 0x03) {
    21182118                                                $this->warning('expecting esds.ES_DescrTag = 0x03, found 0x'.getid3_lib::PrintHexBytes($atom_structure['ES_DescrTag']).'), at offset '.$atom_structure['offset']);
    21192119                                                break;
    21202120                                        }
    $this->warning('incomplete/incorrect handling of "stsd" with Parrot metadata in 
    21432143
    21442144                                        $atom_structure['ES_DecoderConfigDescrTag'] = getid3_lib::BigEndian2Int(substr($atom_data, $esds_offset, 1));
    21452145                                        $esds_offset += 1;
    2146                                         if ($atom_structure['ES_DecoderConfigDescrTag'] != 0x04) {
     2146                                        if ($atom_structure['ES_DecoderConfigDescrTag'] !== 0x04) {
    21472147                                                $this->warning('expecting esds.ES_DecoderConfigDescrTag = 0x04, found 0x'.getid3_lib::PrintHexBytes($atom_structure['ES_DecoderConfigDescrTag']).'), at offset '.$atom_structure['offset']);
    21482148                                                break;
    21492149                                        }
    $this->warning('incomplete/incorrect handling of "stsd" with Parrot metadata in 
    21742174
    21752175                                        $atom_structure['ES_DecSpecificInfoTag'] = getid3_lib::BigEndian2Int(substr($atom_data, $esds_offset, 1));
    21762176                                        $esds_offset += 1;
    2177                                         if ($atom_structure['ES_DecSpecificInfoTag'] != 0x05) {
     2177                                        if ($atom_structure['ES_DecSpecificInfoTag'] !== 0x05) {
    21782178                                                $this->warning('expecting esds.ES_DecSpecificInfoTag = 0x05, found 0x'.getid3_lib::PrintHexBytes($atom_structure['ES_DecSpecificInfoTag']).'), at offset '.$atom_structure['offset']);
    21792179                                                break;
    21802180                                        }
    $this->warning('incomplete/incorrect handling of "stsd" with Parrot metadata in 
    21852185
    21862186                                        $atom_structure['ES_SLConfigDescrTag'] = getid3_lib::BigEndian2Int(substr($atom_data, $esds_offset, 1));
    21872187                                        $esds_offset += 1;
    2188                                         if ($atom_structure['ES_SLConfigDescrTag'] != 0x06) {
     2188                                        if ($atom_structure['ES_SLConfigDescrTag'] !== 0x06) {
    21892189                                                $this->warning('expecting esds.ES_SLConfigDescrTag = 0x05, found 0x'.getid3_lib::PrintHexBytes($atom_structure['ES_SLConfigDescrTag']).'), at offset '.$atom_structure['offset']);
    21902190                                                break;
    21912191                                        }
    $this->error('fragmented mp4 files not currently supported'); 
    29182918                }
    29192919                $info = &$this->getid3->info;
    29202920                $comment_key = '';
    2921                 if ($boxname && ($boxname != $keyname)) {
     2921                if ($boxname && ($boxname !== $keyname)) {
    29222922                        $comment_key = (isset($handyatomtranslatorarray[$boxname]) ? $handyatomtranslatorarray[$boxname] : $boxname);
    29232923                } elseif (isset($handyatomtranslatorarray[$keyname])) {
    29242924                        $comment_key = $handyatomtranslatorarray[$keyname];
    29252925                }
    29262926                if ($comment_key) {
    2927                         if ($comment_key == 'picture') {
     2927                        if ($comment_key === 'picture') {
    29282928                                // already copied directly into [comments][picture] elsewhere, do not re-copy here
    29292929                                return true;
    29302930                        }
    29312931                        $gooddata = array($data);
    2932                         if ($comment_key == 'genre') {
     2932                        if ($comment_key === 'genre') {
    29332933                                // some other taggers separate multiple genres with semicolon, e.g. "Heavy Metal;Thrash Metal;Metal"
    29342934                                $gooddata = explode(';', $data);
    29352935                        }
  • src/wp-includes/ID3/module.audio-video.riff.php

    diff --git src/wp-includes/ID3/module.audio-video.riff.php src/wp-includes/ID3/module.audio-video.riff.php
    index a94ae24d0c..c9b875f70b 100644
    class getid3_riff extends getid3_handler 
    8282                                //$info['fileformat']   = 'riff';
    8383                                $this->container = 'riff';
    8484                                $thisfile_riff['header_size'] = $this->EitherEndian2Int($RIFFsize);
    85                                 if ($RIFFsubtype == 'RMP3') {
     85                                if ( 'RMP3' === $RIFFsubtype ) {
    8686                                        // RMP3 is identical to WAVE, just renamed. Used by [unknown program] when creating RIFF-MP3s
    8787                                        $RIFFsubtype = 'WAVE';
    8888                                }
    class getid3_riff extends getid3_handler 
    15161516
    15171517                        // the rest is all hardcoded(?) and does not appear to be useful until you get to audio info at offset 256, even then everything is probably hardcoded
    15181518
    1519                         if (substr($AMVheader,  68, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x38\x00\x00\x00") {
     1519                        if (substr($AMVheader,  68, 20) !== 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x38\x00\x00\x00") {
    15201520                                throw new Exception('expecting "LIST<0x00000000>strlstrh<0x38000000>" at offset '.($startoffset +  68).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader,  68, 20)).'"');
    15211521                        }
    15221522                        // followed by 56 bytes of null: substr($AMVheader,  88, 56) -> 144
    1523                         if (substr($AMVheader, 144,  8) != 'strf'."\x24\x00\x00\x00") {
     1523                        if (substr($AMVheader, 144,  8) !== 'strf'."\x24\x00\x00\x00") {
    15241524                                throw new Exception('expecting "strf<0x24000000>" at offset '.($startoffset + 144).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 144,  8)).'"');
    15251525                        }
    15261526                        // followed by 36 bytes of null: substr($AMVheader, 144, 36) -> 180
    15271527
    1528                         if (substr($AMVheader, 188, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x30\x00\x00\x00") {
     1528                        if (substr($AMVheader, 188, 20) !== 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x30\x00\x00\x00") {
    15291529                                throw new Exception('expecting "LIST<0x00000000>strlstrh<0x30000000>" at offset '.($startoffset + 188).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 188, 20)).'"');
    15301530                        }
    15311531                        // followed by 48 bytes of null: substr($AMVheader, 208, 48) -> 256
    1532                         if (substr($AMVheader, 256,  8) != 'strf'."\x14\x00\x00\x00") {
     1532                        if (substr($AMVheader, 256,  8) !== 'strf'."\x14\x00\x00\x00") {
    15331533                                throw new Exception('expecting "strf<0x14000000>" at offset '.($startoffset + 256).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 256,  8)).'"');
    15341534                        }
    15351535                        // followed by 20 bytes of a modified WAVEFORMATEX:
    class getid3_riff extends getid3_handler 
    16011601                                        $this->error('Expecting chunk name at offset '.($this->ftell() - 8).' but found nothing. Aborting RIFF parsing.');
    16021602                                        break;
    16031603                                }
    1604                                 if (($chunksize == 0) && ($chunkname != 'JUNK')) {
     1604                                if (($chunksize === 0) && ($chunkname !== 'JUNK')) {
    16051605                                        $this->warning('Chunk ('.$chunkname.') size at offset '.($this->ftell() - 4).' is zero. Aborting RIFF parsing.');
    16061606                                        break;
    16071607                                }
    1608                                 if (($chunksize % 2) != 0) {
     1608                                if (($chunksize % 2) !== 0) {
    16091609                                        // all structures are packed on word boundaries
    16101610                                        $chunksize++;
    16111611                                }
    class getid3_riff extends getid3_handler 
    16241624                                                                $AudioChunkStreamType =                              substr($AudioChunkHeader, 2, 2);
    16251625                                                                $AudioChunkSize       = getid3_lib::LittleEndian2Int(substr($AudioChunkHeader, 4, 4));
    16261626
    1627                                                                 if ($AudioChunkStreamType == 'wb') {
     1627                                                                if ($AudioChunkStreamType === 'wb') {
    16281628                                                                        $FirstFourBytes = substr($AudioChunkHeader, 8, 4);
    16291629                                                                        if (preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', $FirstFourBytes)) {
    16301630                                                                                // MP3
    class getid3_riff extends getid3_handler 
    18151815                                                                if ($chunksize < 1048576) {
    18161816                                                                        if ($chunksize > 0) {
    18171817                                                                                $RIFFchunk[$chunkname][$thisindex]['data'] = $this->fread($chunksize);
    1818                                                                                 if ($chunkname == 'JUNK') {
     1818                                                                                if ( 'JUNK' === $chunkname ) {
    18191819                                                                                        if (preg_match('#^([\\x20-\\x7F]+)#', $RIFFchunk[$chunkname][$thisindex]['data'], $matches)) {
    18201820                                                                                                // only keep text characters [chr(32)-chr(127)]
    18211821                                                                                                $info['riff']['comments']['junk'][] = trim($matches[1]);
    class getid3_riff extends getid3_handler 
    18991899                                                                                $info['riff']['comments'][$key] = array($RIFFchunk[$chunkname][$thisindex]['parsed'][$key]);
    19001900                                                                        }
    19011901                                                                }
    1902                                                                 if ($RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'] && !empty($info['filesize']) && ($RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'] != $info['filesize'])) {
     1902                                                                if ($RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'] && !empty($info['filesize']) && ($RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'] !== $info['filesize'])) {
    19031903                                                                        $this->warning('RIFF.WAVE.scot.filelength ('.$RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'].') different from actual filesize ('.$info['filesize'].')');
    19041904                                                                }
    19051905                                                                break;
  • src/wp-includes/ID3/module.audio.flac.php

    diff --git src/wp-includes/ID3/module.audio.flac.php src/wp-includes/ID3/module.audio.flac.php
    index 014061da94..f3f944344d 100644
    class getid3_flac extends getid3_handler 
    3434
    3535                $this->fseek($info['avdataoffset']);
    3636                $StreamMarker = $this->fread(4);
    37                 if ($StreamMarker != self::syncword) {
     37                if ($StreamMarker !== self::syncword) {
    3838                        return $this->error('Expecting "'.getid3_lib::PrintHexBytes(self::syncword).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($StreamMarker).'"');
    3939                }
    4040                $info['fileformat']            = 'flac';
    class getid3_flac extends getid3_handler 
    6565                                break;
    6666                        }
    6767                        if ($BlockLength < 1) {
    68                                 if ($BlockTypeText != 'reserved') {
     68                                if ($BlockTypeText !== 'reserved') {
    6969                                        // probably supposed to be zero-length
    7070                                        $this->warning('METADATA_BLOCK_HEADER.BLOCK_LENGTH ('.$BlockTypeText.') at offset '.$BlockOffset.' is zero bytes');
    7171                                        continue;