Merge pull request #1861 from josh4trunks/ctype

Use ctype_digit
pull/1862/head
Isaac Connor 2017-04-25 09:58:01 -04:00 committed by GitHub
commit ff71777ee6
2 changed files with 2 additions and 2 deletions

View File

@ -88,7 +88,7 @@ class DATABASE_CONFIG {
public function __construct() {
if (strpos(ZM_DB_HOST, ':')):
$array = explode(':', ZM_DB_HOST, 2);
if (is_numeric($array[1])):
if (ctype_digit($array[1])):
$this->default['host'] = $array[0];
$this->default['port'] = $array[1];
else:

View File

@ -33,7 +33,7 @@ function dbConnect()
if (strpos(ZM_DB_HOST, ':')) {
// Host variable may carry a port or socket.
list($host, $portOrSocket) = explode(':', ZM_DB_HOST, 2);
if (is_numeric($portOrSocket)) {
if (ctype_digit($portOrSocket)) {
$socket = ':host='.$host . ';port='.$portOrSocket;
} else {
$socket = ':unix_socket='.$portOrSocket;