Differential D21744 Diff 51836 src/infrastructure/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/storage/connection/mysql/AphrontMySQLiDatabaseConnection.php
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | protected function connect() { | ||||
// If the host is "localhost", the port is ignored and mysqli attempts to | // If the host is "localhost", the port is ignored and mysqli attempts to | ||||
// connect over a socket. | // connect over a socket. | ||||
if ($port) { | if ($port) { | ||||
if ($host === 'localhost' || $host === null) { | if ($host === 'localhost' || $host === null) { | ||||
$host = '127.0.0.1'; | $host = '127.0.0.1'; | ||||
} | } | ||||
} | } | ||||
// See T13588. In PHP 8.1, the default "report mode" for MySQLi has | |||||
// changed, which causes MySQLi to raise exceptions. Disable exceptions | |||||
// to align behavior with older default behavior under MySQLi, which | |||||
// this code expects. Plausibly, this code could be updated to use | |||||
// MySQLi exceptions to handle errors under a wider range of PHP versions. | |||||
mysqli_report(MYSQLI_REPORT_OFF); | |||||
$conn = mysqli_init(); | $conn = mysqli_init(); | ||||
$timeout = $this->getConfiguration('timeout'); | $timeout = $this->getConfiguration('timeout'); | ||||
if ($timeout) { | if ($timeout) { | ||||
$conn->options(MYSQLI_OPT_CONNECT_TIMEOUT, $timeout); | $conn->options(MYSQLI_OPT_CONNECT_TIMEOUT, $timeout); | ||||
} | } | ||||
if ($this->getPersistent()) { | if ($this->getPersistent()) { | ||||
▲ Show 20 Lines • Show All 205 Lines • Show Last 20 Lines |