Skip to content

fix: encapsulation violation in BasePreparedQuery class #9603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

michalsn
Copy link
Member

Description
This PR fixes an encapsulation violation where BasePreparedQuery was directly accessing the protected property BaseConnection::$transStatus, which goes against PHP’s visibility rules.

To resolve this, I introduced a new internal method, BaseConnection::handleTransStatus(), which provides controlled access for modifying the transaction status when a query fails during an active transaction.

The issue was originally spotted in the forum: https://forum.codeigniter.com/showthread.php?tid=93029

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@michalsn michalsn added the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant