Uncaught exception on unknown file formats

Created on 16 June 2008, over 16 years ago
Updated 21 November 2024, about 1 month ago

I have a need to upload some files that are not in a file format supported by getid3, unfortunately getid3 spits out an ugly error to the user because an exception is thrown when the file is analyzed.

This really should be caught by the module and better handled in drupal, for my application if there is no id3 information then these fields should be able to be left blank.

I have marked this issue under version 5.x.1.1 as that is what I am using but I just checked the 6.x code and it noticed this isn't handled there as well.

The simple fix I have come up with is shown below

/**
 * Analyze file and return its media information.
 */
function &getid3_analyze($path) {
  $info = array();
  if($id3 = &getid3_instance()) {
    try {
        $info = $id3-> analyze($path);
    } catch (getid3_exception $e) {
        // you could do something here with the error, maybe saved in drupal's error log
    }
    unset($id3);
  }
  return $info;
}
πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024