Getting this error when trying to open and post/thread :
Wrong value type sent to the database. Array of integers expected. (preview_attachments)
I have just updated to 2.1.3 and everything seems ok, but when I enable attachments, I get the above error.
I disable attachments and the posts / threads work again.
This error occurs even with no mods at all.
I searched for it and found one topic which is unrelated to my issue.
Thank you.
Post the complete error.
Quote from: mrnuke on March 05, 2023, 12:51:55 PMWrong value type sent to the database. Array of integers expected. (preview_attachments)
I did.. This..
Here is the complete error from the log :
Quotedfbd6de84786367f553f9ebc8f393d6e
http://guntalk.club/smf/index.php?topic=64467.0
/home/guntalkc/public_html/smf/Sources/Subs-Attachments.php (Line 1402) Backtrace information
Type of error: Critical
Error messageSelect
Wrong value type sent to the database. Array of integers expected. (preview_attachments)
Function: prepareAttachsByMsg
preview_attachments is not a core field in 2.1. Which mods are installed?
Can you attach here the Subs-Attachments.php file? It can be found inside the /Sources/ folder.
Quote from: Sir Osis of Liver on March 06, 2023, 11:55:49 AMpreview_attachments is not a core field in 2.1. Which mods are installed?
It's not a field but that's not what it's complaining about. The relevant function accepts an array of attachments to preview and the name of that array is preview_attachments, where it can be inserted safely into the relevant database query.
Hmm, this problem has been reported previously, but haven't found the solution.
Quote from: Sir Osis of Liver on March 06, 2023, 11:55:49 AMpreview_attachments is not a core field in 2.1. Which mods are installed?
I upgraded to 2.1.3 and had zero Mods installed after, so it must have come with 2.1.3 .
I have since added some mods that don't affect anything negatively, but people are missing the attachments. ;D
Search comes up with these, neither has a solution.
https://www.simplemachines.org/community/index.php?topic=584588.msg4142143#msg4142143
https://www.simplemachines.org/community/index.php?topic=584809.msg4143600#msg4143600
Smells like a server related bug, as it only happens infrequently. Have devs looked at it?
Any Devs that can help? It's pretty annoying, no attachments and no custom avatars, etc..
PHP version?
MySQL version?
Did you have attachments & avatars before the upgrade?
Did the upgrade provide you with any errors or warnings? (Esp. with regards to attachments/avatars folders?)
Do your attachments have a .dat extension on them in your attachments folder now? Or no extension?
Have you run repair_settings.php to confirm all your folders are set correctly?
In general, if your attachments don't have a .dat extension, 99% of the time what you need to do is:
- Confirm/validate folder settings for attachments & avatars in repair_settings.php
- Rerun the 2.1.3 upgrader, & be sure to check the box to reprocess attachments
Just encountered this error after moderating a post without attachments
QuoteWrong value type sent to the database. Array of integers expected. (preview_attachments)
Function: prepareAttachsByMsg
DB query
$request = $smcFunc['db_query']('', '
SELECT
a.id_attach, a.id_folder, a.id_msg, a.filename, a.file_hash, COALESCE(a.size, 0) AS filesize, a.downloads, a.approved, m.id_topic AS topic, m.id_board AS board, m.id_member, a.mime_type,
a.mime_type, a.proper_rotation, a.jpeg_quality, a.width, a.height' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : ',
thumb.id_folder AS thumb_folder, thumb.file_hash AS thumb_hash, thumb.filename AS thumb_name,
thumb.mime_type AS thumb_mime, thumb.proper_rotation AS thumb_rotation, thumb.size AS thumb_size,
COALESCE(thumb.id_attach, 0) AS id_thumb, thumb.width AS thumb_width, thumb.height AS thumb_height') . '
FROM {db_prefix}attachments AS a' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : '
LEFT JOIN {db_prefix}attachments AS thumb ON (thumb.id_attach = a.id_thumb)') . '
LEFT JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_msg)
WHERE a.attachment_type = {int:attachment_type}
AND (' . $msg_or_att . ')',
array(
'message_id' => $msgIDs,
'attachment_type' => 0,
'preview_attachments' => !empty($_SESSION['attachments_can_preview']) ? array_keys(array_filter($_SESSION['attachments_can_preview'])) : array(0),
)
);
$_SESSION['attachments_can_preview']
contains
array(1) { [""]=> bool(true) }
array_keys(array_filter($_SESSION['attachments_can_preview']))
returns
array(1) { [0]=> string(0) "" }
SMF: 2.1.4
MySQL: 10.5.18-MariaDB
PHP: 7.4.33
I'm seeing the same error on my forum too.
/home/bci/public_html/forum/Sources/Subs-Attachments.php (Line 1460)
Wrong value type sent to the database. Array of integers expected. (preview_attachments)
Function: prepareAttachsByMsg
Error happens even with my Image Attachment & Rotation plug-in disabled.
Interesting turn of events. I had my user try a different browser when attaching images and he is getting no errors using Chrome (he had been using Firefox). He then rebooted his computer and now the issue has disappeared completely, even using Firefox. So this was caused by a client-side issue.