[wp-trac] [WordPress Trac] #26845: MP3 ID3 Tag Metadata Malformed
WordPress Trac
noreply at wordpress.org
Wed Jan 15 21:21:31 UTC 2014
#26845: MP3 ID3 Tag Metadata Malformed
--------------------------+-----------------------------
Reporter: chipbennett | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 3.8
Severity: normal | Keywords:
--------------------------+-----------------------------
= Issue: =
Retrieving audio/mp3 attachment metadata returns malformed serialized data
for metadata generated from ID3 tags.
= To reproduce: =
1. Upload/attach mp3 file containing valid ID3 tags to a post
2. Query attached audio files:
{{{
$tracks = get_children( array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'post_mime_type' => 'audio',
) );
// Loop through them
foreach ( $tracks as $track ) {}
}}}
3. Attempt to retrieve metadata using either method:
{{{
$metadata = get_post_meta( $track->ID, '_wp_attachment_metadata', true );
// or
$metadata = wp_get_attachment_metadata( $track->ID );
}}}
= Example =
Above procedure performed on a small mp3 file with valid ID3 tags produces
the following output:
{{{
a:29:{s:10:"dataformat";s:3:"mp3";s:8:"channels";i:2;s:11:"sample_rate";i:44100;s:7:"bitrate";d:237594.2401960784;s:11:"channelmode";s:12:"joint
stereo";s:12:"bitrate_mode";s:3:"abr";s:5:"codec";s:4:"LAME";s:7:"encoder";s:15:"LAME3.98
(beta)";s:8:"lossless";b:0;s:15:"encoder_options";s:3:"ABR";s:17:"compression_ratio";d:0.16836326544506688;s:10:"fileformat";s:3:"mp3";s:8:"filesize";i:531738;s:9:"mime_type";s:10:"audio/mpeg";s:6:"length";i:10;s:16:"length_formatted";s:4:"0:09";s:5:"title";s:5:"There";s:6:"artist";s:20:"They
Might Be Giants";s:5:"album";s:8:"Nanobots";s:5:"genre";s:16:"Alternative
Rock";s:8:"composer";s:14:"Not Documented";s:9:"conductor";s:2:""
}}}
And dumping it:
{{{
var_dump( $metadata );
}}}
Results in:
{{{
bool(false)
}}}
Attempting to correct malformed syntax like so:
{{{
a:22:{s:10:"dataformat";s:3:"mp3";s:8:"channels";i:2;s:11:"sample_rate";i:44100;s:7:"bitrate";d:237594.2401960784;s:11:"channelmode";s:12:"joint
stereo";s:12:"bitrate_mode";s:3:"abr";s:5:"codec";s:4:"LAME";s:7:"encoder";s:15:"LAME3.98
(beta)";s:8:"lossless";b:0;s:15:"encoder_options";s:3:"ABR";s:17:"compression_ratio";d:0.16836326544506688;s:10:"fileformat";s:3:"mp3";s:8:"filesize";i:531738;s:9:"mime_type";s:10:"audio/mpeg";s:6:"length";i:10;s:16:"length_formatted";s:4:"0:09";s:5:"title";s:5:"There";s:6:"artist";s:20:"They
Might Be Giants";s:5:"album";s:8:"Nanobots";s:5:"genre";s:16:"Alternative
Rock";s:8:"composer";s:14:"Not Documented";s:9:"conductor";s:2:"na";}
}}}
And dumping it:
{{{
var_dump( $metadata );
}}}
Results in:
{{{
array(22) { ["dataformat"]=> string(3) "mp3" ["channels"]=> int(2)
["sample_rate"]=> int(44100) ["bitrate"]=> float(237594.24019608)
["channelmode"]=> string(12) "joint stereo" ["bitrate_mode"]=> string(3)
"abr" ["codec"]=> string(4) "LAME" ["encoder"]=> string(15) "LAME3.98
(beta)" ["lossless"]=> bool(false) ["encoder_options"]=> string(3) "ABR"
["compression_ratio"]=> float(0.16836326544507) ["fileformat"]=> string(3)
"mp3" ["filesize"]=> int(531738) ["mime_type"]=> string(10) "audio/mpeg"
["length"]=> int(10) ["length_formatted"]=> string(4) "0:09" ["title"]=>
string(5) "There" ["artist"]=> string(20) "They Might Be Giants"
["album"]=> string(8) "Nanobots" ["genre"]=> string(16) "Alternative Rock"
["composer"]=> string(14) "Not Documented" ["conductor"]=> string(2) "na"
}
}}}
= Reproducibility =
I repeated the process with four different MP3 files from the same album.
I then repeated the process with three different MP3 files from a
different album.
All appear to have a serialization issue at/after "conductor". The
serialization halts, resulting in only 22 of the 29 array keys being added
to the serialized string, and the 22nd ("conductor") being malformed.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26845>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list