Skip to content

don't let the mysql driver throw exceptions when debugging is enabled#9201

Merged
jdarwood007 merged 4 commits into
SimpleMachines:release-3.0from
live627:query-error
May 29, 2026
Merged

don't let the mysql driver throw exceptions when debugging is enabled#9201
jdarwood007 merged 4 commits into
SimpleMachines:release-3.0from
live627:query-error

Conversation

@live627
Copy link
Copy Markdown
Contributor

@live627 live627 commented May 3, 2026

No description provided.

@live627 live627 added the MySQL label May 3, 2026
@jdarwood007
Copy link
Copy Markdown
Member

Any reason we undid #8816 in this?

@live627
Copy link
Copy Markdown
Contributor Author

live627 commented May 4, 2026

Now my database errors are actually reported as database errors.

Comment thread Sources/Db/APIs/MySQL.php Outdated
@Sesquipedalian Sesquipedalian requested a review from jdarwood007 May 4, 2026 17:42
@live627
Copy link
Copy Markdown
Contributor Author

live627 commented May 29, 2026

We have since improved our database standards to fix any issues that strict mode would generate.

This change sets it so when using db_show_debug, we enable the errors/strict mode. This should ensure that during development processes, we do not introduce any new issues that are being silently ignored.

The MySQL strict errors are forwarded to PHP either way.

@jdarwood007 jdarwood007 merged commit 5296166 into SimpleMachines:release-3.0 May 29, 2026
4 checks passed
@jdarwood007
Copy link
Copy Markdown
Member

As long as we ensure that mysql errors are being captured. The focus of my PR was to ensure that we capture errors while in debug mode to ensure we handle them properly before they cause a issue in production.

@sbulen
Copy link
Copy Markdown
Contributor

sbulen commented May 29, 2026

FYI, debug mode has other problems as well. My main peeve is it causes lots of token errors, since asking for details eats your token.

IMO, it's a targeted get in there, look at what you wanna look at, & get immediately out. Too problematic to just leave on.

@jdarwood007
Copy link
Copy Markdown
Member

True for normal operations. For us developers, our installs typically have debug on all the time. If it's causing a token issue, we need to look at that. I haven't experienced a token issue myself. When I developed tokens for 2.1, I was always in debug mode. If we have broken tokens since, it has to be how we are reading them out for the debug section below.

@sbulen
Copy link
Copy Markdown
Contributor

sbulen commented May 29, 2026

In my experience, debug mode has always caused token problems. For years, since I first used SMF. I suspect it's one of the reasons we get so many token errors reported on the forum; I think folks turn it on & forget about it. I've brought this up before on the forum.

I'll log it separately.

I'm not sure there's anything we can do, actually. Certain actions cause a rewrite, eating the token.

@live627 live627 deleted the query-error branch May 29, 2026 02:31
@live627
Copy link
Copy Markdown
Contributor Author

live627 commented May 29, 2026

I’ve seen the token issue before, but only on repair boards. That makes me think that the query log might have gotten in the way and overflowed the DB column. I have not tested my hypothesis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants