• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

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

#1
Hello!

We often get this error in our server-errors:
copy(/home/***/web/internal_data/attachments/814/814999-c0ad728236319f93846df2435ed4950b.data): failed to open stream: No such file or directory
Vor 16 Minuten - library/XenGallery/Model/Watermark.php:161
Code:
PHP:
$success = copy($internalDataPath, $originalPath);
Is it possible to add also a file_exists check for $internalDataPath and not only for $watermarkPath?

Best regards
Harald
 

Chris D

XenForo developer
Staff member
#2
We could add a check there, but really the reason that there isn't one right now is that there's really no expectation that the file wouldn't exist. This is effectively saying that the media itself is missing, which obviously shouldn't be possible - it shouldn't even be possible to attempt to watermark it if it's missing.

Is there a more complete stack trace from the server error log?

Which version are you running exactly?

Is it the same error every time (e.g. the same file name 814/814999-c0ad728236319f93846df2435ed4950b.data)? Does that file actually exist, or not?

Is this something that can be reproduced reliably by taking a specific action or does it appear to be random?
 
#3
Hello Chris D,

thank you for your answer.

Is there a more complete stack trace from the server error log?
Here you go:
ErrorException: copy(/home/***/web/internal_data/attachments/815/815578-e320b836d40075a85c0b0f7f7ebceb23.data): failed to open stream: No such file or directory - library/XenGallery/Model/Watermark.php:161
Generiert durch:---, Heute um 14:18 Uhr

Stapelverfolgung
#0 [internal function]: XenForo_Application::handlePhpError(2, 'copy(/home/***...', '/home/***...', 161, Array)
#1 /home/***/web/library/XenGallery/Model/Watermark.php(161): copy('/home/***...', '/home/***...')
#2 /home/***/web/library/XenGallery/ControllerPublic/Media.php(3219): XenGallery_Model_Watermark->addWatermarkToImage(Array)
#3 /home/***/web/library/XenGallery/ControllerPublic/Media.php(2988): XenGallery_ControllerPublic_Media->_associateAttachmentsAndMedia(Array, Array, Array)
#4 /home/***/web/library/XenForo/FrontController.php(351): XenGallery_ControllerPublic_Media->actionSaveMedia()
#5 /home/***/web/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#6 /home/***/web/index.php(13): XenForo_FrontController->run()
#7 {main}
Benötigter Status
array(3) {
["url"] => string(45) "https://www.***.at/galerie/save-media"
["_GET"] => array(0) {
}
["_POST"] => array(15) {
["type"] => string(5) "album"
["album_id"] => string(22) "140887.wiener Neustadt"
["image_upload_type"] => string(6) "upload"
["image_upload"] => array(6) {
[2037361] => array(5) {
["media_title"] => string(6) "sieht "
["media_description"] => string(0) ""
["media_tag"] => string(0) ""
["media_embed_url_original"] => string(0) ""
["media_embed_url"] => string(0) ""
}
[2037360] => array(5) {
["media_title"] => string(4) "gut "
["media_description"] => string(0) ""
["media_tag"] => string(0) ""
["media_embed_url_original"] => string(0) ""
["media_embed_url"] => string(0) ""
}
[2037359] => array(5) {
["media_title"] => string(3) "aus"
["media_description"] => string(0) ""
["media_tag"] => string(0) ""
["media_embed_url_original"] => string(0) ""
["media_embed_url"] => string(0) ""
}
[2037358] => array(5) {
["media_title"] => string(4) "fein"
["media_description"] => string(0) ""
["media_tag"] => string(0) ""
["media_embed_url_original"] => string(0) ""
["media_embed_url"] => string(0) ""
}
[2037357] => array(5) {
["media_title"] => string(5) "mein "
["media_description"] => string(0) ""
["media_tag"] => string(0) ""
["media_embed_url_original"] => string(0) ""
["media_embed_url"] => string(0) ""
}
[2037355] => array(5) {
["media_title"] => string(8) "kleiner "
["media_description"] => string(0) ""
["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) "d1b2e5116608cff839dee644fad8f109"
["video_upload_hash"] => string(32) "be66f264646a8b2ee889f8b17a20277f"
["container_type"] => string(5) "album"
["container_id"] => string(6) "140887"
["_xfConfirm"] => string(1) "1"
["_xfToken"] => string(8) "********"
["_xfRequestUri"] => string(12) "/galerie/add"
["_xfNoRedirect"] => string(1) "1"
["_xfResponseType"] => string(4) "json"
}
}
Which version are you running exactly?
XF 1.5.9 (+Patch xf_patch_1510), XFMG 1.1.8

Is it the same error every time (e.g. the same file name 814/814999-c0ad728236319f93846df2435ed4950b.data)? Does that file actually exist, or not?
Since the error always occures when uploading/saving new media, it is always a other filename - a new filename.
The file does NOT exist actually.

Is this something that can be reproduced reliably by taking a specific action or does it appear to be random?
It appears to be random - I cannot reproduce it.

regards Harald