Skip to content
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

fix: getVersion() for OCI8 and SQLSRV drivers #9471

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

Conversation

michalsn
Copy link
Member

@michalsn michalsn commented Feb 28, 2025

Description
This PR fixes a bug in OCI8 and SQLSRV getVersion() method, which will return an empty string when no connection is established.

Issue discovered in #9469

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 Feb 28, 2025
@@ -29,6 +29,12 @@ final class GetVersionTest extends CIUnitTestCase

public function testGetVersion(): void
{
if ($this->db->DBDriver === 'MySQLi') {
Copy link
Member

Choose a reason for hiding this comment

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

This should can use if ($this->db instanceof \CodeIgniter\Database\MySQLi\Connection)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but since this type of comparison is widely used in our tests, I personally find it more readable. However, if others prefer the change, I'm happy to update it.

Copy link
Member

Choose a reason for hiding this comment

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

The benefit of instanceof is phpstan will be fixed for no property notice

@michalsn michalsn changed the title fix: getVersion() for OCI8 driver when no connection is established fix: getVersion() for OCI8 and SQLSRV drivers Feb 28, 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.

3 participants