Use new mysqli instead of mysqli_init
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
parent
deffe78580
commit
48ca6a188e
@ -20175,12 +20175,6 @@ parameters:
|
||||
count: 1
|
||||
path: tests/unit/SqlTest.php
|
||||
|
||||
-
|
||||
message: '#^Method PhpMyAdmin\\Tests\\Stubs\\DbiDummy\:\:connect\(\) never returns null so it can be removed from the return type\.$#'
|
||||
identifier: return.unusedType
|
||||
count: 1
|
||||
path: tests/unit/Stubs/DbiDummy.php
|
||||
|
||||
-
|
||||
message: '''
|
||||
#^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\:
|
||||
|
||||
@ -60,7 +60,6 @@ use function strtoupper;
|
||||
use function strtr;
|
||||
use function substr;
|
||||
use function syslog;
|
||||
use function trigger_error;
|
||||
use function uasort;
|
||||
use function uksort;
|
||||
use function usort;
|
||||
@ -1617,27 +1616,13 @@ class DatabaseInterface
|
||||
|
||||
$errorHandler->setHideLocation(false);
|
||||
|
||||
if ($result !== null) {
|
||||
$this->connections[$target->value] = $result;
|
||||
/* Run post connect for user connections */
|
||||
if ($target === ConnectionType::User) {
|
||||
$this->postConnect($currentServer);
|
||||
}
|
||||
|
||||
return $result;
|
||||
$this->connections[$target->value] = $result;
|
||||
/* Run post connect for user connections */
|
||||
if ($target === ConnectionType::User) {
|
||||
$this->postConnect($currentServer);
|
||||
}
|
||||
|
||||
if ($connectionType === ConnectionType::ControlUser) {
|
||||
$errorHandler = ErrorHandler::getInstance();
|
||||
$errorHandler->addError(
|
||||
__('Connection for controluser as defined in your configuration failed.'),
|
||||
E_USER_WARNING,
|
||||
__FILE__,
|
||||
__LINE__,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -20,7 +20,7 @@ interface DbiExtension
|
||||
*
|
||||
* @throws ConnectionException
|
||||
*/
|
||||
public function connect(Server $server): Connection|null;
|
||||
public function connect(Server $server): Connection;
|
||||
|
||||
/**
|
||||
* selects given database
|
||||
|
||||
@ -18,7 +18,6 @@ use function __;
|
||||
use function defined;
|
||||
use function mysqli_connect_errno;
|
||||
use function mysqli_get_client_info;
|
||||
use function mysqli_init;
|
||||
use function mysqli_report;
|
||||
use function sprintf;
|
||||
use function str_contains;
|
||||
@ -40,15 +39,11 @@ use const MYSQLI_USE_RESULT;
|
||||
*/
|
||||
class DbiMysqli implements DbiExtension
|
||||
{
|
||||
public function connect(Server $server): Connection|null
|
||||
public function connect(Server $server): Connection
|
||||
{
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
|
||||
$mysqli = mysqli_init();
|
||||
|
||||
if ($mysqli === false) {
|
||||
return null;
|
||||
}
|
||||
$mysqli = new mysqli();
|
||||
|
||||
$clientFlags = 0;
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ class DbiDummy implements DbiExtension
|
||||
$this->init();
|
||||
}
|
||||
|
||||
public function connect(Server $server): Connection|null
|
||||
public function connect(Server $server): Connection
|
||||
{
|
||||
return new Connection(new stdClass());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user