We were advised by Xenforo to open a bug report, have any of you done that yet?
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...')
maxLength
on Attachment's temp_hash
field. When I forcefully set the hash to a long JSON string, I get the same stack trace as you.ValueFormatter
marks the error as please_enter_value_using_x_characters_or_fewer
; however, Preparer
's insertTemporaryAttachment
simply discards the error and continues anyway. If save
actually ran to completion, it might at least throw something useful, but the check on temp_hash
being empty happens in Attachment
's _preSave
even when the entity is already known to have errors:protected function _preSave()
{
if (!$this->content_id)
{
if (!$this->temp_hash)
{
// $this->hasErrors() is true; this code shouldn't be running. The save will fail anyway.
//throw new \LogicException('Temp hash must be specified if no content is specified.');
}
$this->unassociated = true;
}
else
{
$this->temp_hash = '';
$this->unassociated = false;
}
}
throw
statement does result in a proper error response, although it's not much more intuitive:{
"status": "error",
"errors": {
"temp_hash": "Please enter a value using 32 characters or fewer."
},
"errorHtml": {
"content": "\n\n<div class=\"blockMessage\">\n\t\n\t\tPlease enter a value using 32 characters or fewer.\n\t\n</div>",
"title": "Oops! We ran into some problems."
},
"visitor": {
"conversations_unread": "0",
"alerts_unviewed": "0",
"total_unread": "0"
},
"debug": {
"time": 0.0695,
"queries": 10,
"memory": 2.25
}
}
hash
field.Look at that screenshot from DB, there are 4 entrys with that id stuff:That doesn't look right. That last parameter is supposed to be the temp hash, but it appears to contain JSON instead. That's probably going to exceed the 32-charactermaxLength
on Attachment'stemp_hash
field. When I forcefully set the hash to a long JSON string, I get the same stack trace as you.
What's interesting is that errors don't seem to be bubbling.ValueFormatter
marks the error asplease_enter_value_using_x_characters_or_fewer
; however,Preparer
'sinsertTemporaryAttachment
simply discards the error and continues anyway. Ifsave
actually ran to completion, it might at least throw something useful, but the check ontemp_hash
being empty happens inAttachment
's_preSave
even when the entity is already known to have errors:
PHP:protected function _preSave() { if (!$this->content_id) { if (!$this->temp_hash) { // $this->hasErrors() is true; this code shouldn't be running. The save will fail anyway. //throw new \LogicException('Temp hash must be specified if no content is specified.'); } $this->unassociated = true; } else { $this->temp_hash = ''; $this->unassociated = false; } }
Commenting out thethrow
statement does result in a proper error response, although it's not much more intuitive:
JSON:{ "status": "error", "errors": { "temp_hash": "Please enter a value using 32 characters or fewer." }, "errorHtml": { "content": "\n\n<div class=\"blockMessage\">\n\t\n\t\tPlease enter a value using 32 characters or fewer.\n\t\n</div>", "title": "Oops! We ran into some problems." }, "visitor": { "conversations_unread": "0", "alerts_unviewed": "0", "total_unread": "0" }, "debug": { "time": 0.0695, "queries": 10, "memory": 2.25 } }
However, this error is never displayed to the user, and the upload appears successful. One could argue that the error handling here is incorrect, but that wouldn't actually solve the issue. Somehow, you're ending with a badhash
field.
Those should be MD5 hashes. I tried poking around to see if I could get JSON in there, but I can't find a way with a vanilla installation. ThatLook at that screenshot from DB, there are 4 entrys with that id stuff:
Post in thread 'Unassociated attachments' https://xenforo.com/community/threads/unassociated-attachments.190878/post-1501142
hash
value is passed as a querystring parameter even with POST requests; I'd be curious to see whether it shows up in your access logs, or whether it's getting overwritten server-side somehow.I'm confident that it started after the upgrade.
Same here, 75% of our content is photos. Wish they would hurry up and figure this out for us all.Just done. This is driving my customers mad, especially on a photo contest forum section!
Maybe they are, but a simple, "We are looking at this guys" would save a lot of angst.From the silence treatment it looks like they are working on this problem to figure out what happened wrong.
There are a lot of things one can criticize about XF but without a doubt in my 7 years the "bug treatment" worked excellent here on XenForo. You can always rely on them and they act fast when something happens like this, which almost never happens. So, I guess we'll get a patch release as soon as they fix it, let's be patient.
Yeah, true. But I guess it is like the hen or egg problem. They are investigating the underlying issue and to confirm the issue they need to find the issue first. So I would say that is why we haven't heard from them much. The bug report was created, this thread and other ones do exist, they even replied in some of them as staff, so it is impossible for them not having seen this issue. We have to be patient.Maybe they are, but a simple, "We are looking at this guys" would save a lot of angst.
Yes, I think also.From the silence treatment it looks like they are working on this problem to figure out what happened wrong.
There are a lot of things one can criticize about XF but without a doubt in my 7 years the "bug treatment" worked excellent here on XenForo. You can always rely on them and they act fast when something happens like this, which almost never happens. So, I guess we'll get a patch release as soon as they fix it, let's be patient.
Just to be clear; is everyone seeing this specific error in their logs related to this issue?now i can see some errors in log:
LogicException: 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}
I haven't had any ACP error logs so far, but my board is small compared to the other guys'. So maybe with enough attempts I would have gotten.Just to be clear; is everyone seeing this specific error in their logs related to this issue?
But it has happened to me on this forum:Even worse, we don’t appear to be experiencing the same issue here.
No, that error dosen't throw together, with my debugging test i described, i never saw that error before. I didn't test to reproduce this error with large files, we don't change any configs.Just to be clear; is everyone seeing this specific error in their logs related to this issue?
And @Idhae is this happening every time? Could this error specifically arise if the user is uploading a particularly large file?
Edit: im really surprised about that error in log, that i have posted today, why this error don't throw earlier.
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?
We use essential cookies to make this site work, and optional cookies to enhance your experience.