Fixed copy: failed to open stream: No such file or directory

rfc0001

Well-known member
I have a consistent repro fro this issue on XF 1.5.14.

The error occurs if the user uploads multiple media with tags, and gets any tag permissions error (e.g. tag less that x characters not allowed, more than x tags not allowed, tag creation not allowed), in which case the upload will subsequently fail after removing the offending tag(s) and resubmitting. The error is always the same in the server log:

Error:

Code:
copy(/public_html/forum/internal_data/attachments/13/13823-6ae2c248ad8271fe42aa830d5cb8eff9.data): failed to open stream: No such file or directory
Saturday at 7:40 PM - library/XenGallery/Model/Watermark.php:161

Stack Trace:

Code:
Error Info
ErrorException: copy(/public_html/forum/internal_data/attachments/13/13823-6ae2c248ad8271fe42aa830d5cb8eff9.data): failed to open stream: No such file or directory - library/XenGallery/Model/Watermark.php:161
Generated By: User123, Saturday at 7:40 PM
Stack Trace
#0 [internal function]: XenForo_Application::handlePhpError(2, 'copy(/home/dvci...', '/...', 161, Array)
#1 /public_html/forum/library/XenGallery/Model/Watermark.php(161): copy('/...', '/...')
#2 /public_html/forum/library/XenGallery/ControllerPublic/Media.php(3219): XenGallery_Model_Watermark->addWatermarkToImage(Array)
#3 /public_html/forum/library/XenGallery/ControllerPublic/Media.php(2988): XenGallery_ControllerPublic_Media->_associateAttachmentsAndMedia(Array, Array, Array)
#4 /public_html/forum/library/XenForo/FrontController.php(351): XenGallery_ControllerPublic_Media->actionSaveMedia()
#5 /public_html/forum/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#6 /public_html/forum/index.php(13): XenForo_FrontController->run()
#7 {main}
Request State
array(3) {
  ["url"] => string(42) "https://xyz.com/forum/media/save-media"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(14) {
    ["type"] => string(5) "album"
    ["album_id"] => string(17) "48.TripReport"
    ["image_upload_type"] => string(6) "upload"
    ["image_upload"] => array(16) {
      [14037] => array(6) {
        ["media_title"] => string(31) "Watching the Activity"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(76) "world,night,train,water,modern"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
      [14036] => array(6) {
        ["media_title"] => string(31) "Watching the Activity"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(57) "lake,world,night,modern"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
      [14035] => array(6) {
        ["media_title"] => string(31) "Watching the Activity"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(69) "lake,world,night,water"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
      [14034] => array(6) {
        ["media_title"] => string(31) "Watching the Activity"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(69) "lake,world,night,water"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
      [14033] => array(6) {
        ["media_title"] => string(31) "Watching the Activity"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(69) "world,night,magic,happy,building"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
      [14032] => array(6) {
        ["media_title"] => string(31) "Watching the Activity"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(70) "lake,world,night,happy,building"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
      [14031] => array(6) {
        ["media_title"] => string(31) "Watching the Activity"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(70) "lake,world,night,happy,building"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
      [14030] => array(6) {
        ["media_title"] => string(31) "Watching the Activity"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(65) "world,fireworks,night,happy,building"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
      [14029] => array(6) {
        ["media_title"] => string(31) "Watching the Activity"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(65) "world,fireworks,night,happy,building"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
      [14028] => array(6) {
        ["media_title"] => string(31) "Watching the Activity"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(65) "world,fireworks,night,happy,building"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
      [14027] => array(6) {
        ["media_title"] => string(31) "Watching the Activity"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(65) "world,fireworks,night,happy,building"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
      [14026] => array(6) {
        ["media_title"] => string(31) "Watching the Activity"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(65) "world,fireworks,night,happy,building"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
      [14025] => array(6) {
        ["media_title"] => string(31) "Watching the Activity"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(65) "world,fireworks,night,happy,building"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
      [14024] => array(6) {
        ["media_title"] => string(31) "Watching the Activity"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(48) "lake,world,fireworks"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
      [14023] => array(6) {
        ["media_title"] => string(31) "Watching the Activity"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(59) "lake,world,night,space"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
      [14022] => array(6) {
        ["media_title"] => string(28) "modern Marina at Night"
        ["media_description"] => string(14) "from July 2017"
        ["tags"] => string(20) "lake,night"
        ["media_tag"] => string(0) ""
        ["media_embed_url_original"] => string(0) ""
        ["media_embed_url"] => string(0) ""
      }
    }
    ["media_image_upload"] => string(4) "true"
    ["media_"] => string(4) "true"
    ["image_upload_hash"] => string(32) "a3128c2b0b21db5ebf488a230472e9f5"
    ["container_type"] => string(5) "album"
    ["container_id"] => string(2) "48"
    ["_xfConfirm"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(28) "/forum/media/add?album_id=48"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}

Thanks.
 
This was already fixed in XFMG 2.0.0. Unfortunately the required changes are too extensive to port back to XFMG 1.x.
 
Back
Top Bottom