News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

2.1.6 - Database error in MySQL

Started by Volker S, July 01, 2025, 04:34:28 AM

Previous topic - Next topic

Volker S

When attempting to edit a thread using the forum's "Edit" function, a database error occurs.

This error does not occur when editing a thread using the "Quick Edit" function.

GL700Wing

Quote from: Volker S on July 01, 2025, 04:34:28 AMWhen attempting to edit a thread using the forum's "Edit" function, a database error occurs.

This error does not occur when editing a thread using the "Quick Edit" function.
Just letting you know that if you are using the Automatic Attachment Rotation (and Resize) mod and it turns out this error is caused by a bug in the mod I won't be able to fix it until the end of August as I am away on holidays until then.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

GL700Wing

Quote from: Volker S on July 01, 2025, 04:34:28 AMWhen attempting to edit a thread using the forum's "Edit" function, a database error occurs.
I can't find an "Edit" function for the standard theme - are you referring to the "Modify" function or are you using a different theme?

QuoteThis error does not occur when editing a thread using the "Quick Edit" function.
I've just checked on my SMF 2.1.6 forum and I don't get any errors when editing a message using either the "Modify" or the "Quick Edit" functions when the Automatic Attachment Rotation (and Resize) mod is installed and I have tested editing messages with/without image attachments (and also messages with non-image attachments).

Are you able to provide more information about this error and also what other mods do you have installed?
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Volker S

Yes, it is the Modify function that causes this database error.
Unfortunately, I also got an additional server error 500 when I tried to insert an image using your autorotation (I have logged the errors, but would prefer to switch to the forum for your addon "autorotation").
Since I have backups of 2.1.4 and 2.1.5 from the forum, I wanted to continue with the 2.1.5 backup.
When I tried to access the forum, I got a version conflict (see image). I would have clarified what to do next.
Currently, I have 2.1.6 running again.
I thought you were still on vacation.

GL700Wing

Quote from: Volker S on July 03, 2025, 04:01:44 PMYes, it is the Modify function that causes this database error.
Unfortunately, I also got an additional server error 500 when I tried to insert an image using your autorotation (I have logged the errors, but would prefer to switch to the forum for your addon "autorotation").
This issue is not happening on my test SMF 2.1.6 forum (which was upgraded from SMF 1.1.5) and error 500 is a server-side issue (ie, from your web hosting service) - what version of PHP are you using?

I'll send you the login details for an account on my test forum so that you can confirm for yourself that the mod is working and not generating any errors.

QuoteSince I have backups of 2.1.4 and 2.1.5 from the forum, I wanted to continue with the 2.1.5 backup.
When I tried to access the forum, I got a version conflict (see image). I would have clarified what to do next.
Currently, I have 2.1.6 running again.
Not sure how you go about resolving that issue - did you uninstall the SMF 2.1.6 update or just replace the files?

QuoteI thought you were still on vacation.
I am (until the end of August) and even though I don't have access to my development environment I will still check and respond to messages if/when I can.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Volker S

Quote from: GL700Wing on July 03, 2025, 04:24:45 PM...and error 500 is a server-side issue (ie, from your web hosting service) - what version of PHP are you using?
I know that error 500 is a server error, but it could also be caused by files (.htaccess or an unsupported program version) located on the server.
The PHP version is 8.3.22 (I recently upgraded from 8.2) – which version do you have?

Quote from: GL700Wing on July 03, 2025, 04:24:45 PMI'll send you the login details for an account on my test forum so that you can confirm for yourself that the mod is working and not generating any errors.
I believe you that your add-on works. It has worked for me so far.

Quote from: GL700Wing on July 03, 2025, 04:24:45 PMNot sure how you go about resolving that issue - did you uninstall the SMF 2.1.6 update or just replace the files?
I created a new directory on the server and uploaded the backup via FTP – so I didn't uninstall the update.

Now I have to sleep - perhaps I read you tomorrow again. Thanks for your time.

Aleksi "Lex" Kilpinen

Usually, your server would log an explanation to go with that HTTP 500 error in the server's own error log. Have you checked what it says there? Could be a clue worth looking into.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Volker S

Thanks for the tip. I think I raised the PHP version too high. I have a lot of PHP warnings from Dokuwiki in the error logs and...

...here is the warning when attempting to attach an image
[Thu Jul 03 22:57:07.441951 2025] [fcgid:warn] [pid 4180249:tid 4180249] [client 2001:9e8:489f:6900:9a61:986f:83bc:2fcc:0] mod_fcgid: stderr: PHP Fatal error:  Redefinition of parameter $jpegQuality in /var/www/vhosts/hosting113784.a2f57.netcup.net/httpdocs/joomla/sm_forum/Sources/Subs-Graphics.php on line 415, referer: https://www.jollauser.de/index.php?action=post;topic=403.0;last_msg=2029

GL700Wing

Quote from: Volker S on July 03, 2025, 04:51:31 PMThe PHP version is 8.3.22 (I recently upgraded from 8.2) – which version do you have?
Normally 8.1 but I've confirmed that this issue does not occur with either 8.2 or 8.3.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Volker S

I changed setting the PHP version to 8.1.
That didn't work.

...and now I'm really going to sleep.

Oldiesmann

Changing the PHP version won't fix the error. That's a problem with the database query - mysql doesn't know what "thumb" is referring to. Can you attach a copy of Sources/Post.php, or at least the query that appears on lines 697-716? There's no "thumb" in the query in a default installation - just "id_thumb" (used to determine the name of the thumbnail image for any attachments)

Volker S

I think it's great that you're trying to help me. I had already secretly prepared myself to reinstall 2.1.5 (which is still database compatible with 2.1.6), but I think I'll have to go back to 2.1.4, as everything still worked there.

Some basic information about how it all started:
The forum (2.1.4) and all add-ons were working. Then there was an update for the add-on "Automatic Attachment Rotation (and Resize)" to 6.26, which I installed, and a day later the forum update to 2.1.5 came out. When I tried to install it, I got errors with ManageAitachments.php and Subs-Attachments.php. That sounded like files from the "Automatic Rotation" add-on, so I looked at the package manager table. It said version 6.24, that it was not installed and could therefore only be deleted. So something must have gone really wrong at some point, because I had actually already installed 6.26.

The developer then got involved (he didn't know about the "uninstallability" of his mod) and, due to the two errors during the installation attempt from 2.1.4 to 2.1.5, recommended that I first uninstall his add-on and then perform the forum update.
I then told him that I was not offered the option to uninstall. (Read more -> here)
He then recommended installing 2.1.5 and then updating the mod. I think that the errors were ultimately implemented because I couldn't uninstall the installed "Autorotation 6.24." It's best to take a look at the link "Read more."

...I'm not going to rush into anything. Thanks again in advance to those who want to help me.

Volker S

@Oldiesmann
The error is now displayed in line 734 (see image). It is located in the field variable declaration. This error occurs when I try to start the large editor (Modify). Quick Edit works.
I can't post the code here (not even a section of it) because then I'll run into the forum firewall.
Here's a link to the complete post.php -> Link

Aleksi "Lex" Kilpinen

@SleePy Not being able to paste code snippets seems like an issue we should perhaps look at.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Volker S

#14
So, I restored SMF to 2.1.4 (with the corresponding database). Unfortunately, resetting to 2.1.5 did not help. The same errors were still there.

Now that everything is working again, I can take my time and manually restore the lost forum posts.

However, the system is not error-free. The modul "autorotation is marked as "cannot be uninstalled" again, and the wrong version is listed there. I will continue the discussion about "Autorotation" in the forum from that Modul once the developer is back from vacation.

PS: I can't post a Picture (.jpg) with the funktion "Click or drag files here..."

Here is the picture:

Volker S

The error I received, which was displayed in a very narrow column, began with HTML code. I did not copy everything—at some point below the HTML code, the binary files of the image appeared.
Zurück_zu_2-1-4.jpg <!DOCTYPE html><html lang="en-US"><head><title>Just a moment...</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=Edge"><meta name="robots" content="noindex,nofollow"><meta name="viewport" content="width=device-width,initial-scale=1"><style>*{box-sizing:border-box;margin:0;padding:0}html{line-height:1.15;-webkit-text-size-adjust:100%;color:#313131;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}body{display:flex;flex-direction:column;height:100vh;min-height:100vh}.main-content{margin:8rem auto;max-width:60rem;padding-left:1.5rem}@media (width <= 720px){.main-content{margin-top:4rem}}.h2{font-size:1.5rem;font-weight:500;line-height:2.25rem}@media (width <= 720px)

GL700Wing

Quote from: Volker S on July 05, 2025, 12:16:36 PMHowever, the system is not error-free. The modul "autorotation is marked as "cannot be uninstalled" again, and the wrong version is listed there. I will continue the discussion about "Autorotation" in the forum from that Modul once the developer is back from vacation.
This problem is not caused by the 'Automatic Attachment Rotation (and Resize)' (AARR) mod - it's caused by an issue within the database for the Package Manager.

You might need to use the 'Fix Packages' tool to change the installation status of the AARR mod - download the tool here.

Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

shawnb61

I've made a few attempts to reproduce the issue following the steps above.  v6.24 of AARR is no longer downloadable, but in all my attempts, starting with SMF2.1.4 & AARR 6.25, I've been able to install/deinstall v6.25, v6.26, & even do the 'upgrade' of v6.25 to 6.26, deinstall 6.26, patch SMF to 2.1.6, reinstall AARR 6.26, & have everything work OK.

You are correct that AARR must be deinstalled before the 2.1.5 is applied.  There are conflicts there.  But an AARR deinstall/SMF patch/AARR reinstall works OK.

GL700Wing is correct that, if you really are on AARR v6.24 and cannot deinstall, fix_packages should help.

But none of this explains the broken 'thumb' query.  AARR does in fact add 'thumb' to the query - that's where that came from - but properly installed there is no error.  Somewhere along the line, that query got mangled.  I suspect that due to some install/deinstall glitch, 'thumb' is now duplicated in the query erroneously.  And because the code is mangled, I strongly doubt 6.24 will deinstall properly.

Not sure what.  Cannot duplicate it.  The more important question is what to do next.

Two possibilities...

#1 = Lite, & #2 = Big Bang.  Both options start from your current 2.1.4/6.24.

#1: Lite, a piece at a time.
- Use fix_packages.php to let pacman know AARR v6.24 is actually installed.  This should give you the deinstall button for AARR 6.24.
- Attempt to deinstall AARR 6.24.  You may get errors, I'm pretty sure Post.php will have errors (due to the mangled query).  Note which files.
- Deinstall AARR anyway.
- Whatever files had deinstall issues, copy fresh source over from the 2.1.4 upgrade package.  So you KNOW it's proper 2.1.4.
- Patch to 2.1.5 & 2.1.6.
- Install AARR 6.26.

The risk with #1 the Lite option is if other packages have updated any files that you just broke that other mod. 

To address that risk, it may help to step thru all your other mods in Package Manager and do a 'List Files', so you are aware in advance of any potential conflicts.  If you see some, deinstall that mod, too, & reinstall after you're on 2.1.6.  Another option is to just deinstall everything first.

#2: Big Bang, refresh the code
- Copy *all* SMF files over from the 2.1.4 upgrade package.
- Use fix_package to remove all hooks & flag all mods as de-installed.
- You are now at vanilla 2.1.4...
- Patch to 2.1.5 & 2.1.6.
- Install AARR 6.26.
- Re-install all your other mods.

We should all do a code refresh once in a while.  It's a good thing.  Like changing your sheets...

The downside of this option is that any manually entered tweaks are lost.  But nobody should be doing those anyway.

If #1 crashes & burns, #2 is the fallback plan.

Before you start, read the entire post above two more times.
A question worth asking is born in experience & driven by necessity. - Fripp

Volker S

#18
Quote from: shawnb61 on July 05, 2025, 11:17:40 PM- Use fix_packages.php to let pacman know AARR v6.24 is actually installed.  This should give you the deinstall button for AARR 6.24.
Re #1
Does it matter which version of AARR is actually installed?

I'm pretty sure that this information didn't change when I installed AARR version 6.26.
Even when I updated to 6.25, this version information didn't change.
By restoring the backup, I can't say for sure whether it's still 6.25 or already 6.26.

QuoteBut none of this explains the broken 'thumb' query.  AARR does in fact add 'thumb' to the query - that's where that came from - but properly installed there is no error.  Somewhere along the line, that query got mangled.  I suspect that due to some install/deinstall glitch, 'thumb' is now duplicated in the query erroneously.  And because the code is mangled, I strongly doubt 6.24 will deinstall properly.
By restoring the backup, these errors no longer occur. Everything appears to be functioning properly.

Thank you very much for your help—it is by no means a given.

shawnb61

Yes, it matters, because the deinstall will only work properly for the installed version.

fix_packages may offer a clue.
A question worth asking is born in experience & driven by necessity. - Fripp

Advertisement: