Skip to content

Commit

Permalink
Now getInstance function will create new MysqliDb object if one is no…
Browse files Browse the repository at this point in the history
…t present. (#794)
  • Loading branch information
ravibpatel authored and avbdr committed Oct 11, 2018
1 parent 3a2ca85 commit 43459ae
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion MysqliDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,11 @@ public function mysqli()
*/
public static function getInstance()
{
return self::$_instance;
if(isset(self::$_instance)) {
return self::$_instance;
} else {
return new MysqliDb();
}
}

/**
Expand Down

2 comments on commit 43459ae

@surdaft
Copy link

Choose a reason for hiding this comment

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

This causes an issue with a "default" connection that has null for all parameters. I think this needs to be looked into a little more.

What is it trying to solve? I feel like returning null is the most appropriate response.

@avbdr
Copy link
Collaborator

@avbdr avbdr commented on 43459ae Aug 24, 2019

Choose a reason for hiding this comment

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

thanks. reverted

Please sign in to comment.