Add basic logging for `UserAvatarAction::fetchRemoteAvatar()`
authorAlexander Ebert <ebert@woltlab.com>
Fri, 17 Mar 2017 15:57:55 +0000 (16:57 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 17 Mar 2017 15:57:55 +0000 (16:57 +0100)
See #2200

wcfsetup/install/files/lib/data/user/avatar/UserAvatarAction.class.php

index 860ec04ace27dbdb927e1dbfa4e4e2b7a4379535..fd81a19bab689739fbe95fe474bf6f7b2f8512fa 100644 (file)
@@ -151,6 +151,7 @@ class UserAvatarAction extends AbstractDatabaseObjectAction {
                $filename = '';
                
                // fetch avatar from URL
+               $imageData = null;
                try {
                        $request = new HTTPRequest($this->parameters['url']);
                        $request->execute();
@@ -162,6 +163,11 @@ class UserAvatarAction extends AbstractDatabaseObjectAction {
                        if ($imageData === false) throw new SystemException('Downloaded file is not an image');
                }
                catch (\Exception $e) {
+                       // log exception unless this was caused by a non-image file being supplied
+                       if ($imageData !== false) {
+                               \wcf\functions\exception\logThrowable($e);
+                       }
+                       
                        if (!empty($filename)) {
                                @unlink($filename);
                        }