From 35093a4b89c9b301177b74916aae2f50a5b4f711 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Wed, 15 Aug 2018 12:58:19 -0700 Subject: [PATCH] Replaced call_user_func_array() of a fixed method with the usage of variadic arguments --- lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php | 1 - lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php | 8 +++----- .../DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php | 3 +-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php b/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php index 6693d090e5f..68f195427dd 100644 --- a/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php +++ b/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php @@ -27,7 +27,6 @@ use const DB2_LONG; use const DB2_PARAM_IN; use function array_change_key_case; -use function call_user_func_array; use function db2_bind_param; use function db2_execute; use function db2_fetch_array; diff --git a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php index 6941894e009..fb4d6765ead 100644 --- a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php +++ b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php @@ -25,7 +25,6 @@ use Doctrine\DBAL\ParameterType; use function array_combine; use function array_fill; -use function call_user_func_array; use function count; use function str_repeat; @@ -172,7 +171,7 @@ public function execute($params = null) throw new MysqliException($this->_stmt->error, $this->_stmt->errno); } } else { - if (!call_user_func_array([$this->_stmt, 'bind_param'], [$this->types] + $this->_bindedValues)) { + if (! $this->_stmt->bind_param($this->types, ...$this->_bindedValues)) { throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno); } } @@ -221,7 +220,7 @@ public function execute($params = null) $refs[$key] =& $value; } - if (!call_user_func_array([$this->_stmt, 'bind_result'], $refs)) { + if (! $this->_stmt->bind_result(...$refs)) { throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno); } } @@ -242,13 +241,12 @@ private function _bindValues($values) { $params = []; $types = str_repeat('s', count($values)); - $params[0] = $types; foreach ($values as &$v) { $params[] =& $v; } - return call_user_func_array([$this->_stmt, 'bind_param'], $params); + return $this->_stmt->bind_param($types, ...$params); } /** diff --git a/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php b/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php index 1584dadb115..38d7fa0fdf1 100644 --- a/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php +++ b/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php @@ -26,7 +26,6 @@ use IteratorAggregate; use const SASQL_BOTH; use function array_key_exists; -use function call_user_func_array; use function func_get_args; use function func_num_args; use function gettype; @@ -280,7 +279,7 @@ public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = n switch ($fetchMode) { case FetchMode::CUSTOM_OBJECT: - while ($row = call_user_func_array([$this, 'fetch'], func_get_args())) { + while ($row = $this->fetch(...func_get_args())) { $rows[] = $row; } break;