The solution is to remove line 1190 from getid3.php (the line containing: "$value = (is_string($value) ? trim($value) : $value);"). The ironic thing about that line of code is that just two lines later, the author includes the warning "// do not trim!! Unicode characters will get mangled if trailing nulls are removed!"
To reproduce this, you can:
Download file http://download.jw.org/files/media_books/lr_ASL_01.wmv
The title in the file is "Teacher 01-Why Jesus Was a Great Teacher (ASL)" but the ASF tags extracted by getid3 will be "Teacher 01-Why Jesus Was a Great Teacher (ASL" (notice the missing closing parenthesis).
- Code: Select all
array(5) {
[0]=>string(41) "$comment_name = 'asf'; $tag_key = 'title'"
[1]=>string(110) "before line 1190: Teacher 01-Why Jesus Was a Great Teacher (ASL)"
[2]=>string(306) "before line 1190 (hex bytes): 54 00 65 00 61 00 63 00 68 00 65 00 72 00 20 00 30 00 31 00 2d 00 57 00 68 00 79 00 20 00 4a 00 65 00 73 00 75 00 73 00 20 00 57 00 61 00 73 00 20 00 61 00 20 00 47 00 72 00 65 00 61 00 74 00 20 00 54 00 65 00 61 00 63 00 68 00 65 00 72 00 20 00 28 00 41 00 53 00 4c 00 29 00 "
[3]=>string(108) "after line 1190: Teacher 01-Why Jesus Was a Great Teacher (ASL)"
[4]=>string(302) "after line 1190 (hex bytes): 54 00 65 00 61 00 63 00 68 00 65 00 72 00 20 00 30 00 31 00 2d 00 57 00 68 00 79 00 20 00 4a 00 65 00 73 00 75 00 73 00 20 00 57 00 61 00 73 00 20 00 61 00 20 00 47 00 72 00 65 00 61 00 74 00 20 00 54 00 65 00 61 00 63 00 68 00 65 00 72 00 20 00 28 00 41 00 53 00 4c 00 29 "
}
As you see in the dump above, the string is still okay (at this point), but the trim caused the second byte of the last character ")" to be removed (it should be "29 00" since it's encoded in UTF16). Later on the code will use iconv to convert the string, and iconv will then give the following errors:
- Code: Select all
Notice: /qa_trunk/lib/getid3/getid3.lib.php line 902 - iconv() [<a href='function.iconv'>function.iconv</a>]: Detected an incomplete multibyte character in input string
Notice: /qa_trunk/lib/getid3/getid3.lib.php line 902 - iconv() [<a href='function.iconv'>function.iconv</a>]: Detected an illegal character in input string
At this point, the last parenthesis is gone. This happens on multiple tags - I'm just using the title as an example.
