Fixed Video and Picture upload fails

HWS

Well-known member
XF version 1.4.4
XFMG version 1.0.2
Default style, no other add-ons

If you want to upload a new picture and a new video together into an album, an error occurs:

Code:
ErrorException: Undefined offset: 0 - library/XenGallery/ControllerPublic/Media.php:2826
Generated By: admin, Today at 10:49 AM
Stack Trace
#0 /*****/library/XenGallery/ControllerPublic/Media.php(2826): XenForo_Application::handlePhpError(8, 'Undefined offse...', '/*****...', 2826, Array)
#1 /*****/library/XenForo/FrontController.php(347): XenGallery_ControllerPublic_Media->actionSaveMedia()
#2 /*****/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#3 /*****/index.php(13): XenForo_FrontController->run()
#4 {main}
Request State
array(3) {
  ["url"] => string(41) "http://*****/index.php?media/save-media"
  ["_GET"] => array(1) {
    ["media/save-media"] => string(0) ""
  }
  ["_POST"] => array(21) {
    ["type"] => string(5) "album"
    ["album_id"] => string(11) "1.Testalbum"
    ["image_url"] => string(0) ""
    ["media_title_all"] => string(0) ""
    ["media_description_all"] => string(0) ""
    ["media_title"] => array(2) {
      ["image_upload"] => array(1) {
        [23] => string(11) "White Phone"
      }
      ["video_embed"] => array(1) {
        [0] => string(36) "Taylor Swift - Blank Space - YouTube"
      }
    }
    ["media_embed_url"] => array(2) {
      ["video_embed"] => array(3) {
        [23] => string(0) ""
        [24] => string(0) ""
        [25] => string(43) "https://www.youtube.com/watch?v=e-ORhEE9VVg"
      }
      ["image_upload"] => array(1) {
        [0] => string(0) ""
      }
    }
    ["media_description"] => array(2) {
      ["image_upload"] => array(1) {
        [23] => string(21) "This is a white phone"
      }
      ["video_embed"] => array(1) {
        [0] => string(162) "Watch Taylor's new video for "Blank Space". No animals, trees, automobiles or actors were harmed in the making of this video. Taylor’s new release 1989 is Av..."
      }
    }
    ["media_tag"] => array(2) {
      ["image_upload"] => array(1) {
        [0] => string(0) ""
      }
      ["video_embed"] => array(1) {
        [0] => string(34) "[MEDIA=youtube]e-ORhEE9VVg[/MEDIA]"
      }
    }
    ["media_embed_url_original"] => array(2) {
      ["image_upload"] => array(1) {
        [0] => string(0) ""
      }
      ["video_embed"] => array(1) {
        [0] => string(0) ""
      }
    }
    ["media_image_upload"] => string(4) "true"
    ["image_upload_hash"] => string(32) "f2843e12ad172c66fa5cf36cec9dc0c8"
    ["embed_url"] => string(0) ""
    ["media_video_embed"] => string(4) "true"
    ["container_type"] => string(5) "album"
    ["container_id"] => string(1) "1"
    ["_xfConfirm"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(35) "/*****/index.php?media/add&album_id=1"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}

Uploading both separately works without problems.
 
I've just tested this here, and although it logged an error, both submitted without issue.

I'll need to work out why the code is doing that, but I can confirm the issue, but can you confirm the media saving actually failed?
 
Top Bottom