Skip to content

Guard each author counter on its own when decrementing - #456

Merged
iMattPro merged 1 commit into
phpbb:3.3.xfrom
ECYaz:fix/author-counter-underflow
Aug 6, 2026
Merged

Guard each author counter on its own when decrementing#456
iMattPro merged 1 commit into
phpbb:3.3.xfrom
ECYaz:fix/author-counter-underflow

Conversation

@ECYaz

@ECYaz ECYaz commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #455

The decrement guarded only author_contribs, so a per-type counter already at zero made the unsigned subtraction fail and the whole action die with an SQL error. Each counter now stops at zero on its own, which also lets a drifted counter come back into step over time instead of the skipped update pushing the two further apart.

The decrement update subtracted from author_contribs and from the
per-type counter in one statement, guarded only by author_contribs
being above zero. The columns are unsigned, so once a per-type counter
has drifted to zero the subtraction fails and the whole action dies
with an SQL error: changing the contribution status, changing its
owner or deleting it. Each counter now stops at zero on its own, which
also lets a drifted counter correct itself over time instead of the
skipped update pushing them further apart.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Prevents unsigned author counters from underflowing during contribution decrements.

Changes:

  • Guards total and per-type counters independently.
  • Preserves existing increment behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@iMattPro
iMattPro merged commit 996963d into phpbb:3.3.x Aug 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Status changes can die with an SQL error on the author counters

3 participants