Fixed Legit attachments sometimes marked as "unassociated" and disappear after 24 hours

I mean it's possible it could be related but there's clearly another aspect to that particular issue which is the message too long error. Currently I do not believe it is related.

Please bear in mind that attachments being unassociated is an entirely expected and normal part of the attachment upload process until the content is submitted which is the point at which the attachment is associated to the content being created. Clearly on that one occasion it happened, something else occurred which we've not seen any other reports of hence why it is being kept as an entirely separate report for now.

Any further comment specifically related to the "Message is too long" error should be kept in that other thread.
 
It looks like someone may have reproduced the issue here and others may have been able to reproduce without add-ons enabled so currently add-ons aren't believed to be a factor.
 
Mostly interested in that specific error right now as it will eliminate one factor. Pretty sure it's unrelated to the general issue.

Same error:
LogicException: Temp hash must be specified if no content is specified.
src/XF/Entity/Attachment.php:270

Details below:
  • Happened only once so far, but multiple times since the user tried multiple times (Firefox is the browser).
  • The user posted the image in the test forum successfully. Then retried in the actual thread and it failed again.
  • I asked for the image from the user and successfully posted it in the same thread.
  • Then the user tried once again, in the same thread, same attachment, same browser, and it worked.
 
Server error log
LogicException: Temp hash must be specified if no content is specified. src/XF/Entity/Attachment.php:270
Generated by: Offagain Feb 21, 2021 at 10:21 AM
Stack trace
#0 src/XF/Mvc/Entity/Entity.php(1355): XF\Entity\Attachment->_preSave()
#1 src/XF/Mvc/Entity/Entity.php(1208): XF\Mvc\Entity\Entity->preSave()
#2 src/XF/Service/Attachment/Preparer.php(267): XF\Mvc\Entity\Entity->save()
#3 src/XF/Service/Attachment/Preparer.php(29): XF\Service\Attachment\Preparer->insertTemporaryAttachment(Object(XFMG\XF\Attachment\Post), Object(XFMG\XF\Entity\AttachmentData), '[{"id":"4364803...', Object(XF\FileWrapper))
#4 src/XF/Attachment/Manipulator.php(170): XF\Service\Attachment\Preparer->insertAttachment(Object(XFMG\XF\Attachment\Post), Object(XF\FileWrapper), Object(SV\SignupAbuseBlocking\XF\Entity\User), '[{"id":"4364803...')
#5 src/XF/Pub/Controller/Attachment.php(89): XF\Attachment\Manipulator->insertAttachmentFromUpload(Object(XF\Http\Upload), NULL)
#6 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\Attachment->actionUpload(Object(XF\Mvc\ParameterBag))
#7 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Attachment', 'Upload', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#8 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#9 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#10 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#11 src/XF.php(488): XF\App->run()
#12 index.php(20): XF::runApp('XF\\Pub\\App')
#13 {main}
Request state
array(4) {
["url"] => string(139) "/forum/attachments/upload?type=post&context[thread_id]=42763&hash=%5B%7B%22id%22%3A%224364803-0%22%7D%2C%7B%22id%22%3A%224365070-0%22%7D%5D"
["referrer"] => string(101) "https://www.mysite.co.uk/forum/threads/💜mornings💜.42763/page-8818"
["_GET"] => array(3) {
["type"] => string(4) "post"
["context"] => array(1) {
["thread_id"] => string(5) "42763"
}
["hash"] => string(39) "[{"id":"4364803-0"},{"id":"4365070-0"}]"
}
["_POST"] => array(11) {
["_xfToken"] => string(8) "********"
["_xfResponseType"] => string(4) "json"
["_xfWithData"] => string(1) "1"
["flowChunkNumber"] => string(1) "1"
["flowChunkSize"] => string(10) "4294967296"
["flowCurrentChunkSize"] => string(7) "6555605"
["flowTotalSize"] => string(7) "6555605"
["flowIdentifier"] => string(26) "6555605-20210220_130319jpg"
["flowFilename"] => string(19) "20210220_130319.jpg"
["flowRelativePath"] => string(19) "20210220_130319.jpg"
["flowTotalChunks"] => string(1) "1"
}
}
 
Same error:
LogicException: Temp hash must be specified if no content is specified.
src/XF/Entity/Attachment.php:270

Details below:
  • Happened only once so far, but multiple times since the user tried multiple times (Firefox is the browser).
  • The user posted the image in the test forum successfully. Then retried in the actual thread and it failed again.
  • I asked for the image from the user and successfully posted it in the same thread.
  • Then the user tried once again, in the same thread, same attachment, same browser, and it worked.
Can you get us the full stack trace too, please, similar to this:

Temp hash must be specified if no content is specified.
src/XF/Entity/Attachment.php:270

Stack trace​

#0 src/XF/Mvc/Entity/Entity.php(1355): XF\Entity\Attachment->_preSave()
#1 src/XF/Mvc/Entity/Entity.php(1208): XF\Mvc\Entity\Entity->preSave()
#2 src/XF/Service/Attachment/Preparer.php(267): XF\Mvc\Entity\Entity->save()
#3 src/XF/Service/Attachment/Preparer.php(29): XF\Service\Attachment\Preparer->insertTemporaryAttachment(Object(XFMG\XF\Attachment\Post), Object(XFMG\XF\Entity\AttachmentData), '[{"id":"1516294...', Object(XF\FileWrapper))
#4 src/XF/Attachment/Manipulator.php(170): XF\Service\Attachment\Preparer->insertAttachment(Object(XFMG\XF\Attachment\Post), Object(XF\FileWrapper), Object(XFMG\XF\Entity\User), '[{"id":"1516294...')
#5 src/XF/Pub/Controller/Attachment.php(89): XF\Attachment\Manipulator->insertAttachmentFromUpload(Object(XF\Http\Upload), NULL)
#6 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\Attachment->actionUpload(Object(XF\Mvc\ParameterBag))
#7 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Attachment', 'Upload', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#8 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#9 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#10 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#11 src/XF.php(488): XF\App->run()
#12 index.php(20): XF::runApp('XF\\Pub\\App')
#13 {main}
 
Can you get us the full stack trace too, please, similar to this:

On forum we use SignupAbuseBlocking, it looks like that:

Stack trace
#0 src/XF/Mvc/Entity/Entity.php(1355): XF\Entity\Attachment->_preSave()
#1 src/XF/Mvc/Entity/Entity.php(1208): XF\Mvc\Entity\Entity->preSave()
#2 src/XF/Service/Attachment/Preparer.php(267): XF\Mvc\Entity\Entity->save()
#3 src/XF/Service/Attachment/Preparer.php(29): XF\Service\Attachment\Preparer->insertTemporaryAttachment(Object(XFMG\XF\Attachment\Post), Object(XFMG\XF\Entity\AttachmentData), '[{"id":"1879682...', Object(XF\FileWrapper))
#4 src/XF/Attachment/Manipulator.php(170): XF\Service\Attachment\Preparer->insertAttachment(Object(XFMG\XF\Attachment\Post), Object(XF\FileWrapper), Object(SV\SignupAbuseBlocking\XF\Entity\User), '[{"id":"1879682...')
#5 src/XF/Pub/Controller/Attachment.php(89): XF\Attachment\Manipulator->insertAttachmentFromUpload(Object(Forumhelden\ExifSaver\XF\Http\Upload), NULL)
#6 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\Attachment->actionUpload(Object(XF\Mvc\ParameterBag))
#7 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Attachment', 'Upload', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#8 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#9 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#10 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#11 src/XF.php(488): XF\App->run()
#12 index.php(20): XF::runApp('XF\\Pub\\App')
#13 {main}
 
#4 src/XF/Attachment/Manipulator.php(170): XF\Service\Attachment\Preparer->insertAttachment(Object(XFMG\XF\Attachment\Post), Object(XF\FileWrapper), Object(SV\SignupAbuseBlocking\XF\Entity\User), '[{"id":"1879682...')
As @PaulB noted earlier, the temp hash validation appears to be failing in some fashion in this particular case. It's not exceeding the length but it is in an unusual format that isn't coming from XF so likely an add-on involved in that.It's not necessarily that add-on though. That's just the last add-on to extend the XF\Entity\User class.

I think we might need to branch that off into a different bug report as I'm not convinced its related.

(I'll move the posts out to create the new report if that becomes necessary).
 
Just to be clear; is everyone seeing this specific error in their logs related to this issue?

Can you check your post_max_size value (you should be able to see it from the server environment report in your Admin CP) and see if it is higher or lower than your configured max upload file size in Options > Attachments?


This is typical of the issue when it materialises...

1614207654422.webp

So far I haven't seen any errors relating to this with our ACP


ACP: PHP post_max_size 400M

From Options>Attachments...
1614208076668.webp
 
It is like a "Whodunit" movie where we guess who the murderer was. I am curious to know what all this was about and why it appeared in this release? :D

Thanks for the support.
 
It would seem that once you trigger the error, and do not leave the page or refresh, any subsequent images attached in the thread by you are broken as well.

If you refresh the page, then you are able to successfully post the images.
 
Propbably not related, but the problem I had with threads containing unassociated attachments breaking the page layout on OLD browsers disappeared with this latest release.
 
I cleared the errors, but I have database backup right before that. I'll restore it to my development server, and paste the error here. It will take a bit. Thanks.
Thank you for submitting a ticket with the details. The stack trace and request state are as follows:

Code:
#0 src/XF/Mvc/Entity/Entity.php(1355): XF\Entity\Attachment->_preSave()
#1 src/XF/Mvc/Entity/Entity.php(1208): XF\Mvc\Entity\Entity->preSave()
#2 src/XF/Service/Attachment/Preparer.php(267): XF\Mvc\Entity\Entity->save()
#3 src/XF/Service/Attachment/Preparer.php(29): XF\Service\Attachment\Preparer->insertTemporaryAttachment(Object(XF\Attachment\Post), Object(XF\Entity\AttachmentData), '[{"id":"5559610...', Object(XF\FileWrapper))
#4 src/XF/Attachment/Manipulator.php(170): XF\Service\Attachment\Preparer->insertAttachment(Object(XF\Attachment\Post), Object(XF\FileWrapper), Object(XFRM\XF\Entity\User), '[{"id":"5559610...')
#5 src/XF/Pub/Controller/Attachment.php(89): XF\Attachment\Manipulator->insertAttachmentFromUpload(Object(XF\Http\Upload), NULL)
#6 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\Attachment->actionUpload(Object(XF\Mvc\ParameterBag))
#7 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Attachment', 'Upload', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#8 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#9 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#10 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#11 src/XF.php(488): XF\App->run()
#12 index.php(20): XF::runApp('XF\\Pub\\App')
#13 {main}

array(4) {
["url"] => string(211) "upload?type=post&context[thread_id]=1162384&hash=%5B%7B%22id%22%3A%225559610-0%22%7D%2C%7B%22id%22%3A%225560678-0%22%7D%2C%7B%22id%22%3A%225565847-0%22%7D%2C%7B%22id%22%3A%225642286-0%22%7D%5D"
["referrer"] => string(80) "A"
["_GET"] => array(3) {
["type"] => string(4) "post"
["context"] => array(1) {
["thread_id"] => string(7) "1162384"
}
["hash"] => string(77) "[{"id":"5559610-0"},{"id":"5560678-0"},{"id":"5565847-0"},{"id":"5642286-0"}]"
}
["_POST"] => array(11) {
["_xfToken"] => string(8) "********"
["_xfResponseType"] => string(4) "json"
["_xfWithData"] => string(1) "1"
["flowChunkNumber"] => string(1) "1"
["flowChunkSize"] => string(10) "4294967296"
["flowCurrentChunkSize"] => string(6) "124666"
["flowTotalSize"] => string(6) "124666"
["flowIdentifier"] => string(26) "124666-A01jpg"
["flowFilename"] => string(20) "A.jpg"
["flowRelativePath"] => string(20) "A.jpg"
["flowTotalChunks"] => string(1) "1"
}
}
 
Top Bottom