diff options
| author | Damien Regad <dregad@mantisbt.org> | 2016-03-28 00:44:40 +0200 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2016-03-30 23:34:37 +0200 |
| commit | 9c895d1f6d92e993771e31b312d76dc07c416044 (patch) | |
| tree | e05b7b7bed3e315a3c03a68d734bc061eea4ef21 | |
| parent | 53e02ce212d4b022e3abac9591526c34a53abecb (diff) | |
| download | adodb-9c895d1f6d92e993771e31b312d76dc07c416044.tar.gz adodb-9c895d1f6d92e993771e31b312d76dc07c416044.tar.bz2 adodb-9c895d1f6d92e993771e31b312d76dc07c416044.zip | |
mysqli: cast port number to int when connecting
In PHP7, mysqli_real_connect() expects the port number to be an int; PHP
throws a warning if we give it a string, which is usually the case since
the port is parsed from a 'hostname:port'.
Fixes #218
| -rw-r--r-- | drivers/adodb-mysqli.inc.php | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/adodb-mysqli.inc.php b/drivers/adodb-mysqli.inc.php index a3b9ea88..2d55399e 100644 --- a/drivers/adodb-mysqli.inc.php +++ b/drivers/adodb-mysqli.inc.php @@ -118,7 +118,8 @@ class ADODB_mysqli extends ADOConnection { $argUsername, $argPassword, $argDatabasename, - $this->port, + # PHP7 compat: port must be int. Use default port if cast yields zero + (int)$this->port != 0 ? (int)$this->port : 3306, $this->socket, $this->clientFlags); |
