Uncaught exception on unknown file formats

sirc - June 16, 2008 - 04:41
Project:getID3()
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work
Description

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

<?php
/**
* 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;
}
?>

#1

drewish - June 16, 2008 - 05:02
Version:5.x-1.1» 6.x-1.x-dev
Status:active» needs work

if this is a problem in 6.x we need to fix it there and then back port a fix.

 
 

Drupal is a registered trademark of Dries Buytaert.