diff -Nru php-getid3-1.9.17+dfsg/changelog.txt php-getid3-1.9.18+dfsg/changelog.txt --- php-getid3-1.9.17+dfsg/changelog.txt 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/changelog.txt 2019-09-16 19:08:47.000000000 +0000 @@ -18,6 +18,20 @@ Version History =============== +1.9.18: [2019-07-24] James Heinrich :: 1.9.18-201907240906 + * bugfix (G:198) use native hash functions instead of obsolete external binaries + * bugfix (G:194) PHP 7.4 compatibility: fix deprecated curly brace array access + * bugfix (G:191) unsupported operand types module.audio.ac3.php:763 + * bugfix (G:189) false UTF-16 and no termination strings + * bugfix (G:188) add support for DS2 v8 + * bugfix (G:187) RIFF.WAVE.scot parsing + * bugfix (G:184) invalid regex pattern (ID3v1) + * bugfix (G:183) reduced information for GIF files with $option_extra_info=false + * bugfix (G:175) mp4 max buffer size + * bugfix (G:174) TIFF parsing improvements + * bugfix (G:121) trailing nulls in ID3v2 strings + * standardize "track" -> "track_number" + 1.9.17: [2019-02-07] James Heinrich :: 1.9.17-201902071234 * bugfix (G:178) HandleAllTags should skip "picture" * bugfix (G:177) error checking for reading more than PHP memory_limit diff -Nru php-getid3-1.9.17+dfsg/composer.json php-getid3-1.9.18+dfsg/composer.json --- php-getid3-1.9.17+dfsg/composer.json 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/composer.json 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -{ - "name": "james-heinrich/getid3", - "description": "PHP script that extracts useful information from popular multimedia file formats", - "homepage": "https://www.getid3.org/", - "keywords": ["php","tags","codecs"], - "type": "library", - "license": ["GPL-1.0-or-later", "LGPL-3.0-only", "MPL-2.0"], - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "jakub-onderka/php-parallel-lint": "^0.9 || ^1.0" - }, - "suggest": { - "ext-com_dotnet": "COM extension is required when loading files larger than 2GB on Windows.", - "ext-ctype": "ctype extension is required when loading files larger than 2GB on 32-bit PHP (also on 64-bit PHP on Windows) or executing `getid3_lib::CopyTagsToComments`.", - "ext-dba": "DBA extension is required to use the DBA database as a cache storage.", - "ext-exif": "EXIF extension is required for graphic modules.", - "ext-iconv": "iconv extension is required to work with different character sets (when `ext-mbstring` is not available).", - "ext-json": "JSON extension is required to analyze Apple Quicktime videos.", - "ext-libxml": "libxml extension is required to analyze RIFF/WAV/BWF audio files.", - "ext-mbstring": "mbstring extension is required to work with different character sets.", - "ext-mysql": "MySQL extension is required to use the MySQL database as a cache storage (deprecated in PHP 5.5, removed in PHP >= 7.0, use `ext-mysqli` instead).", - "ext-mysqli": "MySQLi extension is required to use the MySQL database as a cache storage.", - "ext-rar": "RAR extension is required for RAR archive module.", - "ext-SimpleXML": "SimpleXML extension is required to analyze RIFF/WAV/BWF audio files (also requires `ext-libxml`).", - "ext-sqlite3": "SQLite3 extension is required to use the SQLite3 database as a cache storage.", - "ext-xml": "XML extension is required for graphic modules to analyze the XML metadata.", - "ext-zlib": "Zlib extension is required for archive modules and compressed metadata." - }, - "scripts": { - "lint": "parallel-lint --exclude vendor .", - "test": [ - "composer lint" - ] - }, - "autoload": { - "classmap": ["getid3/"] - }, - "extra": { - "branch-alias": { - "dev-master": "1.9.x-dev" - } - } -} diff -Nru php-getid3-1.9.17+dfsg/debian/changelog php-getid3-1.9.18+dfsg/debian/changelog --- php-getid3-1.9.17+dfsg/debian/changelog 2019-02-09 04:30:09.000000000 +0000 +++ php-getid3-1.9.18+dfsg/debian/changelog 2019-10-06 20:53:56.000000000 +0000 @@ -1,3 +1,18 @@ +php-getid3 (1.9.18+dfsg-1) unstable; urgency=medium + + [ James Heinrich ] + * standardize "track" -> "track_number" + * v1.9.18-201907240906 release + + [ David Prévot ] + * Fix d/watch + * Track version 1 + * Adapt packaging to removed composer.json + * Update Standards-Version to 4.4.1 + * Set upstream metadata fields: Repository. + + -- David Prévot Sun, 06 Oct 2019 10:53:56 -1000 + php-getid3 (1.9.17+dfsg-1) unstable; urgency=medium [ James Heinrich ] diff -Nru php-getid3-1.9.17+dfsg/debian/control php-getid3-1.9.18+dfsg/debian/control --- php-getid3-1.9.17+dfsg/debian/control 2019-02-09 04:28:45.000000000 +0000 +++ php-getid3-1.9.18+dfsg/debian/control 2019-10-06 20:51:37.000000000 +0000 @@ -5,22 +5,20 @@ Uploaders: Romain Beauxis , David Prévot , Paul van Tilburg -Build-Depends: debhelper-compat (= 12), phpab, pkg-php-tools (>= 1.7~) -Standards-Version: 4.3.0 +Build-Depends: debhelper-compat (= 12), phpab +Standards-Version: 4.4.1 Homepage: https://www.getid3.org/ -Vcs-Git: https://salsa.debian.org/php-team/pear/php-getid3.git +Vcs-Git: https://salsa.debian.org/php-team/pear/php-getid3.git -b v1 Vcs-Browser: https://salsa.debian.org/php-team/pear/php-getid3 Package: php-getid3 Architecture: all -Depends: ${misc:Depends}, ${phpcomposer:Debian-require} +Depends: ${misc:Depends}, php-common Recommends: vorbis-tools -Suggests: ${phpcomposer:Debian-suggest} -Replaces: ${phpcomposer:Debian-replace} -Breaks: ${phpcomposer:Debian-conflict}, ${phpcomposer:Debian-replace} -Provides: ${phpcomposer:Debian-provide} +Suggests: php-com-dotnet, php-json, php-mbstring, php-mysql, php-rar, php-xml, php-sqlite3 Description: scripts to extract information from multimedia files - ${phpcomposer:description}. + PHP script that extracts useful information from popular multimedia file + formats. . getID3() supports many formats such as ID3v1, ID3v2, Ogg, MPC, AVI, etc. diff -Nru php-getid3-1.9.17+dfsg/debian/gbp.conf php-getid3-1.9.18+dfsg/debian/gbp.conf --- php-getid3-1.9.17+dfsg/debian/gbp.conf 1970-01-01 00:00:00.000000000 +0000 +++ php-getid3-1.9.18+dfsg/debian/gbp.conf 2019-10-06 20:38:00.000000000 +0000 @@ -0,0 +1,3 @@ +[DEFAULT] +debian-branch = v1 +upstream-branch = upstream-v1 diff -Nru php-getid3-1.9.17+dfsg/debian/rules php-getid3-1.9.18+dfsg/debian/rules --- php-getid3-1.9.17+dfsg/debian/rules 2018-10-19 03:27:27.000000000 +0000 +++ php-getid3-1.9.18+dfsg/debian/rules 2019-10-06 20:47:25.000000000 +0000 @@ -1,6 +1,6 @@ #!/usr/bin/make -f %: - dh $@ --with phpcomposer + dh $@ override_dh_auto_build: phpab --output getid3/autoload.php getid3 diff -Nru php-getid3-1.9.17+dfsg/debian/upstream/metadata php-getid3-1.9.18+dfsg/debian/upstream/metadata --- php-getid3-1.9.17+dfsg/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 +++ php-getid3-1.9.18+dfsg/debian/upstream/metadata 2019-10-06 20:48:28.000000000 +0000 @@ -0,0 +1 @@ +Repository: https://github.com/JamesHeinrich/getID3 diff -Nru php-getid3-1.9.17+dfsg/debian/watch php-getid3-1.9.18+dfsg/debian/watch --- php-getid3-1.9.17+dfsg/debian/watch 2017-05-30 22:16:39.000000000 +0000 +++ php-getid3-1.9.18+dfsg/debian/watch 2019-10-06 20:37:45.000000000 +0000 @@ -1,4 +1,4 @@ version=3 -options=dversionmangle=s/\+dfsg$//,repacksuffix=+dfsg,uversionmangle=s/-?[^\d.]/~$1/;tr/A-Z/a-z/ \ +options=dversionmangle=s/\+dfsg$//,repacksuffix=+dfsg,uversionmangle=s/-?([^\d.]+)/~$1/;tr/A-Z/a-z/ \ https://github.com/JamesHeinrich/getID3/releases \ -.*/archive/v?([\d\.]+-?\w*)\.tar\.gz +.*/archive/v?(1\.[\d\.]+-?\w*)\.tar\.gz diff -Nru php-getid3-1.9.17+dfsg/demos/demo.browse.php php-getid3-1.9.18+dfsg/demos/demo.browse.php --- php-getid3-1.9.17+dfsg/demos/demo.browse.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/demos/demo.browse.php 2019-09-16 19:08:47.000000000 +0000 @@ -13,9 +13,10 @@ ///////////////////////////////////////////////////////////////// die('For security reasons, this demo has been disabled. It can be enabled by removing line '.__LINE__.' in demos/'.basename(__FILE__)); -define('GETID3_DEMO_BROWSE_ALLOW_EDIT_LINK', false); -define('GETID3_DEMO_BROWSE_ALLOW_DELETE_LINK', false); -define('GETID3_DEMO_BROWSE_ALLOW_MD5_LINK', false); + +define('GETID3_DEMO_BROWSE_ALLOW_EDIT_LINK', false); // if enabled, shows "edit" links (to /demos/demo.write.php) to allow ID3/APE/etc tag editing on applicable file types +define('GETID3_DEMO_BROWSE_ALLOW_DELETE_LINK', false); // if enabled, shows "delete" links to delete files from the browse interface +define('GETID3_DEMO_BROWSE_ALLOW_MD5_LINK', false); // if enabled, shows "enable" link for MD5 hashes for file/data/source ///////////////////////////////////////////////////////////////// // die if magic_quotes_runtime or magic_quotes_gpc are set @@ -60,20 +61,20 @@ echo ''; echo ''; -if (isset($_REQUEST['deletefile'])) { +if (isset($_REQUEST['deletefile']) && GETID3_DEMO_BROWSE_ALLOW_DELETE_LINK) { if (file_exists($_REQUEST['deletefile'])) { if (unlink($_REQUEST['deletefile'])) { - $deletefilemessage = 'Successfully deleted '.addslashes($_REQUEST['deletefile']); + $deletefilemessage = 'Successfully deleted '.$_REQUEST['deletefile']; } else { - $deletefilemessage = 'FAILED to delete '.addslashes($_REQUEST['deletefile']).' - error deleting file'; + $deletefilemessage = 'FAILED to delete '.$_REQUEST['deletefile'].' - error deleting file'; } } else { - $deletefilemessage = 'FAILED to delete '.addslashes($_REQUEST['deletefile']).' - file does not exist'; + $deletefilemessage = 'FAILED to delete '.$_REQUEST['deletefile'].' - file does not exist'; } if (isset($_REQUEST['noalert'])) { - echo ''.$deletefilemessage.'
'; + echo ''.htmlentities($deletefilemessage, ENT_QUOTES).'
'; } else { - echo ''; + echo ''; } } diff -Nru php-getid3-1.9.17+dfsg/demos/demo.mp3header.php php-getid3-1.9.18+dfsg/demos/demo.mp3header.php --- php-getid3-1.9.17+dfsg/demos/demo.mp3header.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/demos/demo.mp3header.php 2019-09-16 19:08:47.000000000 +0000 @@ -88,10 +88,10 @@ $variable = str_replace(chr(0), ' ', $variable); $varlen = strlen($variable); for ($i = 0; $i < $varlen; $i++) { - if (preg_match('#['.chr(0x0A).chr(0x0D).' -;0-9A-Za-z]#', $variable{$i})) { - $returnstring .= $variable{$i}; + if (preg_match('#['.chr(0x0A).chr(0x0D).' -;0-9A-Za-z]#', $variable[$i])) { + $returnstring .= $variable[$i]; } else { - $returnstring .= '&#'.str_pad(ord($variable{$i}), 3, '0', STR_PAD_LEFT).';'; + $returnstring .= '&#'.str_pad(ord($variable[$i]), 3, '0', STR_PAD_LEFT).';'; } } $returnstring = nl2br($returnstring); @@ -242,11 +242,11 @@ // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html if (strpos($binarypointnumber, '.') === false) { $binarypointnumber = '0.'.$binarypointnumber; - } elseif ($binarypointnumber{0} == '.') { + } elseif ($binarypointnumber[0] == '.') { $binarypointnumber = '0'.$binarypointnumber; } $exponent = 0; - while (($binarypointnumber{0} != '1') || (substr($binarypointnumber, 1, 1) != '.')) { + while (($binarypointnumber[0] != '1') || (substr($binarypointnumber, 1, 1) != '.')) { if (substr($binarypointnumber, 1, 1) == '.') { $exponent--; $binarypointnumber = substr($binarypointnumber, 2, 1).'.'.substr($binarypointnumber, 3); @@ -254,7 +254,7 @@ $pointpos = strpos($binarypointnumber, '.'); $exponent += ($pointpos - 1); $binarypointnumber = str_replace('.', '', $binarypointnumber); - $binarypointnumber = $binarypointnumber{0}.'.'.substr($binarypointnumber, 1); + $binarypointnumber = $binarypointnumber[0].'.'.substr($binarypointnumber, 1); } } $binarypointnumber = str_pad(substr($binarypointnumber, 0, $maxbits + 2), $maxbits + 2, '0', STR_PAD_RIGHT); @@ -324,7 +324,7 @@ // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee.html $bitword = BigEndian2Bin($byteword); - $signbit = $bitword{0}; + $signbit = $bitword[0]; switch (strlen($byteword) * 8) { case 32: @@ -397,9 +397,9 @@ $bytewordlen = strlen($byteword); for ($i = 0; $i < $bytewordlen; $i++) { if ($synchsafe) { // disregard MSB, effectively 7-bit bytes - $intvalue = $intvalue | (ord($byteword{$i}) & 0x7F) << (($bytewordlen - 1 - $i) * 7); + $intvalue = $intvalue | (ord($byteword[$i]) & 0x7F) << (($bytewordlen - 1 - $i) * 7); } else { - $intvalue += ord($byteword{$i}) * pow(256, ($bytewordlen - 1 - $i)); + $intvalue += ord($byteword[$i]) * pow(256, ($bytewordlen - 1 - $i)); } } if ($signed && !$synchsafe) { @@ -435,7 +435,7 @@ $binvalue = ''; $bytewordlen = strlen($byteword); for ($i = 0; $i < $bytewordlen; $i++) { - $binvalue .= str_pad(decbin(ord($byteword{$i})), 8, '0', STR_PAD_LEFT); + $binvalue .= str_pad(decbin(ord($byteword[$i])), 8, '0', STR_PAD_LEFT); } return $binvalue; } @@ -562,7 +562,7 @@ $data = str_replace(chr(0xFF).chr(0x00), chr(0xFF).chr(0x00).chr(0x00), $data); $unsyncheddata = ''; for ($i = 0; $i < strlen($data); $i++) { - $thischar = $data{$i}; + $thischar = $data[$i]; $unsyncheddata .= $thischar; if ($thischar == chr(255)) { $nextchar = ord(substr($data, $i + 1, 1)); @@ -677,8 +677,8 @@ $asciidata = substr($asciidata, 0, strlen($asciidata) - 2); // remove terminator, only if present (it should be, but...) } for ($i = 0; $i < strlen($asciidata); $i += 2) { - if ((ord($asciidata{$i}) <= 0x7F) || (ord($asciidata{$i}) >= 0xA0)) { - $tempstring .= $asciidata{$i}; + if ((ord($asciidata[$i]) <= 0x7F) || (ord($asciidata[$i]) >= 0xA0)) { + $tempstring .= $asciidata[$i]; } else { $tempstring .= '?'; } @@ -692,8 +692,8 @@ $asciidata = substr($asciidata, 0, strlen($asciidata) - 2); // remove terminator, only if present (it should be, but...) } for ($i = 0; $i < strlen($asciidata); $i += 2) { - if ((ord($asciidata{$i}) <= 0x7F) || (ord($asciidata{$i}) >= 0xA0)) { - $tempstring .= $asciidata{$i}; + if ((ord($asciidata[$i]) <= 0x7F) || (ord($asciidata[$i]) >= 0xA0)) { + $tempstring .= $asciidata[$i]; } else { $tempstring .= '?'; } @@ -711,8 +711,8 @@ $asciidata = substr($asciidata, 0, strlen($asciidata) - 2); // remove terminator, only if present (it should be, but...) } for ($i = 0; ($i + 1) < strlen($asciidata); $i += 2) { - if ((ord($asciidata{($i + 1)}) <= 0x7F) || (ord($asciidata{($i + 1)}) >= 0xA0)) { - $tempstring .= $asciidata{($i + 1)}; + if ((ord($asciidata[($i + 1)]) <= 0x7F) || (ord($asciidata[($i + 1)]) >= 0xA0)) { + $tempstring .= $asciidata[($i + 1)]; } else { $tempstring .= '?'; } @@ -782,8 +782,8 @@ if (trim($id3v1['genre']) != trim($id3v2['genre'])) { return false; } - if (isset($id3v1['track'])) { - if (!isset($id3v1['track']) || (trim($id3v1['track']) != trim($id3v2['track']))) { + if (isset($id3v1['track_number'])) { + if (!isset($id3v1['track_number']) || (trim($id3v1['track_number']) != trim($id3v2['track_number']))) { return false; } if (trim($id3v1['comment']) != trim(substr($id3v2['comment'], 0, 28))) { @@ -850,26 +850,26 @@ if (!function_exists('BytestringToGUID')) { function BytestringToGUID($Bytestring) { - $GUIDstring = str_pad(dechex(ord($Bytestring{3})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{2})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{1})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{0})), 2, '0', STR_PAD_LEFT); + $GUIDstring = str_pad(dechex(ord($Bytestring[3])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[2])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[1])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[0])), 2, '0', STR_PAD_LEFT); $GUIDstring .= '-'; - $GUIDstring .= str_pad(dechex(ord($Bytestring{5})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{4})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[5])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[4])), 2, '0', STR_PAD_LEFT); $GUIDstring .= '-'; - $GUIDstring .= str_pad(dechex(ord($Bytestring{7})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{6})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[7])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[6])), 2, '0', STR_PAD_LEFT); $GUIDstring .= '-'; - $GUIDstring .= str_pad(dechex(ord($Bytestring{8})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{9})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[8])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[9])), 2, '0', STR_PAD_LEFT); $GUIDstring .= '-'; - $GUIDstring .= str_pad(dechex(ord($Bytestring{10})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{11})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{12})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{13})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{14})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{15})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[10])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[11])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[12])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[13])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[14])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[15])), 2, '0', STR_PAD_LEFT); return strtoupper($GUIDstring); } @@ -940,17 +940,17 @@ $utf8length = strlen($utf8text); $decodedtext = ''; for ($i = 0; $i < $utf8length; $i++) { - if ((ord($utf8text{$i}) & 0x80) == 0) { - $decodedtext .= $utf8text{$i}; - } elseif ((ord($utf8text{$i}) & 0xF0) == 0xF0) { + if ((ord($utf8text[$i]) & 0x80) == 0) { + $decodedtext .= $utf8text[$i]; + } elseif ((ord($utf8text[$i]) & 0xF0) == 0xF0) { $decodedtext .= '?'; $i += 3; - } elseif ((ord($utf8text{$i}) & 0xE0) == 0xE0) { + } elseif ((ord($utf8text[$i]) & 0xE0) == 0xE0) { $decodedtext .= '?'; $i += 2; - } elseif ((ord($utf8text{$i}) & 0xC0) == 0xC0) { + } elseif ((ord($utf8text[$i]) & 0xC0) == 0xC0) { // 2 11 110bbbbb 10bbbbbb - $decodedchar = Bin2Dec(substr(Dec2Bin(ord($utf8text{$i})), 3, 5).substr(Dec2Bin(ord($utf8text{($i + 1)})), 2, 6)); + $decodedchar = Bin2Dec(substr(Dec2Bin(ord($utf8text[$i])), 3, 5).substr(Dec2Bin(ord($utf8text[($i + 1)])), 2, 6)); if ($decodedchar <= 255) { $decodedtext .= chr($decodedchar); } else { @@ -1068,7 +1068,7 @@ // $foo = array('path'=>array('to'=>'array('my'=>array('file.txt')))); // or // $foo['path']['to']['my'] = 'file.txt'; - while ($ArrayPath{0} == $Separator) { + while ($ArrayPath[0] == $Separator) { $ArrayPath = substr($ArrayPath, 1); } if (($pos = strpos($ArrayPath, $Separator)) !== false) { @@ -1080,23 +1080,6 @@ } } -if (!function_exists('md5_file')) { - // Allan Hansen - // md5_file() exists in PHP 4.2.0. - // The following works under UNIX only, but dies on windows - function md5_file($file) { - if (substr(php_uname(), 0, 7) == 'Windows') { - die('PHP 4.2.0 or newer required for md5_file()'); - } - - $file = str_replace('`', '\\`', $file); - if (preg_match("#^([0-9a-f]{32})[ \t\n\r]#i", `md5sum "$file"`, $r)) { - return $r[1]; - } - return false; - } -} - if (!function_exists('md5_data')) { // Allan Hansen // md5_data() - returns md5sum for a file from startuing position to absolute end position @@ -1916,7 +1899,7 @@ if ($ThisFileInfo['mpeg']['audio']['xing_flags']['toc']) { $LAMEtocData = substr($headerstring, $VBRidOffset + 16, 100); for ($i = 0; $i < 100; $i++) { - $ThisFileInfo['mpeg']['audio']['toc'][$i] = ord($LAMEtocData{$i}); + $ThisFileInfo['mpeg']['audio']['toc'][$i] = ord($LAMEtocData[$i]); } } if ($ThisFileInfo['mpeg']['audio']['xing_flags']['vbr_scale']) { @@ -2297,9 +2280,9 @@ $SyncPattern1 = substr($MPEGaudioData, 0, 4); // may be different pattern due to padding - $SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) | 0x02).$SyncPattern1{3}; + $SyncPattern2 = $SyncPattern1[0].$SyncPattern1[1].chr(ord($SyncPattern1[2]) | 0x02).$SyncPattern1[3]; if ($SyncPattern2 === $SyncPattern1) { - $SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) & 0xFD).$SyncPattern1{3}; + $SyncPattern2 = $SyncPattern1[0].$SyncPattern1[1].chr(ord($SyncPattern1[2]) & 0xFD).$SyncPattern1[3]; } $framelength = false; @@ -2435,7 +2418,7 @@ return false; } - if (($header{$SynchSeekOffset} == CONST_FF) && ($header{($SynchSeekOffset + 1)} > CONST_E0)) { // synch detected + if (($header[$SynchSeekOffset] == CONST_FF) && ($header[($SynchSeekOffset + 1)] > CONST_E0)) { // synch detected if (!isset($FirstFrameThisfileInfo) && !isset($ThisFileInfo['mpeg']['audio'])) { $FirstFrameThisfileInfo = $ThisFileInfo; @@ -2764,18 +2747,18 @@ } $MPEGrawHeader['synch'] = (BigEndian2Int(substr($Header4Bytes, 0, 2)) & 0xFFE0) >> 4; - $MPEGrawHeader['version'] = (ord($Header4Bytes{1}) & 0x18) >> 3; // BB - $MPEGrawHeader['layer'] = (ord($Header4Bytes{1}) & 0x06) >> 1; // CC - $MPEGrawHeader['protection'] = (ord($Header4Bytes{1}) & 0x01); // D - $MPEGrawHeader['bitrate'] = (ord($Header4Bytes{2}) & 0xF0) >> 4; // EEEE - $MPEGrawHeader['sample_rate'] = (ord($Header4Bytes{2}) & 0x0C) >> 2; // FF - $MPEGrawHeader['padding'] = (ord($Header4Bytes{2}) & 0x02) >> 1; // G - $MPEGrawHeader['private'] = (ord($Header4Bytes{2}) & 0x01); // H - $MPEGrawHeader['channelmode'] = (ord($Header4Bytes{3}) & 0xC0) >> 6; // II - $MPEGrawHeader['modeextension'] = (ord($Header4Bytes{3}) & 0x30) >> 4; // JJ - $MPEGrawHeader['copyright'] = (ord($Header4Bytes{3}) & 0x08) >> 3; // K - $MPEGrawHeader['original'] = (ord($Header4Bytes{3}) & 0x04) >> 2; // L - $MPEGrawHeader['emphasis'] = (ord($Header4Bytes{3}) & 0x03); // MM + $MPEGrawHeader['version'] = (ord($Header4Bytes[1]) & 0x18) >> 3; // BB + $MPEGrawHeader['layer'] = (ord($Header4Bytes[1]) & 0x06) >> 1; // CC + $MPEGrawHeader['protection'] = (ord($Header4Bytes[1]) & 0x01); // D + $MPEGrawHeader['bitrate'] = (ord($Header4Bytes[2]) & 0xF0) >> 4; // EEEE + $MPEGrawHeader['sample_rate'] = (ord($Header4Bytes[2]) & 0x0C) >> 2; // FF + $MPEGrawHeader['padding'] = (ord($Header4Bytes[2]) & 0x02) >> 1; // G + $MPEGrawHeader['private'] = (ord($Header4Bytes[2]) & 0x01); // H + $MPEGrawHeader['channelmode'] = (ord($Header4Bytes[3]) & 0xC0) >> 6; // II + $MPEGrawHeader['modeextension'] = (ord($Header4Bytes[3]) & 0x30) >> 4; // JJ + $MPEGrawHeader['copyright'] = (ord($Header4Bytes[3]) & 0x08) >> 3; // K + $MPEGrawHeader['original'] = (ord($Header4Bytes[3]) & 0x04) >> 2; // L + $MPEGrawHeader['emphasis'] = (ord($Header4Bytes[3]) & 0x03); // MM return $MPEGrawHeader; } diff -Nru php-getid3-1.9.17+dfsg/demos/demo.mysql.php php-getid3-1.9.18+dfsg/demos/demo.mysql.php --- php-getid3-1.9.17+dfsg/demos/demo.mysql.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/demos/demo.mysql.php 2019-09-16 19:08:47.000000000 +0000 @@ -480,8 +480,8 @@ } $this_track_track = ''; - if (!empty($ThisFileInfo['comments']['track'])) { - foreach ($ThisFileInfo['comments']['track'] as $key => $value) { + if (!empty($ThisFileInfo['comments']['track_number'])) { + foreach ($ThisFileInfo['comments']['track_number'] as $key => $value) { if (strlen($value) > strlen($this_track_track)) { $this_track_track = str_pad($value, 2, '0', STR_PAD_LEFT); } @@ -504,7 +504,7 @@ $ParenthesesPairs = array('()', '[]', '{}'); foreach ($ParenthesesPairs as $pair) { - if (preg_match_all('/(.*) '.preg_quote($pair{0}).'(([^'.preg_quote($pair).']*[\- '.preg_quote($pair{0}).'])?(cut|dub|edit|version|live|reprise|[a-z]*mix))'.preg_quote($pair{1}).'/iU', $this_track_title, $matches)) { + if (preg_match_all('/(.*) '.preg_quote($pair[0]).'(([^'.preg_quote($pair).']*[\- '.preg_quote($pair[0]).'])?(cut|dub|edit|version|live|reprise|[a-z]*mix))'.preg_quote($pair[1]).'/iU', $this_track_title, $matches)) { $this_track_title = $matches[1][0]; $this_track_remix = implode("\t", $matches[2]); } @@ -902,7 +902,7 @@ header('Content-type: audio/x-mpegurl'); echo '#EXTM3U'."\n"; while ($row = mysql_fetch_array($result)) { - if ((strlen($row['track']) > 0) && ($row['track'] < 1) || ($row['track'] > 99)) { + if ((strlen($row['track_number']) > 0) && ($row['track_number'] < 1) || ($row['track_number'] > 99)) { echo WindowsShareSlashTranslate($row['filename'])."\n"; } } @@ -915,12 +915,12 @@ echo ''; echo ''; while ($row = mysql_fetch_array($result)) { - if ((strlen($row['track']) > 0) && ($row['track'] < 1) || ($row['track'] > 99)) { + if ((strlen($row['track_number']) > 0) && ($row['track_number'] < 1) || ($row['track_number'] > 99)) { $TrackZeroCounter++; echo ''; echo ''; echo ''; - echo ''; + echo ''; echo ''; } } @@ -993,7 +993,7 @@ echo ''; echo ''; echo ''; - echo ''; + echo ''; echo ''; echo ''; } @@ -1018,7 +1018,7 @@ $NotOKfiles = 0; $Autofixedfiles = 0; - $FieldsToCompare = array('title', 'artist', 'album', 'year', 'genre', 'comment', 'track'); + $FieldsToCompare = array('title', 'artist', 'album', 'year', 'genre', 'comment', 'track_number'); $TagsToCompare = array('id3v2'=>false, 'ape'=>false, 'lyrics3'=>false, 'id3v1'=>false); $ID3v1FieldLengths = array('title'=>30, 'artist'=>30, 'album'=>30, 'year'=>4, 'genre'=>99, 'comment'=>28); if (strpos($_REQUEST['unsynchronizedtags'], '2') !== false) { @@ -1085,16 +1085,12 @@ } if (isset($Comments['ape']['tracknumber'])) { - $Comments['ape']['track'] = $Comments['ape']['tracknumber']; + $Comments['ape']['track_number'] = $Comments['ape']['tracknumber']; unset($Comments['ape']['tracknumber']); } - if (isset($Comments['ape']['track_number'])) { - $Comments['ape']['track'] = $Comments['ape']['track_number']; - unset($Comments['ape']['track_number']); - } - if (isset($Comments['id3v2']['track_number'])) { - $Comments['id3v2']['track'] = $Comments['id3v2']['track_number']; - unset($Comments['id3v2']['track_number']); + if (isset($Comments['ape']['track'])) { + $Comments['ape']['track_number'] = $Comments['ape']['track']; + unset($Comments['ape']['track']); } if (!empty($Comments['all']['track'])) { $besttrack = ''; @@ -1103,7 +1099,7 @@ $besttrack = $value; } } - $Comments['all']['track'] = array(0=>$besttrack); + $Comments['all']['track_number'] = array(0=>$besttrack); } $ThisLine = ''; @@ -1141,7 +1137,7 @@ $tagvalues .= $fieldname.' = '.(isset($Comments[$tagtype][$fieldname][0]) ? $Comments[$tagtype][$fieldname][0] : '')."\n"; } - } elseif ($fieldname == 'track') { + } elseif ($fieldname == 'track_number') { // intval('01/20') == intval('1') $trackA = (isset($Comments[$tagtype][$fieldname][0]) ? $Comments[$tagtype][$fieldname][0] : ''); @@ -1354,10 +1350,10 @@ set_time_limit(10); $PatternFilename = ''; for ($i = 0; $i < $PatternLength; $i++) { - if (isset($patterns[$Pattern{$i}])) { - $PatternFilename .= trim(strtr($row[$patterns[$Pattern{$i}]], ':\\*<>|', ';-¤«»¦'), ' '); + if (isset($patterns[$Pattern[$i]])) { + $PatternFilename .= trim(strtr($row[$patterns[$Pattern[$i]]], ':\\*<>|', ';-¤«»¦'), ' '); } else { - $PatternFilename .= $Pattern{$i}; + $PatternFilename .= $Pattern[$i]; } } @@ -1381,15 +1377,15 @@ // multiple remixes are stored tab-seperated in the database. // change "{2000 Version\tSomebody Remix}" into "{2000 Version} {Somebody Remix}" - while (preg_match('#^(.*)'.preg_quote($pair{0}).'([^'.preg_quote($pair{1}).']*)('."\t".')([^'.preg_quote($pair{0}).']*)'.preg_quote($pair{1}).'#', $PatternFilename, $matches)) { - $PatternFilename = $matches[1].$pair{0}.$matches[2].$pair{1}.' '.$pair{0}.$matches[4].$pair{1}; + while (preg_match('#^(.*)'.preg_quote($pair[0]).'([^'.preg_quote($pair[1]).']*)('."\t".')([^'.preg_quote($pair[0]).']*)'.preg_quote($pair[1]).'#', $PatternFilename, $matches)) { + $PatternFilename = $matches[1].$pair[0].$matches[2].$pair[1].' '.$pair[0].$matches[4].$pair[1]; } // remove empty parenthesized pairs (probably where no track numbers, remix version, etc) $PatternFilename = preg_replace('#'.preg_quote($pair).'#', '', $PatternFilename); // "[01] - Title With No Artist.mp3" ==> "[01] Title With No Artist.mp3" - $PatternFilename = preg_replace('#'.preg_quote($pair{1}).' +\- #', $pair{1}.' ', $PatternFilename); + $PatternFilename = preg_replace('#'.preg_quote($pair[1]).' +\- #', $pair[1].' ', $PatternFilename); } @@ -1423,7 +1419,7 @@ } else { $ShortestNameLength = min(strlen($ActualFilenameNoExt), strlen($PatternFilenameNoExt)); for ($DifferenceOffset = 0; $DifferenceOffset < $ShortestNameLength; $DifferenceOffset++) { - if ($ActualFilenameNoExt{$DifferenceOffset} !== $PatternFilenameNoExt{$DifferenceOffset}) { + if ($ActualFilenameNoExt[$DifferenceOffset] !== $PatternFilenameNoExt[$DifferenceOffset]) { break; } } @@ -2097,15 +2093,15 @@ function BetterUCwords($string) { $stringlength = strlen($string); - $string{0} = strtoupper($string{0}); + $string[0] = strtoupper($string[0]); for ($i = 1; $i < $stringlength; $i++) { - if (($string{$i - 1} == '\'') && ($i > 1) && (($string{$i - 2} == 'O') || ($string{$i - 2} == ' '))) { + if (($string[$i - 1] == '\'') && ($i > 1) && (($string[$i - 2] == 'O') || ($string[$i - 2] == ' '))) { // O'Clock, 'Em - $string{$i} = strtoupper($string{$i}); - } elseif (preg_match('#^[\'A-Za-z0-9À-ÿ]$#', $string{$i - 1})) { - $string{$i} = strtolower($string{$i}); + $string[$i] = strtoupper($string[$i]); + } elseif (preg_match('#^[\'A-Za-z0-9À-ÿ]$#', $string[$i - 1])) { + $string[$i] = strtolower($string[$i]); } else { - $string{$i} = strtoupper($string{$i}); + $string[$i] = strtoupper($string[$i]); } } @@ -2120,9 +2116,9 @@ } elseif (in_array(strtoupper(str_replace('(', '', $ThisWord)), $UpperCaseWords)) { $ThisWord = strtoupper($ThisWord); } elseif ((substr($ThisWord, 0, 2) == 'Mc') && (strlen($ThisWord) > 2)) { - $ThisWord{2} = strtoupper($ThisWord{2}); + $ThisWord[2] = strtoupper($ThisWord[2]); } elseif ((substr($ThisWord, 0, 3) == 'Mac') && (strlen($ThisWord) > 3)) { - $ThisWord{3} = strtoupper($ThisWord{3}); + $ThisWord[3] = strtoupper($ThisWord[3]); } $OutputListOfWords[] = $ThisWord; } diff -Nru php-getid3-1.9.17+dfsg/demos/demo.simple.write.php php-getid3-1.9.18+dfsg/demos/demo.simple.write.php --- php-getid3-1.9.17+dfsg/demos/demo.simple.write.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/demos/demo.simple.write.php 2019-09-16 19:08:47.000000000 +0000 @@ -44,7 +44,7 @@ 'year' => array('2004'), 'genre' => array('Rock'), 'comment' => array('excellent!'), - 'track' => array('04/16'), + 'track_number' => array('04/16'), 'popularimeter' => array('email'=>'user@example.net', 'rating'=>128, 'data'=>0), 'unique_file_identifier' => array('ownerid'=>'user@example.net', 'data'=>md5(time())), ); diff -Nru php-getid3-1.9.17+dfsg/demos/demo.write.php php-getid3-1.9.18+dfsg/demos/demo.write.php --- php-getid3-1.9.17+dfsg/demos/demo.write.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/demos/demo.write.php 2019-09-16 19:08:47.000000000 +0000 @@ -62,7 +62,7 @@ $TagData['genre'][] = $_POST['GenreOther']; } if (!empty($_POST['Track'])) { - $TagData['track'][] = $_POST['Track'].(!empty($_POST['TracksTotal']) ? '/'.$_POST['TracksTotal'] : ''); + $TagData['track_number'][] = $_POST['Track'].(!empty($_POST['TracksTotal']) ? '/'.$_POST['TracksTotal'] : ''); } if (!empty($_FILES['userfile']['tmp_name'])) { @@ -167,8 +167,8 @@ $TrackNumber = ''; if (!empty($OldThisFileInfo['comments']['track_number']) && is_array($OldThisFileInfo['comments']['track_number'])) { $RawTrackNumberArray = $OldThisFileInfo['comments']['track_number']; - } elseif (!empty($OldThisFileInfo['comments']['track']) && is_array($OldThisFileInfo['comments']['track'])) { - $RawTrackNumberArray = $OldThisFileInfo['comments']['track']; + } elseif (!empty($OldThisFileInfo['comments']['track_number']) && is_array($OldThisFileInfo['comments']['track_number'])) { + $RawTrackNumberArray = $OldThisFileInfo['comments']['track_number']; } else { $RawTrackNumberArray = array(); } diff -Nru php-getid3-1.9.17+dfsg/.editorconfig php-getid3-1.9.18+dfsg/.editorconfig --- php-getid3-1.9.17+dfsg/.editorconfig 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/.editorconfig 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -; top-most EditorConfig file -root = true - -; Unix-style newlines -[*] -end_of_line = LF - -[*.php] -indent_style = tab diff -Nru php-getid3-1.9.17+dfsg/getid3/extension.cache.mysqli.php php-getid3-1.9.18+dfsg/getid3/extension.cache.mysqli.php --- php-getid3-1.9.17+dfsg/getid3/extension.cache.mysqli.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/extension.cache.mysqli.php 2019-09-16 19:08:47.000000000 +0000 @@ -87,6 +87,11 @@ */ private $table; + /** + * @var bool + */ + private $db_structure_check; + /** * constructor - see top of this file for cache type and cache_options @@ -124,14 +129,15 @@ // Create cache table if not exists $this->create_table(); + $this->db_structure_check = true; // set to false if you know your table structure has already been migrated to use `hash` as the primary key to avoid + $this->migrate_db_structure(); + // Check version number and clear cache if changed $version = ''; $SQLquery = 'SELECT `value`'; $SQLquery .= ' FROM `'.$this->mysqli->real_escape_string($this->table).'`'; $SQLquery .= ' WHERE (`filename` = \''.$this->mysqli->real_escape_string(getID3::VERSION).'\')'; - $SQLquery .= ' AND (`filesize` = -1)'; - $SQLquery .= ' AND (`filetime` = -1)'; - $SQLquery .= ' AND (`analyzetime` = -1)'; + $SQLquery .= ' AND (`hash` = \'getID3::VERSION\')'; if ($this->cursor = $this->mysqli->query($SQLquery)) { list($version) = $this->cursor->fetch_array(); } @@ -147,8 +153,39 @@ * clear cache */ public function clear_cache() { - $this->mysqli->query('DELETE FROM `'.$this->mysqli->real_escape_string($this->table).'`'); - $this->mysqli->query('INSERT INTO `'.$this->mysqli->real_escape_string($this->table).'` (`filename`, `filesize`, `filetime`, `analyzetime`, `value`) VALUES (\''.getID3::VERSION.'\', -1, -1, -1, \''.getID3::VERSION.'\')'); + $this->mysqli->query('TRUNCATE TABLE `'.$this->mysqli->real_escape_string($this->table).'`'); + $this->mysqli->query('INSERT INTO `'.$this->mysqli->real_escape_string($this->table).'` (`hash`, `filename`, `filesize`, `filetime`, `analyzetime`, `value`) VALUES (\'getID3::VERSION\', \''.getID3::VERSION.'\', -1, -1, -1, \''.getID3::VERSION.'\')'); + } + + + /** + * migrate database structure if needed + */ + public function migrate_db_structure() { + // Check for table structure + if ($this->db_structure_check) { + $SQLquery = 'SHOW COLUMNS'; + $SQLquery .= ' FROM `'.$this->mysqli->real_escape_string($this->table).'`'; + $SQLquery .= ' LIKE \'hash\''; + $this->cursor = $this->mysqli->query($SQLquery); + if ($this->cursor->num_rows == 0) { + // table has not been migrated, add column, add hashes, change index + $SQLquery = 'ALTER TABLE `getid3_cache` DROP PRIMARY KEY, ADD `hash` CHAR(32) NOT NULL DEFAULT \'\' FIRST, ADD PRIMARY KEY(`hash`)'; + $this->mysqli->query($SQLquery); + + $SQLquery = 'UPDATE `getid3_cache` SET'; + $SQLquery .= ' `hash` = MD5(`filename`, `filesize`, `filetime`)'; + $SQLquery .= ' WHERE (`filesize` > -1)'; + $this->mysqli->query($SQLquery); + + $SQLquery = 'UPDATE `getid3_cache` SET'; + $SQLquery .= ' `hash` = \'getID3::VERSION\''; + $SQLquery .= ' WHERE (`filesize` = -1)'; + $SQLquery .= ' AND (`filetime` = -1)'; + $SQLquery .= ' AND (`filetime` = -1)'; + $this->mysqli->query($SQLquery); + } + } } @@ -173,9 +210,7 @@ // Lookup file $SQLquery = 'SELECT `value`'; $SQLquery .= ' FROM `'.$this->mysqli->real_escape_string($this->table).'`'; - $SQLquery .= ' WHERE (`filename` = \''.$this->mysqli->real_escape_string($filename).'\')'; - $SQLquery .= ' AND (`filesize` = \''.$this->mysqli->real_escape_string($filesize).'\')'; - $SQLquery .= ' AND (`filetime` = \''.$this->mysqli->real_escape_string($filetime).'\')'; + $SQLquery .= ' WHERE (`hash` = \''.$this->mysqli->real_escape_string(md5($filename.$filesize.$filetime)).'\')'; $this->cursor = $this->mysqli->query($SQLquery); if ($this->cursor->num_rows > 0) { // Hit @@ -189,12 +224,14 @@ // Save result if (file_exists($filename)) { - $SQLquery = 'INSERT INTO `'.$this->mysqli->real_escape_string($this->table).'` (`filename`, `filesize`, `filetime`, `analyzetime`, `value`) VALUES ('; - $SQLquery .= '\''.$this->mysqli->real_escape_string($filename).'\''; + $SQLquery = 'INSERT INTO `'.$this->mysqli->real_escape_string($this->table).'` (`hash`, `filename`, `filesize`, `filetime`, `analyzetime`, `value`) VALUES ('; + $SQLquery .= '\''.$this->mysqli->real_escape_string(md5($filename.$filesize.$filetime)).'\''; + $SQLquery .= ', \''.$this->mysqli->real_escape_string($filename).'\''; $SQLquery .= ', \''.$this->mysqli->real_escape_string($filesize).'\''; $SQLquery .= ', \''.$this->mysqli->real_escape_string($filetime).'\''; - $SQLquery .= ', \''.$this->mysqli->real_escape_string(time() ).'\''; - $SQLquery .= ', \''.$this->mysqli->real_escape_string(base64_encode(serialize($analysis))).'\')'; + $SQLquery .= ', UNIX_TIMESTAMP()'; + $SQLquery .= ', \''.$this->mysqli->real_escape_string(base64_encode(serialize($analysis))).'\''; + $SQLquery .= ')'; $this->cursor = $this->mysqli->query($SQLquery); } return $analysis; @@ -207,13 +244,18 @@ * @param bool $drop */ private function create_table($drop=false) { + if ($drop) { + $SQLquery = 'DROP TABLE IF EXISTS `'.$this->mysqli->real_escape_string($this->table).'`'; + $this->mysqli->query($SQLquery); + } $SQLquery = 'CREATE TABLE IF NOT EXISTS `'.$this->mysqli->real_escape_string($this->table).'` ('; - $SQLquery .= '`filename` VARCHAR(990) NOT NULL DEFAULT \'\''; + $SQLquery .= '`hash` CHAR(32) NOT NULL DEFAULT \'\''; + $SQLquery .= ', `filename` VARCHAR(1000) NOT NULL DEFAULT \'\''; $SQLquery .= ', `filesize` INT(11) NOT NULL DEFAULT \'0\''; $SQLquery .= ', `filetime` INT(11) NOT NULL DEFAULT \'0\''; $SQLquery .= ', `analyzetime` INT(11) NOT NULL DEFAULT \'0\''; $SQLquery .= ', `value` LONGTEXT NOT NULL'; - $SQLquery .= ', PRIMARY KEY (`filename`, `filesize`, `filetime`))'; + $SQLquery .= ', PRIMARY KEY (`hash`))'; $this->cursor = $this->mysqli->query($SQLquery); echo $this->mysqli->error; } diff -Nru php-getid3-1.9.17+dfsg/getid3/getid3.lib.php php-getid3-1.9.18+dfsg/getid3/getid3.lib.php --- php-getid3-1.9.17+dfsg/getid3/getid3.lib.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/getid3.lib.php 2019-09-16 19:08:47.000000000 +0000 @@ -26,9 +26,9 @@ $returnstring = ''; for ($i = 0; $i < strlen($string); $i++) { if ($hex) { - $returnstring .= str_pad(dechex(ord($string{$i})), 2, '0', STR_PAD_LEFT); + $returnstring .= str_pad(dechex(ord($string[$i])), 2, '0', STR_PAD_LEFT); } else { - $returnstring .= ' '.(preg_match("#[\x20-\x7E]#", $string{$i}) ? $string{$i} : '¤'); + $returnstring .= ' '.(preg_match("#[\x20-\x7E]#", $string[$i]) ? $string[$i] : '¤'); } if ($spaces) { $returnstring .= ' '; @@ -152,11 +152,11 @@ public static function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) { if (strpos($binarypointnumber, '.') === false) { $binarypointnumber = '0.'.$binarypointnumber; - } elseif ($binarypointnumber{0} == '.') { + } elseif ($binarypointnumber[0] == '.') { $binarypointnumber = '0'.$binarypointnumber; } $exponent = 0; - while (($binarypointnumber{0} != '1') || (substr($binarypointnumber, 1, 1) != '.')) { + while (($binarypointnumber[0] != '1') || (substr($binarypointnumber, 1, 1) != '.')) { if (substr($binarypointnumber, 1, 1) == '.') { $exponent--; $binarypointnumber = substr($binarypointnumber, 2, 1).'.'.substr($binarypointnumber, 3); @@ -164,7 +164,7 @@ $pointpos = strpos($binarypointnumber, '.'); $exponent += ($pointpos - 1); $binarypointnumber = str_replace('.', '', $binarypointnumber); - $binarypointnumber = $binarypointnumber{0}.'.'.substr($binarypointnumber, 1); + $binarypointnumber = $binarypointnumber[0].'.'.substr($binarypointnumber, 1); } } $binarypointnumber = str_pad(substr($binarypointnumber, 0, $maxbits + 2), $maxbits + 2, '0', STR_PAD_RIGHT); @@ -255,7 +255,7 @@ if (!$bitword) { return 0; } - $signbit = $bitword{0}; + $signbit = $bitword[0]; $floatvalue = 0; $exponentbits = 0; $fractionbits = 0; @@ -275,7 +275,7 @@ // 80-bit Apple SANE format // http://www.mactech.com/articles/mactech/Vol.06/06.01/SANENormalized/ $exponentstring = substr($bitword, 1, 15); - $isnormalized = intval($bitword{16}); + $isnormalized = intval($bitword[16]); $fractionstring = substr($bitword, 17, 63); $exponent = pow(2, self::Bin2Dec($exponentstring) - 16383); $fraction = $isnormalized + self::DecimalBinary2Float($fractionstring); @@ -343,9 +343,9 @@ for ($i = 0; $i < $bytewordlen; $i++) { if ($synchsafe) { // disregard MSB, effectively 7-bit bytes //$intvalue = $intvalue | (ord($byteword{$i}) & 0x7F) << (($bytewordlen - 1 - $i) * 7); // faster, but runs into problems past 2^31 on 32-bit systems - $intvalue += (ord($byteword{$i}) & 0x7F) * pow(2, ($bytewordlen - 1 - $i) * 7); + $intvalue += (ord($byteword[$i]) & 0x7F) * pow(2, ($bytewordlen - 1 - $i) * 7); } else { - $intvalue += ord($byteword{$i}) * pow(256, ($bytewordlen - 1 - $i)); + $intvalue += ord($byteword[$i]) * pow(256, ($bytewordlen - 1 - $i)); } } if ($signed && !$synchsafe) { @@ -390,7 +390,7 @@ $binvalue = ''; $bytewordlen = strlen($byteword); for ($i = 0; $i < $bytewordlen; $i++) { - $binvalue .= str_pad(decbin(ord($byteword{$i})), 8, '0', STR_PAD_LEFT); + $binvalue .= str_pad(decbin(ord($byteword[$i])), 8, '0', STR_PAD_LEFT); } return $binvalue; } @@ -451,7 +451,7 @@ public static function Bin2Dec($binstring, $signed=false) { $signmult = 1; if ($signed) { - if ($binstring{0} == '1') { + if ($binstring[0] == '1') { $signmult = -1; } $binstring = substr($binstring, 1); @@ -751,9 +751,7 @@ } /** - * self::md5_data() - returns md5sum for a file from startuing position to absolute end position - * - * @author Allan Hansen + * Returns checksum for a file from starting position to absolute end position. * * @param string $file * @param int $offset @@ -761,97 +759,30 @@ * @param string $algorithm * * @return string|false - * @throws Exception * @throws getid3_exception */ public static function hash_data($file, $offset, $end, $algorithm) { - static $tempdir = ''; - $windows_call = null; - $unix_call = null; - $hash_length = null; - $hash_function = null; if (!self::intValueSupported($end)) { return false; } - switch ($algorithm) { - case 'md5': - $hash_function = 'md5_file'; - $unix_call = 'md5sum'; - $windows_call = 'md5sum.exe'; - $hash_length = 32; - break; - - case 'sha1': - $hash_function = 'sha1_file'; - $unix_call = 'sha1sum'; - $windows_call = 'sha1sum.exe'; - $hash_length = 40; - break; - - default: - throw new Exception('Invalid algorithm ('.$algorithm.') in self::hash_data()'); - break; + if (!in_array($algorithm, array('md5', 'sha1'))) { + throw new getid3_exception('Invalid algorithm ('.$algorithm.') in self::hash_data()'); } - $size = $end - $offset; - while (true) { - if (GETID3_OS_ISWINDOWS) { - - // It seems that sha1sum.exe for Windows only works on physical files, does not accept piped data - // Fall back to create-temp-file method: - if ($algorithm == 'sha1') { - break; - } - - $RequiredFiles = array('cygwin1.dll', 'head.exe', 'tail.exe', $windows_call); - foreach ($RequiredFiles as $required_file) { - if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) { - // helper apps not available - fall back to old method - break 2; - } - } - $commandline = GETID3_HELPERAPPSDIR.'head.exe -c '.$end.' '.escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $file)).' | '; - $commandline .= GETID3_HELPERAPPSDIR.'tail.exe -c '.$size.' | '; - $commandline .= GETID3_HELPERAPPSDIR.$windows_call; - - } else { - $commandline = 'head -c'.$end.' '.escapeshellarg($file).' | '; - $commandline .= 'tail -c'.$size.' | '; - $commandline .= $unix_call; - - } - if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) { - //throw new Exception('PHP running in Safe Mode - backtick operator not available, using slower non-system-call '.$algorithm.' algorithm'); - break; - } - return substr(`$commandline`, 0, $hash_length); - } + $size = $end - $offset; - if (empty($tempdir)) { - // yes this is ugly, feel free to suggest a better way - require_once(dirname(__FILE__).'/getid3.php'); - $getid3_temp = new getID3(); - $tempdir = $getid3_temp->tempdir; - unset($getid3_temp); - } - // try to create a temporary file in the system temp directory - invalid dirname should force to system temp dir - if (($data_filename = tempnam($tempdir, 'gI3')) === false) { - // can't find anywhere to create a temp file, just fail - return false; + $fp = fopen($file, 'rb'); + fseek($fp, $offset); + $ctx = hash_init($algorithm); + while ($size > 0) { + $buffer = fread($fp, min($size, getID3::FREAD_BUFFER_SIZE)); + hash_update($ctx, $buffer); + $size -= getID3::FREAD_BUFFER_SIZE; } + $hash = hash_final($ctx); + fclose($fp); - // Init - $result = false; - - // copy parts of file - try { - self::CopyFileParts($file, $data_filename, $offset, $end - $offset); - $result = $hash_function($data_filename); - } catch (Exception $e) { - throw new Exception('self::CopyFileParts() failed in getid_lib::hash_data(): '.$e->getMessage()); - } - unlink($data_filename); - return $result; + return $hash; } /** @@ -862,6 +793,8 @@ * * @return bool * @throws Exception + * + * @deprecated Unused, may be removed in future versions of getID3 */ public static function CopyFileParts($filename_source, $filename_dest, $offset, $length) { if (!self::intValueSupported($offset + $length)) { @@ -935,7 +868,7 @@ $newcharstring .= "\xEF\xBB\xBF"; } for ($i = 0; $i < strlen($string); $i++) { - $charval = ord($string{$i}); + $charval = ord($string[$i]); $newcharstring .= self::iconv_fallback_int_utf8($charval); } return $newcharstring; @@ -955,7 +888,7 @@ $newcharstring .= "\xFE\xFF"; } for ($i = 0; $i < strlen($string); $i++) { - $newcharstring .= "\x00".$string{$i}; + $newcharstring .= "\x00".$string[$i]; } return $newcharstring; } @@ -974,7 +907,7 @@ $newcharstring .= "\xFF\xFE"; } for ($i = 0; $i < strlen($string); $i++) { - $newcharstring .= $string{$i}."\x00"; + $newcharstring .= $string[$i]."\x00"; } return $newcharstring; } @@ -1006,27 +939,27 @@ $offset = 0; $stringlength = strlen($string); while ($offset < $stringlength) { - if ((ord($string{$offset}) | 0x07) == 0xF7) { + if ((ord($string[$offset]) | 0x07) == 0xF7) { // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & - ((ord($string{($offset + 1)}) & 0x3F) << 12) & - ((ord($string{($offset + 2)}) & 0x3F) << 6) & - (ord($string{($offset + 3)}) & 0x3F); + $charval = ((ord($string[($offset + 0)]) & 0x07) << 18) & + ((ord($string[($offset + 1)]) & 0x3F) << 12) & + ((ord($string[($offset + 2)]) & 0x3F) << 6) & + (ord($string[($offset + 3)]) & 0x3F); $offset += 4; - } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { + } elseif ((ord($string[$offset]) | 0x0F) == 0xEF) { // 1110bbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & - ((ord($string{($offset + 1)}) & 0x3F) << 6) & - (ord($string{($offset + 2)}) & 0x3F); + $charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) & + ((ord($string[($offset + 1)]) & 0x3F) << 6) & + (ord($string[($offset + 2)]) & 0x3F); $offset += 3; - } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) { + } elseif ((ord($string[$offset]) | 0x1F) == 0xDF) { // 110bbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & - (ord($string{($offset + 1)}) & 0x3F); + $charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) & + (ord($string[($offset + 1)]) & 0x3F); $offset += 2; - } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { + } elseif ((ord($string[$offset]) | 0x7F) == 0x7F) { // 0bbbbbbb - $charval = ord($string{$offset}); + $charval = ord($string[$offset]); $offset += 1; } else { // error? throw some kind of warning here? @@ -1056,27 +989,27 @@ $offset = 0; $stringlength = strlen($string); while ($offset < $stringlength) { - if ((ord($string{$offset}) | 0x07) == 0xF7) { + if ((ord($string[$offset]) | 0x07) == 0xF7) { // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & - ((ord($string{($offset + 1)}) & 0x3F) << 12) & - ((ord($string{($offset + 2)}) & 0x3F) << 6) & - (ord($string{($offset + 3)}) & 0x3F); + $charval = ((ord($string[($offset + 0)]) & 0x07) << 18) & + ((ord($string[($offset + 1)]) & 0x3F) << 12) & + ((ord($string[($offset + 2)]) & 0x3F) << 6) & + (ord($string[($offset + 3)]) & 0x3F); $offset += 4; - } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { + } elseif ((ord($string[$offset]) | 0x0F) == 0xEF) { // 1110bbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & - ((ord($string{($offset + 1)}) & 0x3F) << 6) & - (ord($string{($offset + 2)}) & 0x3F); + $charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) & + ((ord($string[($offset + 1)]) & 0x3F) << 6) & + (ord($string[($offset + 2)]) & 0x3F); $offset += 3; - } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) { + } elseif ((ord($string[$offset]) | 0x1F) == 0xDF) { // 110bbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & - (ord($string{($offset + 1)}) & 0x3F); + $charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) & + (ord($string[($offset + 1)]) & 0x3F); $offset += 2; - } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { + } elseif ((ord($string[$offset]) | 0x7F) == 0x7F) { // 0bbbbbbb - $charval = ord($string{$offset}); + $charval = ord($string[$offset]); $offset += 1; } else { // error? throw some kind of warning here? @@ -1106,27 +1039,27 @@ $offset = 0; $stringlength = strlen($string); while ($offset < $stringlength) { - if ((ord($string{$offset}) | 0x07) == 0xF7) { + if ((ord($string[$offset]) | 0x07) == 0xF7) { // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & - ((ord($string{($offset + 1)}) & 0x3F) << 12) & - ((ord($string{($offset + 2)}) & 0x3F) << 6) & - (ord($string{($offset + 3)}) & 0x3F); + $charval = ((ord($string[($offset + 0)]) & 0x07) << 18) & + ((ord($string[($offset + 1)]) & 0x3F) << 12) & + ((ord($string[($offset + 2)]) & 0x3F) << 6) & + (ord($string[($offset + 3)]) & 0x3F); $offset += 4; - } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { + } elseif ((ord($string[$offset]) | 0x0F) == 0xEF) { // 1110bbbb 10bbbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & - ((ord($string{($offset + 1)}) & 0x3F) << 6) & - (ord($string{($offset + 2)}) & 0x3F); + $charval = ((ord($string[($offset + 0)]) & 0x0F) << 12) & + ((ord($string[($offset + 1)]) & 0x3F) << 6) & + (ord($string[($offset + 2)]) & 0x3F); $offset += 3; - } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) { + } elseif ((ord($string[$offset]) | 0x1F) == 0xDF) { // 110bbbbb 10bbbbbb - $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & - (ord($string{($offset + 1)}) & 0x3F); + $charval = ((ord($string[($offset + 0)]) & 0x1F) << 6) & + (ord($string[($offset + 1)]) & 0x3F); $offset += 2; - } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { + } elseif ((ord($string[$offset]) | 0x7F) == 0x7F) { // 0bbbbbbb - $charval = ord($string{$offset}); + $charval = ord($string[$offset]); $offset += 1; } else { // error? maybe throw some warning here? @@ -1281,6 +1214,16 @@ // mb_convert_encoding() available if (function_exists('mb_convert_encoding')) { + if ((strtoupper($in_charset) == 'UTF-16') && (substr($string, 0, 2) != "\xFE\xFF") && (substr($string, 0, 2) != "\xFF\xFE")) { + // if BOM missing, mb_convert_encoding will mishandle the conversion, assume UTF-16BE and prepend appropriate BOM + $string = "\xFF\xFE".$string; + } + if ((strtoupper($in_charset) == 'UTF-16') && (strtoupper($out_charset) == 'UTF-8')) { + if (($string == "\xFF\xFE") || ($string == "\xFE\xFF")) { + // if string consists of only BOM, mb_convert_encoding will return the BOM unmodified + return ''; + } + } if ($converted_string = @mb_convert_encoding($string, $out_charset, $in_charset)) { switch ($out_charset) { case 'ISO-8859-1': @@ -1290,9 +1233,9 @@ return $converted_string; } return $string; - } + // iconv() available - else if (function_exists('iconv')) { + } elseif (function_exists('iconv')) { if ($converted_string = @iconv($in_charset, $out_charset.'//TRANSLIT', $string)) { switch ($out_charset) { case 'ISO-8859-1': @@ -1397,22 +1340,22 @@ case 'utf-8': $strlen = strlen($string); for ($i = 0; $i < $strlen; $i++) { - $char_ord_val = ord($string{$i}); + $char_ord_val = ord($string[$i]); $charval = 0; if ($char_ord_val < 0x80) { $charval = $char_ord_val; } elseif ((($char_ord_val & 0xF0) >> 4) == 0x0F && $i+3 < $strlen) { $charval = (($char_ord_val & 0x07) << 18); - $charval += ((ord($string{++$i}) & 0x3F) << 12); - $charval += ((ord($string{++$i}) & 0x3F) << 6); - $charval += (ord($string{++$i}) & 0x3F); + $charval += ((ord($string[++$i]) & 0x3F) << 12); + $charval += ((ord($string[++$i]) & 0x3F) << 6); + $charval += (ord($string[++$i]) & 0x3F); } elseif ((($char_ord_val & 0xE0) >> 5) == 0x07 && $i+2 < $strlen) { $charval = (($char_ord_val & 0x0F) << 12); - $charval += ((ord($string{++$i}) & 0x3F) << 6); - $charval += (ord($string{++$i}) & 0x3F); + $charval += ((ord($string[++$i]) & 0x3F) << 6); + $charval += (ord($string[++$i]) & 0x3F); } elseif ((($char_ord_val & 0xC0) >> 6) == 0x03 && $i+1 < $strlen) { $charval = (($char_ord_val & 0x1F) << 6); - $charval += (ord($string{++$i}) & 0x3F); + $charval += (ord($string[++$i]) & 0x3F); } if (($charval >= 32) && ($charval <= 127)) { $HTMLstring .= htmlentities(chr($charval)); diff -Nru php-getid3-1.9.17+dfsg/getid3/getid3.php php-getid3-1.9.18+dfsg/getid3/getid3.php --- php-getid3-1.9.17+dfsg/getid3/getid3.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/getid3.php 2019-09-16 19:08:47.000000000 +0000 @@ -250,7 +250,7 @@ */ protected $startup_warning = ''; - const VERSION = '1.9.17-201902071234'; + const VERSION = '1.9.18-201907240906'; const FREAD_BUFFER_SIZE = 32768; const ATTACHMENTS_NONE = false; @@ -320,7 +320,7 @@ // Needed for Windows only: // Define locations of helper applications for Shorten, VorbisComment, MetaFLAC - // as well as other helper functions such as head, tail, md5sum, etc + // as well as other helper functions such as head, etc // This path cannot contain spaces, but the below code will attempt to get the // 8.3-equivalent path automatically // IMPORTANT: This path must include the trailing slash @@ -551,8 +551,8 @@ $header = fread($this->fp, 10); if ((substr($header, 0, 3) == 'ID3') && (strlen($header) == 10)) { $this->info['id3v2']['header'] = true; - $this->info['id3v2']['majorversion'] = ord($header{3}); - $this->info['id3v2']['minorversion'] = ord($header{4}); + $this->info['id3v2']['majorversion'] = ord($header[3]); + $this->info['id3v2']['minorversion'] = ord($header[4]); $this->info['avdataoffset'] += getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length } } @@ -834,7 +834,7 @@ // DSS - audio - Digital Speech Standard 'dss' => array( - 'pattern' => '^[\\x02-\\x06]ds[s2]', + 'pattern' => '^[\\x02-\\x08]ds[s2]', 'group' => 'audio', 'module' => 'dss', 'mime_type' => 'application/octet-stream', diff -Nru php-getid3-1.9.17+dfsg/getid3/module.archive.tar.php php-getid3-1.9.18+dfsg/getid3/module.archive.tar.php --- php-getid3-1.9.17+dfsg/getid3/module.archive.tar.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.archive.tar.php 2019-09-16 19:08:47.000000000 +0000 @@ -44,13 +44,13 @@ // check the block $checksum = 0; for ($i = 0; $i < 148; $i++) { - $checksum += ord($buffer{$i}); + $checksum += ord($buffer[$i]); } for ($i = 148; $i < 156; $i++) { $checksum += ord(' '); } for ($i = 156; $i < 512; $i++) { - $checksum += ord($buffer{$i}); + $checksum += ord($buffer[$i]); } $attr = unpack($unpack_header, $buffer); $name = (isset($attr['fname'] ) ? trim($attr['fname'] ) : ''); diff -Nru php-getid3-1.9.17+dfsg/getid3/module.audio.ac3.php php-getid3-1.9.18+dfsg/getid3/module.audio.ac3.php --- php-getid3-1.9.17+dfsg/getid3/module.audio.ac3.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.audio.ac3.php 2019-09-16 19:08:47.000000000 +0000 @@ -687,7 +687,7 @@ // -8 -42.14 dB $fourbit = str_pad(decbin(($compre & 0xF0) >> 4), 4, '0', STR_PAD_LEFT); - if ($fourbit{0} == '1') { + if ($fourbit[0] == '1') { $log_gain = -8 + bindec(substr($fourbit, 1)); } else { $log_gain = bindec(substr($fourbit, 1)); @@ -758,11 +758,13 @@ 18 => array(2560, 2786, 3840) // 640 kbps ); } + $paddingBytes = 0; if (($fscod == 1) && $padding) { // frame lengths are padded by 1 word (16 bits) at 44100 - $frameSizeLookup[$frmsizecod] += 2; + // (fscode==1) means 44100Hz (see sampleRateCodeLookup) + $paddingBytes = 2; } - return (isset($frameSizeLookup[$framesizeid][$fscod]) ? $frameSizeLookup[$framesizeid][$fscod] : false); + return (isset($frameSizeLookup[$framesizeid][$fscod]) ? $frameSizeLookup[$framesizeid][$fscod] + $paddingBytes : false); } /** diff -Nru php-getid3-1.9.17+dfsg/getid3/module.audio.bonk.php php-getid3-1.9.18+dfsg/getid3/module.audio.bonk.php --- php-getid3-1.9.17+dfsg/getid3/module.audio.bonk.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.audio.bonk.php 2019-09-16 19:08:47.000000000 +0000 @@ -44,7 +44,7 @@ $this->fseek(0 - $BonkTagSize, SEEK_CUR); $BonkTagOffset = $this->ftell(); $TagHeaderTest = $this->fread(5); - if (($TagHeaderTest{0} != "\x00") || (substr($PossibleBonkTag, 4, 4) != strtolower(substr($PossibleBonkTag, 4, 4)))) { + if (($TagHeaderTest[0] != "\x00") || (substr($PossibleBonkTag, 4, 4) != strtolower(substr($PossibleBonkTag, 4, 4)))) { $this->error('Expecting "'.getid3_lib::PrintHexBytes("\x00".strtoupper(substr($PossibleBonkTag, 4, 4))).'" at offset '.$BonkTagOffset.', found "'.getid3_lib::PrintHexBytes($TagHeaderTest).'"'); return false; } diff -Nru php-getid3-1.9.17+dfsg/getid3/module.audio.dss.php php-getid3-1.9.18+dfsg/getid3/module.audio.dss.php --- php-getid3-1.9.17+dfsg/getid3/module.audio.dss.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.audio.dss.php 2019-09-16 19:08:47.000000000 +0000 @@ -26,8 +26,8 @@ $this->fseek($info['avdataoffset']); $DSSheader = $this->fread(1540); - if (!preg_match('#^[\\x02-\\x06]ds[s2]#', $DSSheader)) { - $this->error('Expecting "[02-06] 64 73 [73|32]" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($DSSheader, 0, 4)).'"'); + if (!preg_match('#^[\\x02-\\x08]ds[s2]#', $DSSheader)) { + $this->error('Expecting "[02-08] 64 73 [73|32]" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($DSSheader, 0, 4)).'"'); return false; } diff -Nru php-getid3-1.9.17+dfsg/getid3/module.audio.midi.php php-getid3-1.9.18+dfsg/getid3/module.audio.midi.php --- php-getid3-1.9.17+dfsg/getid3/module.audio.midi.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.audio.midi.php 2019-09-16 19:08:47.000000000 +0000 @@ -243,9 +243,9 @@ break; case 0x58: // Time signature - $timesig_numerator = getid3_lib::BigEndian2Int($METAeventData{0}); - $timesig_denominator = pow(2, getid3_lib::BigEndian2Int($METAeventData{1})); // $02 -> x/4, $03 -> x/8, etc - $timesig_32inqnote = getid3_lib::BigEndian2Int($METAeventData{2}); // number of 32nd notes to the quarter note + $timesig_numerator = getid3_lib::BigEndian2Int($METAeventData[0]); + $timesig_denominator = pow(2, getid3_lib::BigEndian2Int($METAeventData[1])); // $02 -> x/4, $03 -> x/8, etc + $timesig_32inqnote = getid3_lib::BigEndian2Int($METAeventData[2]); // number of 32nd notes to the quarter note //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_32inqnote'] = $timesig_32inqnote; //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_numerator'] = $timesig_numerator; //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_denominator'] = $timesig_denominator; @@ -254,13 +254,13 @@ break; case 0x59: // Keysignature - $keysig_sharpsflats = getid3_lib::BigEndian2Int($METAeventData{0}); + $keysig_sharpsflats = getid3_lib::BigEndian2Int($METAeventData[0]); if ($keysig_sharpsflats & 0x80) { // (-7 -> 7 flats, 0 ->key of C, 7 -> 7 sharps) $keysig_sharpsflats -= 256; } - $keysig_majorminor = getid3_lib::BigEndian2Int($METAeventData{1}); // 0 -> major, 1 -> minor + $keysig_majorminor = getid3_lib::BigEndian2Int($METAeventData[1]); // 0 -> major, 1 -> minor $keysigs = array(-7=>'Cb', -6=>'Gb', -5=>'Db', -4=>'Ab', -3=>'Eb', -2=>'Bb', -1=>'F', 0=>'C', 1=>'G', 2=>'D', 3=>'A', 4=>'E', 5=>'B', 6=>'F#', 7=>'C#'); //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_sharps'] = (($keysig_sharpsflats > 0) ? abs($keysig_sharpsflats) : 0); //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_flats'] = (($keysig_sharpsflats < 0) ? abs($keysig_sharpsflats) : 0); diff -Nru php-getid3-1.9.17+dfsg/getid3/module.audio.monkey.php php-getid3-1.9.18+dfsg/getid3/module.audio.monkey.php --- php-getid3-1.9.17+dfsg/getid3/module.audio.monkey.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.audio.monkey.php 2019-09-16 19:08:47.000000000 +0000 @@ -162,7 +162,7 @@ $info['md5_data_source'] = ''; $md5 = $thisfile_monkeysaudio_raw['cFileMD5']; for ($i = 0; $i < strlen($md5); $i++) { - $info['md5_data_source'] .= str_pad(dechex(ord($md5{$i})), 2, '00', STR_PAD_LEFT); + $info['md5_data_source'] .= str_pad(dechex(ord($md5[$i])), 2, '00', STR_PAD_LEFT); } if (!preg_match('/^[0-9a-f]{32}$/', $info['md5_data_source'])) { unset($info['md5_data_source']); diff -Nru php-getid3-1.9.17+dfsg/getid3/module.audio.mp3.php php-getid3-1.9.18+dfsg/getid3/module.audio.mp3.php --- php-getid3-1.9.17+dfsg/getid3/module.audio.mp3.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.audio.mp3.php 2019-09-16 19:08:47.000000000 +0000 @@ -701,7 +701,7 @@ if ($thisfile_mpeg_audio['xing_flags']['toc']) { $LAMEtocData = substr($headerstring, $VBRidOffset + 16, 100); for ($i = 0; $i < 100; $i++) { - $thisfile_mpeg_audio['toc'][$i] = ord($LAMEtocData{$i}); + $thisfile_mpeg_audio['toc'][$i] = ord($LAMEtocData[$i]); } } if ($thisfile_mpeg_audio['xing_flags']['vbr_scale']) { @@ -1173,9 +1173,9 @@ $SyncPattern1 = substr($MPEGaudioData, 0, 4); // may be different pattern due to padding - $SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) | 0x02).$SyncPattern1{3}; + $SyncPattern2 = $SyncPattern1[0].$SyncPattern1[1].chr(ord($SyncPattern1[2]) | 0x02).$SyncPattern1[3]; if ($SyncPattern2 === $SyncPattern1) { - $SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) & 0xFD).$SyncPattern1{3}; + $SyncPattern2 = $SyncPattern1[0].$SyncPattern1[1].chr(ord($SyncPattern1[2]) & 0xFD).$SyncPattern1[3]; } $framelength = false; @@ -1280,9 +1280,9 @@ if (strlen($head4) < 4) { break; } - if ($head4{0} != "\xFF") { + if ($head4[0] != "\xFF") { for ($i = 1; $i < 4; $i++) { - if ($head4{$i} == "\xFF") { + if ($head4[$i] == "\xFF") { $this->fseek($i - 4, SEEK_CUR); continue 2; } @@ -1314,7 +1314,7 @@ $WhereWeWere = $this->ftell(); $this->fseek($MPEGaudioHeaderLengthCache[$head4] - 4, SEEK_CUR); $next4 = $this->fread(4); - if ($next4{0} == "\xFF") { + if ($next4[0] == "\xFF") { if (!isset($MPEGaudioHeaderDecodeCache[$next4])) { $MPEGaudioHeaderDecodeCache[$next4] = self::MPEGaudioHeaderDecode($next4); } @@ -1459,7 +1459,7 @@ return false; } - if (($header{$SynchSeekOffset} == "\xFF") && ($header{($SynchSeekOffset + 1)} > "\xE0")) { // synch detected + if (($header[$SynchSeekOffset] == "\xFF") && ($header[($SynchSeekOffset + 1)] > "\xE0")) { // synch detected $FirstFrameAVDataOffset = null; if (!isset($FirstFrameThisfileInfo) && !isset($info['mpeg']['audio'])) { $FirstFrameThisfileInfo = $info; @@ -1554,7 +1554,7 @@ $this->fseek($scan_start_offset[$current_segment]); $buffer_4k = $this->fread(4096); for ($j = 0; $j < (strlen($buffer_4k) - 4); $j++) { - if (($buffer_4k{$j} == "\xFF") && ($buffer_4k{($j + 1)} > "\xE0")) { // synch detected + if (($buffer_4k[$j] == "\xFF") && ($buffer_4k[($j + 1)] > "\xE0")) { // synch detected if ($this->decodeMPEGaudioHeader($scan_start_offset[$current_segment] + $j, $dummy, false, false, $FastMode)) { $calculated_next_offset = $scan_start_offset[$current_segment] + $j + $dummy['mpeg']['audio']['framelength']; if ($this->decodeMPEGaudioHeader($calculated_next_offset, $dummy, false, false, $FastMode)) { @@ -1876,18 +1876,18 @@ } $MPEGrawHeader['synch'] = (getid3_lib::BigEndian2Int(substr($Header4Bytes, 0, 2)) & 0xFFE0) >> 4; - $MPEGrawHeader['version'] = (ord($Header4Bytes{1}) & 0x18) >> 3; // BB - $MPEGrawHeader['layer'] = (ord($Header4Bytes{1}) & 0x06) >> 1; // CC - $MPEGrawHeader['protection'] = (ord($Header4Bytes{1}) & 0x01); // D - $MPEGrawHeader['bitrate'] = (ord($Header4Bytes{2}) & 0xF0) >> 4; // EEEE - $MPEGrawHeader['sample_rate'] = (ord($Header4Bytes{2}) & 0x0C) >> 2; // FF - $MPEGrawHeader['padding'] = (ord($Header4Bytes{2}) & 0x02) >> 1; // G - $MPEGrawHeader['private'] = (ord($Header4Bytes{2}) & 0x01); // H - $MPEGrawHeader['channelmode'] = (ord($Header4Bytes{3}) & 0xC0) >> 6; // II - $MPEGrawHeader['modeextension'] = (ord($Header4Bytes{3}) & 0x30) >> 4; // JJ - $MPEGrawHeader['copyright'] = (ord($Header4Bytes{3}) & 0x08) >> 3; // K - $MPEGrawHeader['original'] = (ord($Header4Bytes{3}) & 0x04) >> 2; // L - $MPEGrawHeader['emphasis'] = (ord($Header4Bytes{3}) & 0x03); // MM + $MPEGrawHeader['version'] = (ord($Header4Bytes[1]) & 0x18) >> 3; // BB + $MPEGrawHeader['layer'] = (ord($Header4Bytes[1]) & 0x06) >> 1; // CC + $MPEGrawHeader['protection'] = (ord($Header4Bytes[1]) & 0x01); // D + $MPEGrawHeader['bitrate'] = (ord($Header4Bytes[2]) & 0xF0) >> 4; // EEEE + $MPEGrawHeader['sample_rate'] = (ord($Header4Bytes[2]) & 0x0C) >> 2; // FF + $MPEGrawHeader['padding'] = (ord($Header4Bytes[2]) & 0x02) >> 1; // G + $MPEGrawHeader['private'] = (ord($Header4Bytes[2]) & 0x01); // H + $MPEGrawHeader['channelmode'] = (ord($Header4Bytes[3]) & 0xC0) >> 6; // II + $MPEGrawHeader['modeextension'] = (ord($Header4Bytes[3]) & 0x30) >> 4; // JJ + $MPEGrawHeader['copyright'] = (ord($Header4Bytes[3]) & 0x08) >> 3; // K + $MPEGrawHeader['original'] = (ord($Header4Bytes[3]) & 0x04) >> 2; // L + $MPEGrawHeader['emphasis'] = (ord($Header4Bytes[3]) & 0x03); // MM return $MPEGrawHeader; } diff -Nru php-getid3-1.9.17+dfsg/getid3/module.audio.tta.php php-getid3-1.9.18+dfsg/getid3/module.audio.tta.php --- php-getid3-1.9.17+dfsg/getid3/module.audio.tta.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.audio.tta.php 2019-09-16 19:08:47.000000000 +0000 @@ -41,7 +41,7 @@ return false; } - switch ($ttaheader{3}) { + switch ($ttaheader[3]) { case "\x01": // TTA v1.x case "\x02": // TTA v1.x case "\x03": // TTA v1.x @@ -49,7 +49,7 @@ $info['tta']['major_version'] = 1; $info['avdataoffset'] += 16; - $info['tta']['compression_level'] = ord($ttaheader{3}); + $info['tta']['compression_level'] = ord($ttaheader[3]); $info['tta']['channels'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 4, 2)); $info['tta']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 6, 2)); $info['tta']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 8, 4)); @@ -92,7 +92,7 @@ break; default: - $this->error('This version of getID3() ['.$this->getid3->version().'] only knows how to handle TTA v1 and v2 - it may not work correctly with this file which appears to be TTA v'.$ttaheader{3}); + $this->error('This version of getID3() ['.$this->getid3->version().'] only knows how to handle TTA v1 and v2 - it may not work correctly with this file which appears to be TTA v'.$ttaheader[3]); return false; break; } diff -Nru php-getid3-1.9.17+dfsg/getid3/module.audio-video.asf.php php-getid3-1.9.18+dfsg/getid3/module.audio-video.asf.php --- php-getid3-1.9.17+dfsg/getid3/module.audio-video.asf.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.audio-video.asf.php 2019-09-16 19:08:47.000000000 +0000 @@ -797,17 +797,17 @@ case 'wm/tracknumber': case 'tracknumber': // be careful casting to int: casting unicode strings to int gives unexpected results (stops parsing at first non-numeric character) - $thisfile_asf_comments['track'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); - foreach ($thisfile_asf_comments['track'] as $key => $value) { + $thisfile_asf_comments['track_number'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); + foreach ($thisfile_asf_comments['track_number'] as $key => $value) { if (preg_match('/^[0-9\x00]+$/', $value)) { - $thisfile_asf_comments['track'][$key] = intval(str_replace("\x00", '', $value)); + $thisfile_asf_comments['track_number'][$key] = intval(str_replace("\x00", '', $value)); } } break; case 'wm/track': - if (empty($thisfile_asf_comments['track'])) { - $thisfile_asf_comments['track'] = array(1 + $this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); + if (empty($thisfile_asf_comments['track_number'])) { + $thisfile_asf_comments['track_number'] = array(1 + $this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); } break; @@ -1653,26 +1653,26 @@ * @return string */ public static function BytestringToGUID($Bytestring) { - $GUIDstring = str_pad(dechex(ord($Bytestring{3})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{2})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{1})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{0})), 2, '0', STR_PAD_LEFT); + $GUIDstring = str_pad(dechex(ord($Bytestring[3])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[2])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[1])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[0])), 2, '0', STR_PAD_LEFT); $GUIDstring .= '-'; - $GUIDstring .= str_pad(dechex(ord($Bytestring{5})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{4})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[5])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[4])), 2, '0', STR_PAD_LEFT); $GUIDstring .= '-'; - $GUIDstring .= str_pad(dechex(ord($Bytestring{7})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{6})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[7])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[6])), 2, '0', STR_PAD_LEFT); $GUIDstring .= '-'; - $GUIDstring .= str_pad(dechex(ord($Bytestring{8})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{9})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[8])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[9])), 2, '0', STR_PAD_LEFT); $GUIDstring .= '-'; - $GUIDstring .= str_pad(dechex(ord($Bytestring{10})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{11})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{12})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{13})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{14})), 2, '0', STR_PAD_LEFT); - $GUIDstring .= str_pad(dechex(ord($Bytestring{15})), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[10])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[11])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[12])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[13])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[14])), 2, '0', STR_PAD_LEFT); + $GUIDstring .= str_pad(dechex(ord($Bytestring[15])), 2, '0', STR_PAD_LEFT); return strtoupper($GUIDstring); } diff -Nru php-getid3-1.9.17+dfsg/getid3/module.audio-video.matroska.php php-getid3-1.9.18+dfsg/getid3/module.audio-video.matroska.php --- php-getid3-1.9.17+dfsg/getid3/module.audio-video.matroska.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.audio-video.matroska.php 2019-09-16 19:08:47.000000000 +0000 @@ -342,7 +342,7 @@ switch ($trackarray['CodecID']) { case 'A_PCM/INT/LIT': case 'A_PCM/INT/BIG': - $track_info['bitrate'] = $trackarray['SamplingFrequency'] * $trackarray['Channels'] * $trackarray['BitDepth']; + $track_info['bitrate'] = $track_info['sample_rate'] * $track_info['channels'] * $trackarray['BitDepth']; break; case 'A_AC3': diff -Nru php-getid3-1.9.17+dfsg/getid3/module.audio-video.quicktime.php php-getid3-1.9.18+dfsg/getid3/module.audio-video.quicktime.php --- php-getid3-1.9.17+dfsg/getid3/module.audio-video.quicktime.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.audio-video.quicktime.php 2019-09-16 19:08:47.000000000 +0000 @@ -38,7 +38,7 @@ $offset = 0; $atomcounter = 0; - $atom_data_read_buffer_size = max($this->getid3->option_fread_buffer_size * 1024, ($info['php_memory_limit'] ? round($info['php_memory_limit'] / 4) : 1024)); // set read buffer to 25% of PHP memory limit (if one is specified), otherwise use option_fread_buffer_size [default: 32MB] + $atom_data_read_buffer_size = $info['php_memory_limit'] ? round($info['php_memory_limit'] / 4) : $this->getid3->option_fread_buffer_size * 1024; // set read buffer to 25% of PHP memory limit (if one is specified), otherwise use option_fread_buffer_size [default: 32MB] while ($offset < $info['avdataend']) { if (!getid3_lib::intValueSupported($offset)) { $this->error('Unable to parse atom at offset '.$offset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions'); @@ -2654,7 +2654,7 @@ $handyatomtranslatorarray["\xA9".'src'] = 'source_credit'; $handyatomtranslatorarray["\xA9".'swr'] = 'software'; $handyatomtranslatorarray["\xA9".'too'] = 'encoding_tool'; // iTunes 4.0 - $handyatomtranslatorarray["\xA9".'trk'] = 'track'; + $handyatomtranslatorarray["\xA9".'trk'] = 'track_number'; $handyatomtranslatorarray["\xA9".'url'] = 'url'; $handyatomtranslatorarray["\xA9".'wrn'] = 'warning'; $handyatomtranslatorarray["\xA9".'wrt'] = 'composer'; diff -Nru php-getid3-1.9.17+dfsg/getid3/module.audio-video.riff.php php-getid3-1.9.18+dfsg/getid3/module.audio-video.riff.php --- php-getid3-1.9.17+dfsg/getid3/module.audio-video.riff.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.audio-video.riff.php 2019-09-16 19:08:47.000000000 +0000 @@ -943,7 +943,7 @@ $thisfile_riff_CDDA_fmt_0['start_offset_seconds'] = (float) $thisfile_riff_CDDA_fmt_0['start_offset_frame'] / 75; $thisfile_riff_CDDA_fmt_0['playtime_seconds'] = (float) $thisfile_riff_CDDA_fmt_0['playtime_frames'] / 75; - $info['comments']['track'] = $thisfile_riff_CDDA_fmt_0['track_num']; + $info['comments']['track_number'] = $thisfile_riff_CDDA_fmt_0['track_num']; $info['playtime_seconds'] = $thisfile_riff_CDDA_fmt_0['playtime_seconds']; // hardcoded data for CD-audio @@ -1756,6 +1756,75 @@ // $info['divxtag']['comments'] = self::ParseDIVXTAG($this->fread($chunksize)); // break; + case 'scot': + // https://cmsdk.com/node-js/adding-scot-chunk-to-wav-file.html + $RIFFchunk[$chunkname][$thisindex]['data'] = $this->fread($chunksize); + $RIFFchunk[$chunkname][$thisindex]['parsed']['alter'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 0, 1); + $RIFFchunk[$chunkname][$thisindex]['parsed']['attrib'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 1, 1); + $RIFFchunk[$chunkname][$thisindex]['parsed']['artnum'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 2, 2)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['title'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 4, 43); // "name" in other documentation + $RIFFchunk[$chunkname][$thisindex]['parsed']['copy'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 47, 4); + $RIFFchunk[$chunkname][$thisindex]['parsed']['padd'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 51, 1); + $RIFFchunk[$chunkname][$thisindex]['parsed']['asclen'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 52, 5); + $RIFFchunk[$chunkname][$thisindex]['parsed']['startseconds'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 57, 2)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['starthundredths'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 59, 2)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['endseconds'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 61, 2)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['endhundreths'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 63, 2)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['sdate'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 65, 6); + $RIFFchunk[$chunkname][$thisindex]['parsed']['kdate'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 71, 6); + $RIFFchunk[$chunkname][$thisindex]['parsed']['start_hr'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 77, 1); + $RIFFchunk[$chunkname][$thisindex]['parsed']['kill_hr'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 78, 1); + $RIFFchunk[$chunkname][$thisindex]['parsed']['digital'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 79, 1); + $RIFFchunk[$chunkname][$thisindex]['parsed']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 80, 2)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['stereo'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 82, 1); + $RIFFchunk[$chunkname][$thisindex]['parsed']['compress'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 83, 1); + $RIFFchunk[$chunkname][$thisindex]['parsed']['eomstrt'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 84, 4)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['eomlen'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 88, 2)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['attrib2'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 90, 4)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['future1'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 94, 12); + $RIFFchunk[$chunkname][$thisindex]['parsed']['catfontcolor'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 106, 4)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['catcolor'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 110, 4)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['segeompos'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 114, 4)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['vt_startsecs'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 118, 2)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['vt_starthunds'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 120, 2)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['priorcat'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 122, 3); + $RIFFchunk[$chunkname][$thisindex]['parsed']['priorcopy'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 125, 4); + $RIFFchunk[$chunkname][$thisindex]['parsed']['priorpadd'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 129, 1); + $RIFFchunk[$chunkname][$thisindex]['parsed']['postcat'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 130, 3); + $RIFFchunk[$chunkname][$thisindex]['parsed']['postcopy'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 133, 4); + $RIFFchunk[$chunkname][$thisindex]['parsed']['postpadd'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 137, 1); + $RIFFchunk[$chunkname][$thisindex]['parsed']['hrcanplay'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 138, 21); + $RIFFchunk[$chunkname][$thisindex]['parsed']['future2'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 159, 108); + $RIFFchunk[$chunkname][$thisindex]['parsed']['artist'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 267, 34); + $RIFFchunk[$chunkname][$thisindex]['parsed']['comment'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 301, 34); // "trivia" in other documentation + $RIFFchunk[$chunkname][$thisindex]['parsed']['intro'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 335, 2); + $RIFFchunk[$chunkname][$thisindex]['parsed']['end'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 337, 1); + $RIFFchunk[$chunkname][$thisindex]['parsed']['year'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 338, 4); + $RIFFchunk[$chunkname][$thisindex]['parsed']['obsolete2'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 342, 1); + $RIFFchunk[$chunkname][$thisindex]['parsed']['rec_hr'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 343, 1); + $RIFFchunk[$chunkname][$thisindex]['parsed']['rdate'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 344, 6); + $RIFFchunk[$chunkname][$thisindex]['parsed']['mpeg_bitrate'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 350, 2)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['pitch'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 352, 2)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['playlevel'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 354, 2)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['lenvalid'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 356, 1); + $RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 357, 4)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['newplaylevel'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 361, 2)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['chopsize'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 363, 4)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['vteomovr'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 367, 4)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['desiredlen'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 371, 4)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['triggers'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 375, 4)); + $RIFFchunk[$chunkname][$thisindex]['parsed']['fillout'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 379, 33); + + foreach (array('title', 'artist', 'comment') as $key) { + if (trim($RIFFchunk[$chunkname][$thisindex]['parsed'][$key])) { + $info['riff']['comments'][$key] = array($RIFFchunk[$chunkname][$thisindex]['parsed'][$key]); + } + } + if ($RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'] && !empty($info['filesize']) && ($RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'] != $info['filesize'])) { + $this->warning('RIFF.WAVE.scot.filelength ('.$RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'].') different from actual filesize ('.$info['filesize'].')'); + } + break; + default: if (!empty($LISTchunkParent) && isset($LISTchunkMaxOffset) && (($RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size']) <= $LISTchunkMaxOffset)) { $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['offset'] = $RIFFchunk[$chunkname][$thisindex]['offset']; diff -Nru php-getid3-1.9.17+dfsg/getid3/module.audio.voc.php php-getid3-1.9.18+dfsg/getid3/module.audio.voc.php --- php-getid3-1.9.17+dfsg/getid3/module.audio.voc.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.audio.voc.php 2019-09-16 19:08:47.000000000 +0000 @@ -61,7 +61,7 @@ $BlockOffset = $this->ftell(); $BlockData = $this->fread(4); - $BlockType = ord($BlockData{0}); + $BlockType = ord($BlockData[0]); $BlockSize = getid3_lib::LittleEndian2Int(substr($BlockData, 1, 3)); $ThisBlock = array(); diff -Nru php-getid3-1.9.17+dfsg/getid3/module.audio.wavpack.php php-getid3-1.9.18+dfsg/getid3/module.audio.wavpack.php --- php-getid3-1.9.17+dfsg/getid3/module.audio.wavpack.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.audio.wavpack.php 2019-09-16 19:08:47.000000000 +0000 @@ -102,8 +102,8 @@ return false; } - $info['wavpack']['blockheader']['minor_version'] = ord($wavpackheader{8}); - $info['wavpack']['blockheader']['major_version'] = ord($wavpackheader{9}); + $info['wavpack']['blockheader']['minor_version'] = ord($wavpackheader[8]); + $info['wavpack']['blockheader']['major_version'] = ord($wavpackheader[9]); if (($info['wavpack']['blockheader']['major_version'] != 4) || (($info['wavpack']['blockheader']['minor_version'] < 4) && @@ -122,8 +122,8 @@ return false; } - $info['wavpack']['blockheader']['track_number'] = ord($wavpackheader{10}); // unused - $info['wavpack']['blockheader']['index_number'] = ord($wavpackheader{11}); // unused + $info['wavpack']['blockheader']['track_number'] = ord($wavpackheader[10]); // unused + $info['wavpack']['blockheader']['index_number'] = ord($wavpackheader[11]); // unused $info['wavpack']['blockheader']['total_samples'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 12, 4)); $info['wavpack']['blockheader']['block_index'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 16, 4)); $info['wavpack']['blockheader']['block_samples'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 20, 4)); @@ -153,7 +153,7 @@ if (feof($this->getid3->fp)) { break; } - $metablock['id'] = ord($metablockheader{0}); + $metablock['id'] = ord($metablockheader[0]); $metablock['function_id'] = ($metablock['id'] & 0x3F); $metablock['function_name'] = $this->WavPackMetablockNameLookup($metablock['function_id']); diff -Nru php-getid3-1.9.17+dfsg/getid3/module.graphic.bmp.php php-getid3-1.9.18+dfsg/getid3/module.graphic.bmp.php --- php-getid3-1.9.17+dfsg/getid3/module.graphic.bmp.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.graphic.bmp.php 2019-09-16 19:08:47.000000000 +0000 @@ -334,7 +334,7 @@ case 1: for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col = $col) { - $paletteindexbyte = ord($BMPpixelData{$pixeldataoffset++}); + $paletteindexbyte = ord($BMPpixelData[$pixeldataoffset++]); for ($i = 7; $i >= 0; $i--) { $paletteindex = ($paletteindexbyte & (0x01 << $i)) >> $i; $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex]; @@ -351,7 +351,7 @@ case 4: for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col = $col) { - $paletteindexbyte = ord($BMPpixelData{$pixeldataoffset++}); + $paletteindexbyte = ord($BMPpixelData[$pixeldataoffset++]); for ($i = 1; $i >= 0; $i--) { $paletteindex = ($paletteindexbyte & (0x0F << (4 * $i))) >> (4 * $i); $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex]; @@ -368,7 +368,7 @@ case 8: for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) { - $paletteindex = ord($BMPpixelData{$pixeldataoffset++}); + $paletteindex = ord($BMPpixelData[$pixeldataoffset++]); $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex]; } while (($pixeldataoffset % 4) != 0) { @@ -381,7 +381,7 @@ case 24: for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) { - $thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData{$pixeldataoffset+2}) << 16) | (ord($BMPpixelData{$pixeldataoffset+1}) << 8) | ord($BMPpixelData{$pixeldataoffset}); + $thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData[$pixeldataoffset+2]) << 16) | (ord($BMPpixelData[$pixeldataoffset+1]) << 8) | ord($BMPpixelData[$pixeldataoffset]); $pixeldataoffset += 3; } while (($pixeldataoffset % 4) != 0) { @@ -394,7 +394,7 @@ case 32: for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) { for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) { - $thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData{$pixeldataoffset+3}) << 24) | (ord($BMPpixelData{$pixeldataoffset+2}) << 16) | (ord($BMPpixelData{$pixeldataoffset+1}) << 8) | ord($BMPpixelData{$pixeldataoffset}); + $thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData[$pixeldataoffset+3]) << 24) | (ord($BMPpixelData[$pixeldataoffset+2]) << 16) | (ord($BMPpixelData[$pixeldataoffset+1]) << 8) | ord($BMPpixelData[$pixeldataoffset]); $pixeldataoffset += 4; } while (($pixeldataoffset % 4) != 0) { diff -Nru php-getid3-1.9.17+dfsg/getid3/module.graphic.gif.php php-getid3-1.9.18+dfsg/getid3/module.graphic.gif.php --- php-getid3-1.9.17+dfsg/getid3/module.graphic.gif.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.graphic.gif.php 2019-09-16 19:08:47.000000000 +0000 @@ -46,6 +46,10 @@ return false; } + //if (!$this->getid3->option_extra_info) { + // $this->warning('GIF Extensions and Global Color Table not returned due to !getid3->option_extra_info'); + //} + $info['gif']['header']['raw']['version'] = substr($GIFheader, $offset, 3); $offset += 3; $info['gif']['header']['raw']['width'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 2)); @@ -85,12 +89,15 @@ if ($info['gif']['header']['flags']['global_color_table']) { $GIFcolorTable = $this->fread(3 * $info['gif']['header']['global_color_size']); - $offset = 0; - for ($i = 0; $i < $info['gif']['header']['global_color_size']; $i++) { - $red = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1)); - $green = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1)); - $blue = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1)); - $info['gif']['global_color_table'][$i] = (($red << 16) | ($green << 8) | ($blue)); + if ($this->getid3->option_extra_info) { + $offset = 0; + for ($i = 0; $i < $info['gif']['header']['global_color_size']; $i++) { + $red = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1)); + $green = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1)); + $blue = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1)); + $info['gif']['global_color_table'][$i] = (($red << 16) | ($green << 8) | ($blue)); + $info['gif']['global_color_table_rgb'][$i] = sprintf('%02X%02X%02X', $red, $green, $blue); + } } } @@ -166,7 +173,9 @@ } } - $info['gif']['extension_blocks'][] = $ExtensionBlock; + if ($this->getid3->option_extra_info) { + $info['gif']['extension_blocks'][] = $ExtensionBlock; + } break; case ';': diff -Nru php-getid3-1.9.17+dfsg/getid3/module.graphic.pcd.php php-getid3-1.9.18+dfsg/getid3/module.graphic.pcd.php --- php-getid3-1.9.17+dfsg/getid3/module.graphic.pcd.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.graphic.pcd.php 2019-09-16 19:08:47.000000000 +0000 @@ -76,11 +76,11 @@ for ($x = 0; $x < $PCD_width; $x++) { if ($PCDisVertical) { - $info['pcd']['data'][$PCD_width - $x][$y] = $this->YCbCr2RGB(ord($PCD_data_Y1{$x}), ord($PCD_data_Cb{(int) floor($x / 2)}), ord($PCD_data_Cr{(int) floor($x / 2)})); - $info['pcd']['data'][$PCD_width - $x][$y + 1] = $this->YCbCr2RGB(ord($PCD_data_Y2{$x}), ord($PCD_data_Cb{(int) floor($x / 2)}), ord($PCD_data_Cr{(int) floor($x / 2)})); + $info['pcd']['data'][$PCD_width - $x][$y] = $this->YCbCr2RGB(ord($PCD_data_Y1[$x]), ord($PCD_data_Cb[(int) floor($x / 2)]), ord($PCD_data_Cr[(int) floor($x / 2)])); + $info['pcd']['data'][$PCD_width - $x][$y + 1] = $this->YCbCr2RGB(ord($PCD_data_Y2[$x]), ord($PCD_data_Cb[(int) floor($x / 2)]), ord($PCD_data_Cr[(int) floor($x / 2)])); } else { - $info['pcd']['data'][$y][$x] = $this->YCbCr2RGB(ord($PCD_data_Y1{$x}), ord($PCD_data_Cb{(int) floor($x / 2)}), ord($PCD_data_Cr{(int) floor($x / 2)})); - $info['pcd']['data'][$y + 1][$x] = $this->YCbCr2RGB(ord($PCD_data_Y2{$x}), ord($PCD_data_Cb{(int) floor($x / 2)}), ord($PCD_data_Cr{(int) floor($x / 2)})); + $info['pcd']['data'][$y][$x] = $this->YCbCr2RGB(ord($PCD_data_Y1[$x]), ord($PCD_data_Cb[(int) floor($x / 2)]), ord($PCD_data_Cr[(int) floor($x / 2)])); + $info['pcd']['data'][$y + 1][$x] = $this->YCbCr2RGB(ord($PCD_data_Y2[$x]), ord($PCD_data_Cb[(int) floor($x / 2)]), ord($PCD_data_Cr[(int) floor($x / 2)])); } } } diff -Nru php-getid3-1.9.17+dfsg/getid3/module.graphic.tiff.php php-getid3-1.9.18+dfsg/getid3/module.graphic.tiff.php --- php-getid3-1.9.17+dfsg/getid3/module.graphic.tiff.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.graphic.tiff.php 2019-09-16 19:08:47.000000000 +0000 @@ -43,7 +43,7 @@ $info['video']['dataformat'] = 'tiff'; $info['video']['lossless'] = true; $info['tiff']['ifd'] = array(); - $CurrentIFD = array(); + $CurrentIFD = array(); $FieldTypeByteLength = array(1=>1, 2=>1, 3=>2, 4=>4, 5=>8); @@ -57,47 +57,61 @@ $CurrentIFD['fieldcount'] = $this->TIFFendian2Int($this->fread(2), $info['tiff']['byte_order']); for ($i = 0; $i < $CurrentIFD['fieldcount']; $i++) { - $CurrentIFD['fields'][$i]['raw']['tag'] = $this->TIFFendian2Int($this->fread(2), $info['tiff']['byte_order']); - $CurrentIFD['fields'][$i]['raw']['type'] = $this->TIFFendian2Int($this->fread(2), $info['tiff']['byte_order']); - $CurrentIFD['fields'][$i]['raw']['length'] = $this->TIFFendian2Int($this->fread(4), $info['tiff']['byte_order']); - $CurrentIFD['fields'][$i]['raw']['offset'] = $this->fread(4); - + $CurrentIFD['fields'][$i]['raw']['tag'] = $this->TIFFendian2Int($this->fread(2), $info['tiff']['byte_order']); + $CurrentIFD['fields'][$i]['raw']['type'] = $this->TIFFendian2Int($this->fread(2), $info['tiff']['byte_order']); + $CurrentIFD['fields'][$i]['raw']['length'] = $this->TIFFendian2Int($this->fread(4), $info['tiff']['byte_order']); + $CurrentIFD['fields'][$i]['raw']['valoff'] = $this->fread(4); // To save time and space the Value Offset contains the Value instead of pointing to the Value if and only if the Value fits into 4 bytes. If the Value is shorter than 4 bytes, it is left-justified within the 4-byte Value Offset, i.e., stored in the lowernumbered bytes. Whether the Value fits within 4 bytes is determined by the Type and Count of the field. $CurrentIFD['fields'][$i]['raw']['tag_name'] = $this->TIFFcommentName($CurrentIFD['fields'][$i]['raw']['tag']); switch ($CurrentIFD['fields'][$i]['raw']['type']) { case 1: // BYTE An 8-bit unsigned integer. if ($CurrentIFD['fields'][$i]['raw']['length'] <= 4) { - $CurrentIFD['fields'][$i]['value'] = $this->TIFFendian2Int(substr($CurrentIFD['fields'][$i]['raw']['offset'], 0, 1), $info['tiff']['byte_order']); + $CurrentIFD['fields'][$i]['value'] = $this->TIFFendian2Int(substr($CurrentIFD['fields'][$i]['raw']['valoff'], 0, 1), $info['tiff']['byte_order']); } else { - $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $info['tiff']['byte_order']); + $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['valoff'], $info['tiff']['byte_order']); } break; case 2: // ASCII 8-bit bytes that store ASCII codes; the last byte must be null. if ($CurrentIFD['fields'][$i]['raw']['length'] <= 4) { - $CurrentIFD['fields'][$i]['value'] = substr($CurrentIFD['fields'][$i]['raw']['offset'], 3); + $CurrentIFD['fields'][$i]['value'] = substr($CurrentIFD['fields'][$i]['raw']['valoff'], 3); } else { - $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $info['tiff']['byte_order']); + $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['valoff'], $info['tiff']['byte_order']); } break; case 3: // SHORT A 16-bit (2-byte) unsigned integer. if ($CurrentIFD['fields'][$i]['raw']['length'] <= 2) { - $CurrentIFD['fields'][$i]['value'] = $this->TIFFendian2Int(substr($CurrentIFD['fields'][$i]['raw']['offset'], 0, 2), $info['tiff']['byte_order']); + $CurrentIFD['fields'][$i]['value'] = $this->TIFFendian2Int(substr($CurrentIFD['fields'][$i]['raw']['valoff'], 0, 2), $info['tiff']['byte_order']); } else { - $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $info['tiff']['byte_order']); + $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['valoff'], $info['tiff']['byte_order']); } break; case 4: // LONG A 32-bit (4-byte) unsigned integer. - if ($CurrentIFD['fields'][$i]['raw']['length'] <= 1) { - $CurrentIFD['fields'][$i]['value'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $info['tiff']['byte_order']); + if ($CurrentIFD['fields'][$i]['raw']['length'] <= 4) { + $CurrentIFD['fields'][$i]['value'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['valoff'], $info['tiff']['byte_order']); } else { - $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $info['tiff']['byte_order']); + $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['valoff'], $info['tiff']['byte_order']); } break; case 5: // RATIONAL Two LONG_s: the first represents the numerator of a fraction, the second the denominator. + case 7: // UNDEFINED An 8-bit byte that may contain anything, depending on the definition of the field. + $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['valoff'], $info['tiff']['byte_order']); + break; + + // Warning: It is possible that other TIFF field types will be added in the future. Readers should skip over fields containing an unexpected field type. + // In TIFF 6.0, some new field types have been defined: + // These new field types are also governed by the byte order (II or MM) in the TIFF header. + case 6: // SBYTE An 8-bit signed (twos-complement) integer. + case 8: // SSHORT A 16-bit (2-byte) signed (twos-complement) integer. + case 9: // SLONG A 32-bit (4-byte) signed (twos-complement) integer. + case 10: // SRATIONAL Two SLONGs: the first represents the numerator of a fraction, the second the denominator. + case 11: // FLOAT Single precision (4-byte) IEEE format + case 12: // DOUBLE Double precision (8-byte) IEEE format + default: + $this->warning('unhandled IFD field type '.$CurrentIFD['fields'][$i]['raw']['type'].' for IFD entry '.$i); break; } } @@ -137,6 +151,16 @@ } break; + case 700: + $XMPmagic = 'fseek($fieldarray['offset']); + $xmpkey = (isset($info['tiff']['XMP']) ? count($info['tiff']['XMP']) : 0); + $info['tiff']['XMP'][$xmpkey]['raw'] = $this->fread($fieldarray['raw']['length']); + if (substr($info['tiff']['XMP'][$xmpkey]['raw'], 0, strlen($XMPmagic)) != $XMPmagic) { + $this->warning('did not find expected XMP data at offset '.$fieldarray['offset']); + unset($info['tiff']['XMP'][$xmpkey]['raw']); + } + break; } switch ($fieldarray['raw']['tag']) { case 256: // ImageWidth @@ -207,14 +231,33 @@ * @return string */ public function TIFFcompressionMethod($id) { + // https://en.wikipedia.org/wiki/TIFF#TIFF_Compression_Tag static $TIFFcompressionMethod = array(); if (empty($TIFFcompressionMethod)) { $TIFFcompressionMethod = array( - 1 => 'Uncompressed', - 2 => 'Huffman', - 3 => 'Fax - CCITT 3', - 5 => 'LZW', - 32773 => 'PackBits', + 0x0001 => 'Uncompressed', + 0x0002 => 'Huffman', + 0x0003 => 'CCITT T.4', + 0x0004 => 'CCITT T.6', + 0x0005 => 'LZW', + 0x0006 => 'JPEG-old', + 0x0007 => 'JPEG', + 0x0008 => 'deflate', + 0x0009 => 'JBIG ITU-T T.85', + 0x000A => 'JBIG ITU-T T.43', + 0x7FFE => 'NeXT RLE 2-bit', + 0x8005 => 'PackBits', + 0x8029 => 'ThunderScan RLE 4-bit', + 0x807F => 'RasterPadding', + 0x8080 => 'RLE-LW', + 0x8081 => 'RLE-CT', + 0x8082 => 'RLE-BL', + 0x80B2 => 'deflate-PK', + 0x80B3 => 'Kodak-DCS', + 0x8765 => 'JBIG', + 0x8798 => 'JPEG2000', + 0x8799 => 'Nikon NEF', + 0x879B => 'JBIG2', ); } return (isset($TIFFcompressionMethod[$id]) ? $TIFFcompressionMethod[$id] : 'unknown/invalid ('.$id.')'); diff -Nru php-getid3-1.9.17+dfsg/getid3/module.misc.iso.php php-getid3-1.9.18+dfsg/getid3/module.misc.iso.php --- php-getid3-1.9.17+dfsg/getid3/module.misc.iso.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.misc.iso.php 2019-09-16 19:08:47.000000000 +0000 @@ -29,7 +29,7 @@ $this->fseek(2048 * $i); $ISOheader = $this->fread(2048); if (substr($ISOheader, 1, 5) == 'CD001') { - switch (ord($ISOheader{0})) { + switch (ord($ISOheader[0])) { case 1: $info['iso']['primary_volume_descriptor']['offset'] = 2048 * $i; $this->ParsePrimaryVolumeDescriptor($ISOheader); @@ -296,9 +296,9 @@ $DirectoryRecordData = $this->fread(1); $DirectoryRecord = array(); - while (ord($DirectoryRecordData{0}) > 33) { + while (ord($DirectoryRecordData[0]) > 33) { - $DirectoryRecordData .= $this->fread(ord($DirectoryRecordData{0}) - 1); + $DirectoryRecordData .= $this->fread(ord($DirectoryRecordData[0]) - 1); $ThisDirectoryRecord = array(); @@ -389,13 +389,13 @@ // 6: second of the minute from 0 to 59 // 7: Offset from Greenwich Mean Time in number of 15 minute intervals from -48 (West) to +52 (East) - $UNIXyear = ord($ISOtime{0}) + 1900; - $UNIXmonth = ord($ISOtime{1}); - $UNIXday = ord($ISOtime{2}); - $UNIXhour = ord($ISOtime{3}); - $UNIXminute = ord($ISOtime{4}); - $UNIXsecond = ord($ISOtime{5}); - $GMToffset = $this->TwosCompliment2Decimal(ord($ISOtime{5})); + $UNIXyear = ord($ISOtime[0]) + 1900; + $UNIXmonth = ord($ISOtime[1]); + $UNIXday = ord($ISOtime[2]); + $UNIXhour = ord($ISOtime[3]); + $UNIXminute = ord($ISOtime[4]); + $UNIXsecond = ord($ISOtime[5]); + $GMToffset = $this->TwosCompliment2Decimal(ord($ISOtime[5])); return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear); } diff -Nru php-getid3-1.9.17+dfsg/getid3/module.tag.apetag.php php-getid3-1.9.18+dfsg/getid3/module.tag.apetag.php --- php-getid3-1.9.17+dfsg/getid3/module.tag.apetag.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.tag.apetag.php 2019-09-16 19:08:47.000000000 +0000 @@ -237,7 +237,7 @@ case 'tracknumber': if (is_array($thisfile_ape_items_current['data'])) { foreach ($thisfile_ape_items_current['data'] as $comment) { - $thisfile_ape['comments']['track'][] = $comment; + $thisfile_ape['comments']['track_number'][] = $comment; } } break; diff -Nru php-getid3-1.9.17+dfsg/getid3/module.tag.id3v1.php php-getid3-1.9.18+dfsg/getid3/module.tag.id3v1.php --- php-getid3-1.9.17+dfsg/getid3/module.tag.id3v1.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.tag.id3v1.php 2019-09-16 19:08:47.000000000 +0000 @@ -45,9 +45,9 @@ // If second-last byte of comment field is null and last byte of comment field is non-null // then this is ID3v1.1 and the comment field is 28 bytes long and the 30th byte is the track number - if (($id3v1tag{125} === "\x00") && ($id3v1tag{126} !== "\x00")) { - $ParsedID3v1['track'] = ord(substr($ParsedID3v1['comment'], 29, 1)); - $ParsedID3v1['comment'] = substr($ParsedID3v1['comment'], 0, 28); + if (($id3v1tag[125] === "\x00") && ($id3v1tag[126] !== "\x00")) { + $ParsedID3v1['track_number'] = ord(substr($ParsedID3v1['comment'], 29, 1)); + $ParsedID3v1['comment'] = substr($ParsedID3v1['comment'], 0, 28); } $ParsedID3v1['comment'] = $this->cutfield($ParsedID3v1['comment']); @@ -68,7 +68,7 @@ $ID3v1encoding = 'ISO-8859-1'; foreach ($ParsedID3v1['comments'] as $tag_key => $valuearray) { foreach ($valuearray as $key => $value) { - if (preg_match('#^[\\x00-\\x40\\xA8\\B8\\x80-\\xFF]+$#', $value)) { + if (preg_match('#^[\\x00-\\x40\\xA8\\xB8\\x80-\\xFF]+$#', $value)) { foreach (array('Windows-1251', 'KOI8-R') as $id3v1_bad_encoding) { if (function_exists('mb_convert_encoding') && @mb_convert_encoding($value, $id3v1_bad_encoding, $id3v1_bad_encoding) === $value) { $ID3v1encoding = $id3v1_bad_encoding; @@ -91,7 +91,7 @@ $ParsedID3v1['year'], (isset($ParsedID3v1['genre']) ? $this->LookupGenreID($ParsedID3v1['genre']) : false), $ParsedID3v1['comment'], - (!empty($ParsedID3v1['track']) ? $ParsedID3v1['track'] : '')); + (!empty($ParsedID3v1['track_number']) ? $ParsedID3v1['track_number'] : '')); $ParsedID3v1['padding_valid'] = true; if ($id3v1tag !== $GoodFormatID3v1tag) { $ParsedID3v1['padding_valid'] = false; diff -Nru php-getid3-1.9.17+dfsg/getid3/module.tag.id3v2.php php-getid3-1.9.18+dfsg/getid3/module.tag.id3v2.php --- php-getid3-1.9.17+dfsg/getid3/module.tag.id3v2.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.tag.id3v2.php 2019-09-16 19:08:47.000000000 +0000 @@ -59,8 +59,8 @@ $header = $this->fread(10); if (substr($header, 0, 3) == 'ID3' && strlen($header) == 10) { - $thisfile_id3v2['majorversion'] = ord($header{3}); - $thisfile_id3v2['minorversion'] = ord($header{4}); + $thisfile_id3v2['majorversion'] = ord($header[3]); + $thisfile_id3v2['minorversion'] = ord($header[4]); // shortcut $id3v2_majorversion = &$thisfile_id3v2['majorversion']; @@ -79,7 +79,7 @@ } - $id3_flags = ord($header{5}); + $id3_flags = ord($header[5]); switch ($id3v2_majorversion) { case 2: // %ab000000 in v2.2 @@ -260,7 +260,7 @@ $thisfile_id3v2['padding']['length'] = strlen($framedata); $thisfile_id3v2['padding']['valid'] = true; for ($i = 0; $i < $thisfile_id3v2['padding']['length']; $i++) { - if ($framedata{$i} != "\x00") { + if ($framedata[$i] != "\x00") { $thisfile_id3v2['padding']['valid'] = false; $thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i; $this->warning('Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)'); @@ -326,7 +326,7 @@ $len = strlen($framedata); for ($i = 0; $i < $len; $i++) { - if ($framedata{$i} != "\x00") { + if ($framedata[$i] != "\x00") { $thisfile_id3v2['padding']['valid'] = false; $thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i; $this->warning('Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)'); @@ -434,11 +434,11 @@ $footer = $this->fread(10); if (substr($footer, 0, 3) == '3DI') { $thisfile_id3v2['footer'] = true; - $thisfile_id3v2['majorversion_footer'] = ord($footer{3}); - $thisfile_id3v2['minorversion_footer'] = ord($footer{4}); + $thisfile_id3v2['majorversion_footer'] = ord($footer[3]); + $thisfile_id3v2['minorversion_footer'] = ord($footer[4]); } if ($thisfile_id3v2['majorversion_footer'] <= 4) { - $id3_flags = ord($footer{5}); + $id3_flags = ord($footer[5]); $thisfile_id3v2_flags['unsynch_footer'] = (bool) ($id3_flags & 0x80); $thisfile_id3v2_flags['extfoot_footer'] = (bool) ($id3_flags & 0x40); $thisfile_id3v2_flags['experim_footer'] = (bool) ($id3_flags & 0x20); @@ -459,10 +459,10 @@ unset($key, $value, $genres, $genre); } - if (isset($thisfile_id3v2['comments']['track'])) { - foreach ($thisfile_id3v2['comments']['track'] as $key => $value) { + if (isset($thisfile_id3v2['comments']['track_number'])) { + foreach ($thisfile_id3v2['comments']['track_number'] as $key => $value) { if (strstr($value, '/')) { - list($thisfile_id3v2['comments']['tracknum'][$key], $thisfile_id3v2['comments']['totaltracks'][$key]) = explode('/', $thisfile_id3v2['comments']['track'][$key]); + list($thisfile_id3v2['comments']['track_number'][$key], $thisfile_id3v2['comments']['totaltracks'][$key]) = explode('/', $thisfile_id3v2['comments']['track_number'][$key]); } } } @@ -672,16 +672,14 @@ if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 } - $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { - // if description only contains a BOM or terminator then make it blank - $frame_description = ''; - } + $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']); $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); - $parsedFrame['description'] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $frame_description)); + $parsedFrame['description'] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['description'])); $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); + $parsedFrame['data'] = $this->RemoveStringTerminator($parsedFrame['data'], $frame_textencoding_terminator); if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { $commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : (isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0)); if (!isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || !array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) { @@ -693,7 +691,7 @@ //unset($parsedFrame['data']); do not unset, may be needed elsewhere, e.g. for replaygain - } elseif ($parsedFrame['frame_name']{0} == 'T') { // 4.2. T??[?] Text information frame + } elseif ($parsedFrame['frame_name'][0] == 'T') { // 4.2. T??[?] Text information frame // There may only be one text information frame of its kind in an tag. //
@@ -707,10 +705,10 @@ } $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); + $parsedFrame['data'] = $this->RemoveStringTerminator($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding)); $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { // ID3v2.3 specs say that TPE1 (and others) can contain multiple artist values separated with / // This of course breaks when an artist name contains slash character, e.g. "AC/DC" @@ -766,38 +764,20 @@ if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 } - $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { - // if description only contains a BOM or terminator then make it blank - $frame_description = ''; - } - $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); - - $frame_terminatorpos = strpos($parsedFrame['data'], $frame_textencoding_terminator); - if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { - $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 - } - if ($frame_terminatorpos) { - // there are null bytes after the data - this is not according to spec - // only use data up to first null byte - $frame_urldata = (string) substr($parsedFrame['data'], 0, $frame_terminatorpos); - } else { - // no null bytes following data, just use all data - $frame_urldata = (string) $parsedFrame['data']; - } - $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); + $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); // according to the frame text encoding + $parsedFrame['url'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); // always ISO-8859-1 + $parsedFrame['description'] = $this->RemoveStringTerminator($parsedFrame['description'], $frame_textencoding_terminator); + $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']); - $parsedFrame['url'] = $frame_urldata; // always ISO-8859-1 - $parsedFrame['description'] = $frame_description; // according to the frame text encoding if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback('ISO-8859-1', $info['id3v2']['encoding'], $parsedFrame['url']); } unset($parsedFrame['data']); - } elseif ($parsedFrame['frame_name']{0} == 'W') { // 4.3. W??? URL link frames + } elseif ($parsedFrame['frame_name'][0] == 'W') { // 4.3. W??? URL link frames // There may only be one URL link frame of its kind in a tag, // except when stated otherwise in the frame description //
MakeUTF16emptyStringEmpty($parsedFrame['description']); $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); + $parsedFrame['data'] = $this->RemoveStringTerminator($parsedFrame['data'], $frame_textencoding_terminator); $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); $parsedFrame['language'] = $frame_language; $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); - $parsedFrame['description'] = $frame_description; if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']); } @@ -1077,7 +1054,7 @@ $parsedFrame['lyrics'][$timestampindex]['data'] = substr($frame_remainingdata, $frame_offset, $frame_terminatorpos - $frame_offset); $frame_remainingdata = substr($frame_remainingdata, $frame_terminatorpos + strlen($frame_textencoding_terminator)); - if (($timestampindex == 0) && (ord($frame_remainingdata{0}) != 0)) { + if (($timestampindex == 0) && (ord($frame_remainingdata[0]) != 0)) { // timestamp probably omitted for first data item } else { $parsedFrame['lyrics'][$timestampindex]['timestamp'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 4)); @@ -1118,19 +1095,16 @@ if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 } - $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { - // if description only contains a BOM or terminator then make it blank - $frame_description = ''; - } + $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']); $frame_text = (string) substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); + $frame_text = $this->RemoveStringTerminator($frame_text, $frame_textencoding_terminator); $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); $parsedFrame['language'] = $frame_language; $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); - $parsedFrame['description'] = $frame_description; $parsedFrame['data'] = $frame_text; if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { $commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : (!empty($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0)); @@ -1423,26 +1397,22 @@ if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 } - $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { - // if description only contains a BOM or terminator then make it blank - $frame_description = ''; - } - $parsedFrame['encodingid'] = $frame_textencoding; - $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); + $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']); + $parsedFrame['encodingid'] = $frame_textencoding; + $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); if ($id3v2_majorversion == 2) { - $parsedFrame['imagetype'] = isset($frame_imagetype) ? $frame_imagetype : null; + $parsedFrame['imagetype'] = isset($frame_imagetype) ? $frame_imagetype : null; } else { - $parsedFrame['mime'] = isset($frame_mimetype) ? $frame_mimetype : null; + $parsedFrame['mime'] = isset($frame_mimetype) ? $frame_mimetype : null; } - $parsedFrame['picturetypeid'] = $frame_picturetype; - $parsedFrame['picturetype'] = $this->APICPictureTypeLookup($frame_picturetype); - $parsedFrame['description'] = $frame_description; - $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); - $parsedFrame['datalength'] = strlen($parsedFrame['data']); + $parsedFrame['picturetypeid'] = $frame_picturetype; + $parsedFrame['picturetype'] = $this->APICPictureTypeLookup($frame_picturetype); + $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); + $parsedFrame['datalength'] = strlen($parsedFrame['data']); - $parsedFrame['image_mime'] = ''; + $parsedFrame['image_mime'] = ''; $imageinfo = array(); if ($imagechunkcheck = getid3_lib::GetDataImageSize($parsedFrame['data'], $imageinfo)) { if (($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) { @@ -1550,11 +1520,8 @@ if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 } - $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { - // if description only contains a BOM or terminator then make it blank - $frame_description = ''; - } + $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']); $frame_offset = $frame_terminatorpos + strlen($frame_textencoding_terminator); $parsedFrame['objectdata'] = (string) substr($parsedFrame['data'], $frame_offset); @@ -1563,7 +1530,6 @@ $parsedFrame['mime'] = $frame_mimetype; $parsedFrame['filename'] = $frame_filename; - $parsedFrame['description'] = $frame_description; unset($parsedFrame['data']); @@ -1633,16 +1599,12 @@ $frame_offset = $frame_terminatorpos + strlen("\x00"); $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); - $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { - // if description only contains a BOM or terminator then make it blank - $frame_description = ''; - } + $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']); $frame_offset = $frame_terminatorpos + strlen("\x00"); $parsedFrame['ownerid'] = $frame_ownerid; $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); - $parsedFrame['description'] = $frame_description; unset($parsedFrame['data']); @@ -1738,7 +1700,8 @@ $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); - $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); + $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); + $parsedFrame['data'] = $this->RemoveStringTerminator($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding)); if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']); } @@ -1776,6 +1739,7 @@ $frame_offset += 8; $parsedFrame['seller'] = (string) substr($parsedFrame['data'], $frame_offset); + $parsedFrame['seller'] = $this->RemoveStringTerminator($parsedFrame['seller'], $this->TextEncodingTerminatorLookup($frame_textencoding)); unset($parsedFrame['data']); @@ -1834,11 +1798,8 @@ if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator), 1)) === 0) { $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 } - $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { - // if description only contains a BOM or terminator then make it blank - $frame_description = ''; - } + $parsedFrame['description'] = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); + $parsedFrame['description'] = $this->MakeUTF16emptyStringEmpty($parsedFrame['description']); $frame_offset = $frame_terminatorpos + strlen($frame_textencoding_terminator); $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); @@ -1855,7 +1816,6 @@ $parsedFrame['receivedasid'] = $frame_receivedasid; $parsedFrame['receivedas'] = $this->COMRReceivedAsLookup($frame_receivedasid); $parsedFrame['sellername'] = $frame_sellername; - $parsedFrame['description'] = $frame_description; $parsedFrame['mime'] = $frame_mimetype; $parsedFrame['logo'] = $frame_sellerlogo; unset($parsedFrame['data']); @@ -3725,6 +3685,35 @@ } /** + * @param string $string + * @param string $terminator + * + * @return string + */ + public static function RemoveStringTerminator($string, $terminator) { + // Null terminator at end of comment string is somewhat ambiguous in the specification, may or may not be implemented by various taggers. Remove terminator only if present. + // https://github.com/JamesHeinrich/getID3/issues/121 + // https://community.mp3tag.de/t/x-trailing-nulls-in-id3v2-comments/19227 + if (substr($string, -strlen($terminator), strlen($terminator)) === $terminator) { + $string = substr($string, 0, -strlen($terminator)); + } + return $string; + } + + /** + * @param string $string + * + * @return string + */ + public static function MakeUTF16emptyStringEmpty($string) { + if (in_array($string, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if string only contains a BOM or terminator then make it actually an empty string + $string = ''; + } + return $string; + } + + /** * @param string $framename * @param int $id3v2majorversion * @@ -3753,10 +3742,10 @@ */ public static function IsANumber($numberstring, $allowdecimal=false, $allownegative=false) { for ($i = 0; $i < strlen($numberstring); $i++) { - if ((chr($numberstring{$i}) < chr('0')) || (chr($numberstring{$i}) > chr('9'))) { - if (($numberstring{$i} == '.') && $allowdecimal) { + if ((chr($numberstring[$i]) < chr('0')) || (chr($numberstring[$i]) > chr('9'))) { + if (($numberstring[$i] == '.') && $allowdecimal) { // allowed - } elseif (($numberstring{$i} == '-') && $allownegative && ($i == 0)) { + } elseif (($numberstring[$i] == '-') && $allownegative && ($i == 0)) { // allowed } else { return false; diff -Nru php-getid3-1.9.17+dfsg/getid3/module.tag.xmp.php php-getid3-1.9.18+dfsg/getid3/module.tag.xmp.php --- php-getid3-1.9.17+dfsg/getid3/module.tag.xmp.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/module.tag.xmp.php 2019-09-16 19:08:47.000000000 +0000 @@ -114,7 +114,7 @@ $data = fread($filehnd, 2); // Check that the third character is 0xFF (Start of first segment header) - if ($data{0} != "\xFF") + if ($data[0] != "\xFF") { // NO FF found - close file and return - JPEG is probably corrupted fclose($filehnd); @@ -129,11 +129,11 @@ // 2) we have hit the compressed image data (no more headers are allowed after data) // 3) or end of file is hit - while (($data{1} != "\xD9") && (!$hit_compressed_image_data) && (!feof($filehnd))) + while (($data[1] != "\xD9") && (!$hit_compressed_image_data) && (!feof($filehnd))) { // Found a segment to look at. // Check that the segment marker is not a Restart marker - restart markers don't have size or data after them - if ((ord($data{1}) < 0xD0) || (ord($data{1}) > 0xD7)) + if ((ord($data[1]) < 0xD0) || (ord($data[1]) > 0xD7)) { // Segment isn't a Restart marker // Read the next two bytes (size) @@ -150,15 +150,15 @@ // Store the segment information in the output array $headerdata[] = array( - 'SegType' => ord($data{1}), - 'SegName' => $GLOBALS['JPEG_Segment_Names'][ord($data{1})], + 'SegType' => ord($data[1]), + 'SegName' => $GLOBALS['JPEG_Segment_Names'][ord($data[1])], 'SegDataStart' => $segdatastart, 'SegData' => $segdata, ); } // If this is a SOS (Start Of Scan) segment, then there is no more header data - the compressed image data follows - if ($data{1} == "\xDA") + if ($data[1] == "\xDA") { // Flag that we have hit the compressed image data - exit loop as no more headers available. $hit_compressed_image_data = true; @@ -169,7 +169,7 @@ $data = fread($filehnd, 2); // Check that the first byte of the two is 0xFF as it should be for a marker - if ($data{0} != "\xFF") + if ($data[0] != "\xFF") { // NO FF found - close file and return - JPEG is probably corrupted fclose($filehnd); diff -Nru php-getid3-1.9.17+dfsg/getid3/write.id3v1.php php-getid3-1.9.18+dfsg/getid3/write.id3v1.php --- php-getid3-1.9.17+dfsg/getid3/write.id3v1.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/write.id3v1.php 2019-09-16 19:08:47.000000000 +0000 @@ -68,16 +68,16 @@ } else { fseek($fp_source, 0, SEEK_END); // append new ID3v1 tag } - $this->tag_data['track'] = (isset($this->tag_data['track']) ? $this->tag_data['track'] : (isset($this->tag_data['track_number']) ? $this->tag_data['track_number'] : (isset($this->tag_data['tracknumber']) ? $this->tag_data['tracknumber'] : ''))); + $this->tag_data['track_number'] = (isset($this->tag_data['track_number']) ? $this->tag_data['track_number'] : ''); $new_id3v1_tag_data = getid3_id3v1::GenerateID3v1Tag( - (isset($this->tag_data['title'] ) ? $this->tag_data['title'] : ''), - (isset($this->tag_data['artist'] ) ? $this->tag_data['artist'] : ''), - (isset($this->tag_data['album'] ) ? $this->tag_data['album'] : ''), - (isset($this->tag_data['year'] ) ? $this->tag_data['year'] : ''), - (isset($this->tag_data['genreid']) ? $this->tag_data['genreid'] : ''), - (isset($this->tag_data['comment']) ? $this->tag_data['comment'] : ''), - (isset($this->tag_data['track'] ) ? $this->tag_data['track'] : '')); + (isset($this->tag_data['title'] ) ? $this->tag_data['title'] : ''), + (isset($this->tag_data['artist'] ) ? $this->tag_data['artist'] : ''), + (isset($this->tag_data['album'] ) ? $this->tag_data['album'] : ''), + (isset($this->tag_data['year'] ) ? $this->tag_data['year'] : ''), + (isset($this->tag_data['genreid'] ) ? $this->tag_data['genreid'] : ''), + (isset($this->tag_data['comment'] ) ? $this->tag_data['comment'] : ''), + (isset($this->tag_data['track_number']) ? $this->tag_data['track_number'] : '')); fwrite($fp_source, $new_id3v1_tag_data, 128); fclose($fp_source); return true; diff -Nru php-getid3-1.9.17+dfsg/getid3/write.id3v2.php php-getid3-1.9.18+dfsg/getid3/write.id3v2.php --- php-getid3-1.9.17+dfsg/getid3/write.id3v2.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/write.id3v2.php 2019-09-16 19:08:47.000000000 +0000 @@ -1235,7 +1235,7 @@ default: if ((($this->majorversion == 2) && (strlen($frame_name) != 3)) || (($this->majorversion > 2) && (strlen($frame_name) != 4))) { $this->errors[] = 'Invalid frame name "'.$frame_name.'" for ID3v2.'.$this->majorversion; - } elseif ($frame_name{0} == 'T') { + } elseif ($frame_name[0] == 'T') { // 4.2. T??? Text information frames // Text encoding $xx // Information @@ -1246,7 +1246,7 @@ $framedata .= chr($source_data_array['encodingid']); $framedata .= $source_data_array['data']; } - } elseif ($frame_name{0} == 'W') { + } elseif ($frame_name[0] == 'W') { // 4.3. W??? URL link frames // URL if (!$this->IsValidURL($source_data_array['data'], false)) { @@ -1402,7 +1402,7 @@ break; default: - if (($frame_name{0} != 'T') && ($frame_name{0} != 'W')) { + if (($frame_name[0] != 'T') && ($frame_name[0] != 'W')) { $this->errors[] = 'Frame not allowed in ID3v2.'.$this->majorversion.': '.$frame_name; } break; @@ -1525,7 +1525,7 @@ break; default: - if (($frame_name{0} != 'T') && ($frame_name{0} != 'W')) { + if (($frame_name[0] != 'T') && ($frame_name[0] != 'W')) { $this->errors[] = 'Frame not allowed in ID3v2.'.$this->majorversion.': '.$frame_name; } break; @@ -1617,7 +1617,7 @@ break; default: - if (($frame_name{0} != 'T') && ($frame_name{0} != 'W')) { + if (($frame_name[0] != 'T') && ($frame_name[0] != 'W')) { $this->errors[] = 'Frame not allowed in ID3v2.'.$this->majorversion.': '.$frame_name; } break; @@ -1958,10 +1958,10 @@ $unsyncheddata = ''; $datalength = strlen($data); for ($i = 0; $i < $datalength; $i++) { - $thischar = $data{$i}; + $thischar = $data[$i]; $unsyncheddata .= $thischar; if ($thischar == "\xFF") { - $nextchar = ord($data{$i + 1}); + $nextchar = ord($data[$i + 1]); if (($nextchar & 0xE0) == 0xE0) { // previous byte = 11111111, this byte = 111????? $unsyncheddata .= "\x00"; diff -Nru php-getid3-1.9.17+dfsg/getid3/write.php php-getid3-1.9.18+dfsg/getid3/write.php --- php-getid3-1.9.17+dfsg/getid3/write.php 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/getid3/write.php 2019-09-16 19:08:47.000000000 +0000 @@ -311,9 +311,9 @@ } } - // Convert "TRACK" to "TRACKNUMBER" (if needed) for compatability with all formats - if (isset($this->tag_data['TRACK']) && !isset($this->tag_data['TRACKNUMBER'])) { - $this->tag_data['TRACKNUMBER'] = $this->tag_data['TRACK']; + // Convert "TRACK" to "TRACK_NUMBER" (if needed) for compatability with all formats + if (isset($this->tag_data['TRACK']) && !isset($this->tag_data['TRACK_NUMBER'])) { + $this->tag_data['TRACK_NUMBER'] = $this->tag_data['TRACK']; unset($this->tag_data['TRACK']); } @@ -559,14 +559,14 @@ } } } - $tag_data_id3v1['title'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['TITLE'] ) ? $this->tag_data['TITLE'] : array()))); - $tag_data_id3v1['artist'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['ARTIST'] ) ? $this->tag_data['ARTIST'] : array()))); - $tag_data_id3v1['album'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['ALBUM'] ) ? $this->tag_data['ALBUM'] : array()))); - $tag_data_id3v1['year'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['YEAR'] ) ? $this->tag_data['YEAR'] : array()))); - $tag_data_id3v1['comment'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['COMMENT'] ) ? $this->tag_data['COMMENT'] : array()))); - $tag_data_id3v1['track'] = intval(getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['TRACKNUMBER']) ? $this->tag_data['TRACKNUMBER'] : array())))); - if ($tag_data_id3v1['track'] <= 0) { - $tag_data_id3v1['track'] = ''; + $tag_data_id3v1['title'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['TITLE'] ) ? $this->tag_data['TITLE'] : array()))); + $tag_data_id3v1['artist'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['ARTIST'] ) ? $this->tag_data['ARTIST'] : array()))); + $tag_data_id3v1['album'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['ALBUM'] ) ? $this->tag_data['ALBUM'] : array()))); + $tag_data_id3v1['year'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['YEAR'] ) ? $this->tag_data['YEAR'] : array()))); + $tag_data_id3v1['comment'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['COMMENT'] ) ? $this->tag_data['COMMENT'] : array()))); + $tag_data_id3v1['track_number'] = intval(getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['TRACK_NUMBER']) ? $this->tag_data['TRACK_NUMBER'] : array())))); + if ($tag_data_id3v1['track_number'] <= 0) { + $tag_data_id3v1['track_number'] = ''; } $this->MergeExistingTagData('id3v1', $tag_data_id3v1); @@ -675,7 +675,7 @@ do { // if UTF-8 string does not include any characters above chr(127) then it is identical to ISO-8859-1 for ($i = 0; $i < strlen($value); $i++) { - if (ord($value{$i}) > 127) { + if (ord($value[$i]) > 127) { break 2; } } diff -Nru php-getid3-1.9.17+dfsg/.gitattributes php-getid3-1.9.18+dfsg/.gitattributes --- php-getid3-1.9.17+dfsg/.gitattributes 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/.gitattributes 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp -*.sln merge=union -*.csproj merge=union -*.vbproj merge=union -*.fsproj merge=union -*.dbproj merge=union - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff -Nru php-getid3-1.9.17+dfsg/.gitignore php-getid3-1.9.18+dfsg/.gitignore --- php-getid3-1.9.17+dfsg/.gitignore 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/.gitignore 1970-01-01 00:00:00.000000000 +0000 @@ -1,175 +0,0 @@ -helperapps/*.exe -helperapps/*.dll - - -################# -## Eclipse -################# - -*.pydevproject -.project -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.classpath -.settings/ -.loadpath - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - - -################# -## Visual Studio -################# - -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.sln.docstates - -# Build results -[Dd]ebug/ -[Rr]elease/ -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.vspscc -.builds -*.dotCover - -## TODO: If you have NuGet Package Restore enabled, uncomment this -#packages/ - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf - -# Visual Studio profiler -*.psess -*.vsp - -# ReSharper is a .NET coding add-in -_ReSharper* - -# Installshield output folder -[Ee]xpress - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish - -# Others -[Bb]in -[Oo]bj -sql -TestResults -*.Cache -ClientBin -stylecop.* -~$* -*.dbmdl - -#added for RIA/Silverlight projects -Generated_Code - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML - - - -############ -## Windows -############ - -# Windows image file caches -Thumbs.db - -# Folder config file -Desktop.ini - - -############# -## Python -############# - -*.py[co] - -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox - -#Translations -*.mo - -#Mr Developer -.mr.developer.cfg - -# Mac crap -.DS_Store -demos/php_error.log - -# Composer -/vendor -/composer.lock -/composer.local.json -/composer.phar diff -Nru php-getid3-1.9.17+dfsg/helperapps/readme.helperapps.txt php-getid3-1.9.18+dfsg/helperapps/readme.helperapps.txt --- php-getid3-1.9.17+dfsg/helperapps/readme.helperapps.txt 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/helperapps/readme.helperapps.txt 2019-09-16 19:08:47.000000000 +0000 @@ -32,11 +32,6 @@ Taken from http://unxutils.sourceforge.net/ * head.exe -* md5sum.exe -* tail.exe - -Taken from http://ebible.org/mpj/software.htm -* sha1sum.exe Taken from http://www.vorbis.com/download.psp * vorbiscomment.exe @@ -54,3 +49,6 @@ 2003.12.29: * Initial release + +2019.07.24: + * Remove obsolete md5sum.exe, sha1sum.exe, tail.exe diff -Nru php-getid3-1.9.17+dfsg/phpstan.neon php-getid3-1.9.18+dfsg/phpstan.neon --- php-getid3-1.9.17+dfsg/phpstan.neon 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/phpstan.neon 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -parameters: - excludes_analyse: - polluteScopeWithLoopInitialAssignments: true - ignoreErrors: - - '#Instantiated class COM not found#' - - '#Call to method GetFile\(\) on an unknown class COM#' - - '#Function rar_(open|list|close) not found#' - - '#Function mysql_(\w+) not found#' - - '#Constant GETID3_HELPERAPPSDIR not found#' - - '#Constant GETID3_ASF_(\w+) not found#' diff -Nru php-getid3-1.9.17+dfsg/readme.txt php-getid3-1.9.18+dfsg/readme.txt --- php-getid3-1.9.17+dfsg/readme.txt 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/readme.txt 2019-09-16 19:08:47.000000000 +0000 @@ -145,9 +145,10 @@ Requirements =========================================================================== -* PHP 4.2.0 up to 5.2.x for getID3() 1.7.x (and earlier) -* PHP 5.0.5 (or higher) for getID3() 1.8.x (and up) -* PHP 5.0.5 (or higher) for getID3() 2.0.x (and up) +* PHP 4.2.0 up to 5.2.x for getID3() 1.7.x (and earlier) +* PHP 5.0.5 (or higher) for getID3() 1.8.x (and up) +* PHP 5.3.0 (or higher) for getID3() 1.9.17 (and up) +* PHP 5.3.0 (or higher) for getID3() 2.0.x (and up) * at least 4MB memory for PHP. 8MB or more is highly recommended. 12MB is required with all modules loaded. diff -Nru php-getid3-1.9.17+dfsg/.travis.yml php-getid3-1.9.18+dfsg/.travis.yml --- php-getid3-1.9.17+dfsg/.travis.yml 2019-02-07 17:30:03.000000000 +0000 +++ php-getid3-1.9.18+dfsg/.travis.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -language: php -sudo: false - -cache: - directories: - - $HOME/.composer/cache/files - -php: - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - 7.2 - -matrix: - include: - - php: 5.3 - dist: precise - - php: 7.1 - env: PHPSTAN=1 - -before_script: - - travis_retry composer install --prefer-source --quiet --no-interaction - - if [[ $PHPSTAN = 1 ]]; then composer require --dev phpstan/phpstan:^0.9; fi - -script: - - composer lint - - if [[ $PHPSTAN = 1 ]]; then vendor/bin/phpstan analyse -c phpstan.neon -l 4 getid3; fi
m3ufilenametrack
m3u'.htmlentities($row['filename']).''.htmlentities($row['track']).''.htmlentities($row['track_number']).'
m3u'.htmlentities($row['filename']).''.htmlentities($row['track']).''.htmlentities($row['track_number']).''.htmlentities($row['album']).'