summaryrefslogtreecommitdiff
path: root/classes/File.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/File.php')
-rw-r--r--classes/File.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/classes/File.php b/classes/File.php
index da029e39b..c7c765802 100644
--- a/classes/File.php
+++ b/classes/File.php
@@ -217,12 +217,19 @@ class File extends Memcached_DataObject
static function filename($profile, $basename, $mimetype)
{
require_once 'MIME/Type/Extension.php';
+
+ // We have to temporarily disable auto handling of PEAR errors...
+ PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
+
$mte = new MIME_Type_Extension();
- try {
- $ext = $mte->getExtension($mimetype);
- } catch ( Exception $e) {
+ $ext = $mte->getExtension($mimetype);
+ if (PEAR::isError($ext)) {
$ext = strtolower(preg_replace('/\W/', '', $mimetype));
}
+
+ // Restore error handling.
+ PEAR::staticPopErrorHandling();
+
$nickname = $profile->nickname;
$datestamp = strftime('%Y%m%dT%H%M%S', time());
$random = strtolower(common_confirmation_code(32));