From 13dfca258cf3c20345a8eba8e82b93f4146f426e Mon Sep 17 00:00:00 2001 From: techno-express Date: Mon, 22 Feb 2021 21:33:43 -0500 Subject: [PATCH 01/19] corrections, code coverage updates, update sanitize_path, update version --- lib/Constants.php | 2 +- lib/ezFunctions.php | 10 +++++----- lib/ezQuery.php | 4 ++-- lib/ezQueryInterface.php | 2 +- tests/ezFunctionsTest.php | 2 +- tests/mysqli/mysqliTest.php | 4 +++- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/Constants.php b/lib/Constants.php index 789a63e7..0648011f 100644 --- a/lib/Constants.php +++ b/lib/Constants.php @@ -5,7 +5,7 @@ /** * ezsqlModel Constants */ - \defined('EZSQL_VERSION') or \define('EZSQL_VERSION', '5.1.1'); + \defined('EZSQL_VERSION') or \define('EZSQL_VERSION', '5.1.2'); \defined('OBJECT') or \define('OBJECT', 'OBJECT'); \defined('ARRAY_A') or \define('ARRAY_A', 'ARRAY_A'); \defined('ARRAY_N') or \define('ARRAY_N', 'ARRAY_N'); diff --git a/lib/ezFunctions.php b/lib/ezFunctions.php index 4a10aafb..fd4fd1aa 100644 --- a/lib/ezFunctions.php +++ b/lib/ezFunctions.php @@ -607,10 +607,9 @@ function is_traversal(string $basePath, string $filename) * * Example: * - * `sanitize_path("../../../../config.php");` - * - * Returns `config.php` without the path traversal - * @param string $path + * `sanitize_path("../../../../config.php-");` + * - Returns `config.php` without the path traversal + * @param string $path original file/path to be sanitized. * @return string */ function sanitize_path(string $path) @@ -618,6 +617,7 @@ function sanitize_path(string $path) $file = \preg_replace("/\.[\.]+/", "", $path); $file = \preg_replace("/^[\/]+/", "", $file); $file = \preg_replace("/^[A-Za-z][:\|][\/]?/", "", $file); + $file = \trim($file, '.-_'); return ($file); } @@ -1365,7 +1365,7 @@ function unionAll($table = '', $columnFields = '*', ...$conditions) /** * Specifies an ordering for the query results. * @param string $orderBy - The column. - * @param string $order - The ordering direction. + * @param string $order - The ordering direction, either `ASC`|`DESC`. * * @return string - ORDER BY SQL statement, or false on error */ diff --git a/lib/ezQuery.php b/lib/ezQuery.php index cbc413cf..6247d347 100644 --- a/lib/ezQuery.php +++ b/lib/ezQuery.php @@ -269,8 +269,8 @@ public function orderBy($orderBy, $order) } $columns = $this->to_string($orderBy); - - $order = (\in_array(\strtoupper($order), array('ASC', 'DESC'))) ? \strtoupper($order) : 'ASC'; + $by = \strtoupper($order); + $order = (\in_array($by, array('ASC', 'DESC'))) ? $by : 'ASC'; return 'ORDER BY ' . $columns . ' ' . $order; } diff --git a/lib/ezQueryInterface.php b/lib/ezQueryInterface.php index 2fc422ac..6304d876 100644 --- a/lib/ezQueryInterface.php +++ b/lib/ezQueryInterface.php @@ -276,7 +276,7 @@ public function unionAll(string $table = null, $columnFields = '*', ...$conditio /** * Specifies an ordering for the query results. * @param string $orderBy - The column. - * @param string $order - The ordering direction. + * @param string $order - The ordering direction, either `ASC`|`DESC`. * * @return string - ORDER BY SQL statement, or false on error */ diff --git a/tests/ezFunctionsTest.php b/tests/ezFunctionsTest.php index a8c374a2..cf685cc2 100644 --- a/tests/ezFunctionsTest.php +++ b/tests/ezFunctionsTest.php @@ -70,7 +70,7 @@ public function testClean_string() public function testSanitize_path() { - $this->assertEquals("config.php", sanitize_path("../../../../config.php")); + $this->assertEquals("config.php", sanitize_path("../../../../config.php-")); } public function testis_traversal() diff --git a/tests/mysqli/mysqliTest.php b/tests/mysqli/mysqliTest.php index 534f7ef4..622072e4 100644 --- a/tests/mysqli/mysqliTest.php +++ b/tests/mysqli/mysqliTest.php @@ -25,6 +25,8 @@ dropping, altering, get_results, + limit, + orderBy, replacing, table_setup, where @@ -603,7 +605,7 @@ public function testSelectAndCreateTable() ]) ); - $result = $this->object->select('users', 'id, tel_num, email', eq('user_name ', 'walker')); + $result = $this->object->select('users', 'id, tel_num, email', where(eq('user_name ', 'walker')), orderBy('id', 'ASC'), limit(1)); $this->object->debugOn(); $this->expectOutputRegex('/[123456]/'); From a9fcf8705a00c99ee92a16caf6c5b6f79bfebb39 Mon Sep 17 00:00:00 2001 From: techno-express Date: Tue, 23 Feb 2021 15:24:37 -0500 Subject: [PATCH 02/19] misc doc-blocks and code coverage updates --- lib/Database.php | 2 ++ lib/ezFunctions.php | 47 +++++++++++++++++++++++++++---------- lib/ezQuery.php | 17 ++++++++------ lib/ezQueryInterface.php | 26 ++++++++++---------- tests/mysqli/mysqliTest.php | 10 +++++++- 5 files changed, 68 insertions(+), 34 deletions(-) diff --git a/lib/Database.php b/lib/Database.php index 0b028739..a2e906c9 100644 --- a/lib/Database.php +++ b/lib/Database.php @@ -18,6 +18,7 @@ class Database private static $factory = null; private static $instances = []; + // @codeCoverageIgnoreStart private function __construct() { } @@ -27,6 +28,7 @@ private function __clone() public function __wakeup() { } + // @codeCoverageIgnoreEnd /** * Initialize and connect a vendor database. diff --git a/lib/ezFunctions.php b/lib/ezFunctions.php index fd4fd1aa..5839664a 100644 --- a/lib/ezFunctions.php +++ b/lib/ezFunctions.php @@ -965,14 +965,32 @@ function set_prefix(string $append = '') /** * Does an `select into` statement by calling `select` method - * @param $newTable, - new database table to be created - * @param $fromColumns - the columns from old database table - * @param $oldTable - old database table - * @param $fromWhereConditions, - where clause `eq(x, y, _AND), another clause - same as array(x, =, y, and, extra) ` - * - * @return mixed|object bool/result - false for error + * @param string $newTable, - new database table to be created + * @param mixed $fromColumns - the columns from old database table + * @param string $oldTable - old database table + * @param mixed $fromWhereConditions, - where clause `eq(x, y, _AND), another clause - same as array(x, =, y, and, extra)` + * - In the following format: + *```js + * eq('key/Field/Column', $value, _AND), // combine next expression + * neq('key/Field/Column', $value, _OR), // will combine next expression if + * ne('key/Field/Column', $value), // the default is _AND so will combine next expression + * lt('key/Field/Column', $value) + * lte('key/Field/Column', $value) + * gt('key/Field/Column', $value) + * gte('key/Field/Column', $value) + * isNull('key/Field/Column') + * isNotNull('key/Field/Column') + * like('key/Field/Column', '_%') + * notLike('key/Field/Column', '_%') + * in('key/Field/Column', $values) + * notIn('key/Field/Column', $values) + * between('key/Field/Column', $value, $value2) + * notBetween('key/Field/Column', $value, $value2) + *``` + * @return mixed bool/result - false for error + * @codeCoverageIgnore */ - function select_into($newTable, $fromColumns = '*', $oldTable = null, ...$fromWhereConditions) + function select_into(string $newTable, $fromColumns = '*', string $oldTable = null, ...$fromWhereConditions) { $ezQuery = getInstance(); return ($ezQuery instanceof DatabaseInterface) @@ -1096,15 +1114,15 @@ function grouping(...$conditions) * having( between( 'columns', values1, values2 ) ), * orderBy( 'columns', 'desc' ); * - * @param mixed $groupBy The grouping expression. + * @param string|array $column The grouping expression. * * @return string - GROUP BY SQL statement, or false on error */ - function groupBy($groupBy) + function groupBy($column) { $ezQuery = getInstance(); return ($ezQuery instanceof DatabaseInterface) - ? $ezQuery->groupBy($groupBy) + ? $ezQuery->groupBy($column) : false; } @@ -1364,16 +1382,16 @@ function unionAll($table = '', $columnFields = '*', ...$conditions) /** * Specifies an ordering for the query results. - * @param string $orderBy - The column. + * @param string|array $column - Which columns to use for ordering. * @param string $order - The ordering direction, either `ASC`|`DESC`. * * @return string - ORDER BY SQL statement, or false on error */ - function orderBy($orderBy, $order) + function orderBy($column, $order) { $ezQuery = getInstance(); return ($ezQuery instanceof DatabaseInterface) - ? $ezQuery->orderBy($orderBy, $order) + ? $ezQuery->orderBy($column, $order) : false; } @@ -1394,6 +1412,9 @@ function limit($numberOf, $offset = null) : false; } + /** + * @codeCoverageIgnore + */ function ezFunctions() { return true; diff --git a/lib/ezQuery.php b/lib/ezQuery.php index 6247d347..24f06f7a 100644 --- a/lib/ezQuery.php +++ b/lib/ezQuery.php @@ -111,13 +111,13 @@ public static function to_string($arrays, $separation = ',') return $columns; } - public function groupBy($groupBy) + public function groupBy($column) { - if (empty($groupBy)) { + if (empty($column)) { return false; } - $columns = $this->to_string($groupBy); + $columns = $this->to_string($column); return 'GROUP BY ' . $columns; } @@ -262,13 +262,13 @@ private function joining( return ' ' . $type . ' JOIN ' . $rightTable . ' AS ' . $tableAs . ' ' . $onCondition; } - public function orderBy($orderBy, $order) + public function orderBy($column, $order) { - if (empty($orderBy)) { + if (empty($column)) { return false; } - $columns = $this->to_string($orderBy); + $columns = $this->to_string($column); $by = \strtoupper($order); $order = (\in_array($by, array('ASC', 'DESC'))) ? $by : 'ASC'; @@ -593,6 +593,9 @@ public function create_select(string $newTable, $fromColumns = '*', $oldTable = return $this->clearPrepare(); } + /** + * @codeCoverageIgnore + */ public function select_into(string $newTable, $fromColumns = '*', $oldTable = null, ...$fromWhereConditions) { $this->isInto = true; @@ -602,7 +605,7 @@ public function select_into(string $newTable, $fromColumns = '*', $oldTable = nu return $this->clearPrepare(); $newTableFromTable = $this->select_sql($newTable, $fromColumns, ...$fromWhereConditions); - if (is_string($newTableFromTable)) + if (\is_string($newTableFromTable)) return (($this->isPrepareOn()) && !empty($this->prepareValues())) ? $this->query($newTableFromTable, true) : $this->query($newTableFromTable); diff --git a/lib/ezQueryInterface.php b/lib/ezQueryInterface.php index 6304d876..14c3f1f7 100644 --- a/lib/ezQueryInterface.php +++ b/lib/ezQueryInterface.php @@ -50,11 +50,11 @@ public function prepareOff(); * having( between( 'columns', values1, values2 ) ), * orderBy( 'columns', 'desc' ); * - * @param mixed $groupBy The grouping expression. + * @param string|array $column The grouping expression. * * @return string - GROUP BY SQL statement, or false on error */ - public function groupBy($groupBy); + public function groupBy($column); /** * Specifies a `restriction` over the groups of the query. @@ -275,12 +275,12 @@ public function unionAll(string $table = null, $columnFields = '*', ...$conditio /** * Specifies an ordering for the query results. - * @param string $orderBy - The column. + * @param string|array $column - Which columns to use for ordering. * @param string $order - The ordering direction, either `ASC`|`DESC`. * * @return string - ORDER BY SQL statement, or false on error */ - public function orderBy($orderBy, $order); + public function orderBy($column, $order); /** * Specifies records from one or more tables in a database and @@ -452,10 +452,10 @@ function inserting(array $keyValue); /** * Does an `create select` statement by calling `select` method * - * @param $newTable, - new database table to be created - * @param $fromColumns - the columns from old database table - * @param $oldTable - old database table - * @param $fromWhereConditions, - where clause `eq(x, y, _AND), another clause - same as array(x, =, y, and, extra)` + * @param string $newTable, - new database table to be created + * @param string|array $fromColumns - the columns from old database table + * @param string $oldTable - old database table + * @param array $fromWhereConditions, - where clause `eq(x, y, _AND), another clause - same as array(x, =, y, and, extra)` * - In the following format: *```js * eq('key/Field/Column', $value, _AND), // combine next expression @@ -480,10 +480,10 @@ public function create_select(string $newTable, $fromColumns = '*', $oldTable = /** * Does an `select into` statement by calling `select` method - * @param $newTable, - new database table to be created - * @param $fromColumns - the columns from old database table - * @param $oldTable - old database table - * @param $fromWhereConditions, - where clause `eq(x, y, _AND), another clause - same as array(x, =, y, and, extra)` + * @param string $newTable, - new database table to be created + * @param mixed $fromColumns - the columns from old database table + * @param string $oldTable - old database table + * @param mixed $fromWhereConditions, - where clause `eq(x, y, _AND), another clause - same as array(x, =, y, and, extra)` * - In the following format: *```js * eq('key/Field/Column', $value, _AND), // combine next expression @@ -504,7 +504,7 @@ public function create_select(string $newTable, $fromColumns = '*', $oldTable = *``` * @return mixed bool/result - false for error */ - public function select_into(string $newTable, $fromColumns = '*', $oldTable = null, ...$fromWhereConditions); + public function select_into(string $newTable, $fromColumns = '*', string $oldTable = null, ...$fromWhereConditions); /** * Does an `update` query with an array, by conditional operator array diff --git a/tests/mysqli/mysqliTest.php b/tests/mysqli/mysqliTest.php index 622072e4..bdae11c5 100644 --- a/tests/mysqli/mysqliTest.php +++ b/tests/mysqli/mysqliTest.php @@ -25,6 +25,7 @@ dropping, altering, get_results, + groupBy, limit, orderBy, replacing, @@ -605,7 +606,14 @@ public function testSelectAndCreateTable() ]) ); - $result = $this->object->select('users', 'id, tel_num, email', where(eq('user_name ', 'walker')), orderBy('id', 'ASC'), limit(1)); + $result = $this->object->select( + 'users', + 'id, tel_num, email', + where(eq('user_name ', 'walker')), + groupBy('id'), + orderBy('id', 'ASC'), + limit(1) + ); $this->object->debugOn(); $this->expectOutputRegex('/[123456]/'); From f88910d2066afcacd2c52c738ada1b260fb09078 Mon Sep 17 00:00:00 2001 From: techno-express Date: Tue, 23 Feb 2021 15:53:42 -0500 Subject: [PATCH 03/19] Update ezQuery.php --- lib/ezQuery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ezQuery.php b/lib/ezQuery.php index 24f06f7a..21fccb3d 100644 --- a/lib/ezQuery.php +++ b/lib/ezQuery.php @@ -596,7 +596,7 @@ public function create_select(string $newTable, $fromColumns = '*', $oldTable = /** * @codeCoverageIgnore */ - public function select_into(string $newTable, $fromColumns = '*', $oldTable = null, ...$fromWhereConditions) + public function select_into(string $newTable, $fromColumns = '*', string $oldTable = null, ...$fromWhereConditions) { $this->isInto = true; if (isset($oldTable)) From c28ed6c4c86bdedd818c84634a27a098272087e2 Mon Sep 17 00:00:00 2001 From: techno-express Date: Fri, 5 Mar 2021 10:52:44 -0500 Subject: [PATCH 04/19] Update ezsql-macos.yml --- .github/workflows/ezsql-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ezsql-macos.yml b/.github/workflows/ezsql-macos.yml index 155c46bf..dddcdc3c 100644 --- a/.github/workflows/ezsql-macos.yml +++ b/.github/workflows/ezsql-macos.yml @@ -36,7 +36,7 @@ jobs: run: | brew services start mysql@5.7 brew link mysql@5.7 --force - mysqld --initialize-insecure + mysqld --initialize-insecure --ignore-db-dir=lost+found mysql.server start - name: Setup MySQL Database run: | From 4dc5597b5690ff144ab8dae5f57a9127f3bbe124 Mon Sep 17 00:00:00 2001 From: techno-express Date: Fri, 5 Mar 2021 11:17:36 -0500 Subject: [PATCH 05/19] Update ezsql-macos.yml --- .github/workflows/ezsql-macos.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ezsql-macos.yml b/.github/workflows/ezsql-macos.yml index dddcdc3c..e28953b4 100644 --- a/.github/workflows/ezsql-macos.yml +++ b/.github/workflows/ezsql-macos.yml @@ -36,7 +36,8 @@ jobs: run: | brew services start mysql@5.7 brew link mysql@5.7 --force - mysqld --initialize-insecure --ignore-db-dir=lost+found + sudo rm -rf /usr/local/var/mysql + mysqld --initialize-insecure mysql.server start - name: Setup MySQL Database run: | From 87d87ed197bfb4f17d682b47794218d65dd9e5ed Mon Sep 17 00:00:00 2001 From: techno-express Date: Fri, 5 Mar 2021 11:49:16 -0500 Subject: [PATCH 06/19] Update ezsql-macos.yml --- .github/workflows/ezsql-macos.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ezsql-macos.yml b/.github/workflows/ezsql-macos.yml index e28953b4..54222310 100644 --- a/.github/workflows/ezsql-macos.yml +++ b/.github/workflows/ezsql-macos.yml @@ -37,6 +37,7 @@ jobs: brew services start mysql@5.7 brew link mysql@5.7 --force sudo rm -rf /usr/local/var/mysql + sudo rm /etc/my.cnf mysqld --initialize-insecure mysql.server start - name: Setup MySQL Database From efd2a04e71c81e3c1be64385203132abf2396b3f Mon Sep 17 00:00:00 2001 From: techno-express Date: Fri, 5 Mar 2021 12:02:52 -0500 Subject: [PATCH 07/19] Update ezsql-macos.yml --- .github/workflows/ezsql-macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ezsql-macos.yml b/.github/workflows/ezsql-macos.yml index 54222310..c2a31ac7 100644 --- a/.github/workflows/ezsql-macos.yml +++ b/.github/workflows/ezsql-macos.yml @@ -37,7 +37,7 @@ jobs: brew services start mysql@5.7 brew link mysql@5.7 --force sudo rm -rf /usr/local/var/mysql - sudo rm /etc/my.cnf + sudo rm /usr/local/etc/my.cnf mysqld --initialize-insecure mysql.server start - name: Setup MySQL Database From 1f29dddc3945f7d0faa84b81c2a2f0fc7c9b146e Mon Sep 17 00:00:00 2001 From: techno-express Date: Fri, 5 Mar 2021 12:13:48 -0500 Subject: [PATCH 08/19] Update ezsql-macos.yml --- .github/workflows/ezsql-macos.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ezsql-macos.yml b/.github/workflows/ezsql-macos.yml index c2a31ac7..85fe94cc 100644 --- a/.github/workflows/ezsql-macos.yml +++ b/.github/workflows/ezsql-macos.yml @@ -38,7 +38,8 @@ jobs: brew link mysql@5.7 --force sudo rm -rf /usr/local/var/mysql sudo rm /usr/local/etc/my.cnf - mysqld --initialize-insecure + sudo chown -R _mysql:_mysql /usr/local/var/mysql + mysqld --initialize-insecure --explicit_defaults_for_timestamp mysql.server start - name: Setup MySQL Database run: | From 6023923def5f570c362e4b3d03f415e32617f8e9 Mon Sep 17 00:00:00 2001 From: techno-express Date: Fri, 5 Mar 2021 12:20:01 -0500 Subject: [PATCH 09/19] Update ezsql-macos.yml --- .github/workflows/ezsql-macos.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ezsql-macos.yml b/.github/workflows/ezsql-macos.yml index 85fe94cc..f44866ef 100644 --- a/.github/workflows/ezsql-macos.yml +++ b/.github/workflows/ezsql-macos.yml @@ -34,11 +34,7 @@ jobs: brew install mysql@5.7 - name: Brew Start MySQL run: | - brew services start mysql@5.7 brew link mysql@5.7 --force - sudo rm -rf /usr/local/var/mysql - sudo rm /usr/local/etc/my.cnf - sudo chown -R _mysql:_mysql /usr/local/var/mysql mysqld --initialize-insecure --explicit_defaults_for_timestamp mysql.server start - name: Setup MySQL Database From c97203b0ebb38bcb129bdba6fb6943972fc21dd8 Mon Sep 17 00:00:00 2001 From: techno-express Date: Fri, 5 Mar 2021 12:34:19 -0500 Subject: [PATCH 10/19] Update ezsql-macos.yml --- .github/workflows/ezsql-macos.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ezsql-macos.yml b/.github/workflows/ezsql-macos.yml index f44866ef..6073157c 100644 --- a/.github/workflows/ezsql-macos.yml +++ b/.github/workflows/ezsql-macos.yml @@ -35,6 +35,8 @@ jobs: - name: Brew Start MySQL run: | brew link mysql@5.7 --force + sudo rm -rf /usr/local/var/mysql + sudo rm /usr/local/etc/my.cnf mysqld --initialize-insecure --explicit_defaults_for_timestamp mysql.server start - name: Setup MySQL Database From 4bc6a254b7ac9d4856da343682c9af14cbec8909 Mon Sep 17 00:00:00 2001 From: techno-express Date: Mon, 29 Mar 2021 20:45:14 -0400 Subject: [PATCH 11/19] Update ezsql-linux.yml --- .github/workflows/ezsql-linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ezsql-linux.yml b/.github/workflows/ezsql-linux.yml index edcf3759..1806c29d 100644 --- a/.github/workflows/ezsql-linux.yml +++ b/.github/workflows/ezsql-linux.yml @@ -12,11 +12,11 @@ on: jobs: linux: name: Linux (PHP ${{ matrix.php-versions }} CI) - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 strategy: fail-fast: false matrix: - operating-system: [ubuntu-latest] + operating-system: [ubuntu-18.04] php-versions: ['7.4', '8.0'] steps: From e8ecbdc0ee5037ede2f8dd7a818a7053f0755fc5 Mon Sep 17 00:00:00 2001 From: Damien Date: Mon, 7 Feb 2022 22:14:18 +1300 Subject: [PATCH 12/19] Update Constants.php Update `_isNULL` and `_notNULL` constants to allow checks to run correctly --- lib/Constants.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Constants.php b/lib/Constants.php index 0648011f..c24c1f3c 100644 --- a/lib/Constants.php +++ b/lib/Constants.php @@ -39,8 +39,8 @@ \define('_BETWEEN', 'BETWEEN'); \define('_notBETWEEN', 'NOT BETWEEN'); - \define('_isNULL', 'IS NULL'); - \define('_notNULL', 'IS NOT NULL'); + \define('_isNULL', 'IS'); + \define('_notNULL', 'IS NOT'); \define('_BOOLEAN_OPERATORS', [ '<', '>', '=', '!=', '>=', '<=', '<>', 'IN', 'LIKE', 'NOT LIKE', 'BETWEEN', 'NOT BETWEEN', 'IS', 'IS NOT' From 741dc53593214475735d8c185452e7545213cec7 Mon Sep 17 00:00:00 2001 From: Damien Date: Mon, 7 Feb 2022 22:18:22 +1300 Subject: [PATCH 13/19] Update ezFunctions.php Uppercased right expression for type consistency specific to these methods in `isNull` and `isNotNull` --- lib/ezFunctions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ezFunctions.php b/lib/ezFunctions.php index 5839664a..bdc29c74 100644 --- a/lib/ezFunctions.php +++ b/lib/ezFunctions.php @@ -353,7 +353,7 @@ function gte($x, $y, $and = null, ...$args) * * @return array */ - function isNull($x, $y = 'null', $and = null, ...$args) + function isNull($x, $y = 'NULL', $and = null, ...$args) { $expression = array(); \array_push($expression, $x, \_isNULL, $y, $and, ...$args); @@ -370,7 +370,7 @@ function isNull($x, $y = 'null', $and = null, ...$args) * * @return array */ - function isNotNull($x, $y = 'null', $and = null, ...$args) + function isNotNull($x, $y = 'NULL', $and = null, ...$args) { $expression = array(); \array_push($expression, $x, \_notNULL, $y, $and, ...$args); From e690998268aa4d30353898bf1965f74250b48bf2 Mon Sep 17 00:00:00 2001 From: Damien Date: Mon, 7 Feb 2022 22:24:42 +1300 Subject: [PATCH 14/19] Update ezFunctionsTest.php Fix tests --- tests/ezFunctionsTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ezFunctionsTest.php b/tests/ezFunctionsTest.php index cf685cc2..bee8b52b 100644 --- a/tests/ezFunctionsTest.php +++ b/tests/ezFunctionsTest.php @@ -174,13 +174,13 @@ public function testGte() public function testIsNull() { $this->assertIsArray(isNull('field')); - $this->assertArraySubset([2 => 'null'], isNull('field')); + $this->assertArraySubset([2 => 'NULL'], isNull('field')); } public function testIsNotNull() { $this->assertIsArray(isNotNull('field')); - $this->assertArraySubset([2 => 'null'], isNotNull('field')); + $this->assertArraySubset([2 => 'NULL'], isNotNull('field')); } public function testLike() From 5eb046802e6eb5a41af48ed42649ada5634f635b Mon Sep 17 00:00:00 2001 From: techno-express Date: Mon, 25 Apr 2022 13:45:50 -0400 Subject: [PATCH 15/19] removed global keyword usage, test under PHP 8.1 - use separate class for internal global variables - removed `setInstance` - corrections for multi tag database instances - start testing under PHP 8.1 on Linux GitHub Action --- .github/workflows/ezsql-linux.yml | 2 +- composer.json | 4 +- lib/Database.php | 18 +++++---- lib/Database/ez_mysqli.php | 8 ++-- lib/Database/ez_pdo.php | 8 ++-- lib/Database/ez_pgsql.php | 8 ++-- lib/Database/ez_sqlite3.php | 8 ++-- lib/Database/ez_sqlsrv.php | 8 ++-- lib/Db.php | 66 +++++++++++++++++++++++++++++++ lib/ezFunctions.php | 66 ++++++++++--------------------- lib/ezResultset.php | 14 ++++--- tests/ezFunctionsTest.php | 6 --- 12 files changed, 130 insertions(+), 86 deletions(-) create mode 100644 lib/Db.php diff --git a/.github/workflows/ezsql-linux.yml b/.github/workflows/ezsql-linux.yml index 1806c29d..c444c550 100644 --- a/.github/workflows/ezsql-linux.yml +++ b/.github/workflows/ezsql-linux.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-18.04] - php-versions: ['7.4', '8.0'] + php-versions: ['7.4', '8.0', '8.1'] steps: - name: Checkout diff --git a/composer.json b/composer.json index d28eda0a..49262b9c 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ "issues": "https://github.com/ezSQL/ezSQL/issues" }, "require": { - "php": "^7.1 || ^8", + "php": ">7.1", "psr/container": "^1.0" }, "provide": { @@ -55,7 +55,7 @@ } }, "require-dev": { - "phpunit/phpunit": "^6 || ^7 || ^8" + "phpunit/phpunit": "^6 | ^7 | ^8" }, "autoload-dev": { "psr-4": { diff --git a/lib/Database.php b/lib/Database.php index a2e906c9..4baf5e72 100644 --- a/lib/Database.php +++ b/lib/Database.php @@ -4,8 +4,8 @@ namespace ezsql; +use ezsql\Db; use ezsql\DInjector; -use function ezsql\functions\setInstance; class Database { @@ -15,7 +15,10 @@ class Database * @var float */ private static $_ts = null; - private static $factory = null; + + /** + * @var ezQueryInterface[] + */ private static $instances = []; // @codeCoverageIgnoreStart @@ -67,10 +70,10 @@ public function __wakeup() * @param string $tag Store the instance for later use * @return Database\ez_pdo|Database\ez_pgsql|Database\ez_sqlsrv|Database\ez_sqlite3|Database\ez_mysqli */ - public static function initialize(?string $vendor = null, ?array $setting = null, ?string $tag = null) + public static function initialize(?string $vendor = null, ?array $setting = null, ?string $tag = null): ezQueryInterface { if (isset(self::$instances[$vendor]) && empty($setting) && empty($tag)) - return setInstance(self::$instances[$vendor]) ? self::$instances[$vendor] : false; + return self::$instances[$vendor]; if (empty($vendor) || empty($setting)) { throw new \Exception(\MISSING_CONFIGURATION); @@ -79,7 +82,7 @@ public static function initialize(?string $vendor = null, ?array $setting = null $key = $vendor; $value = \VENDOR[$key]; - if (empty($GLOBALS['ez' . $key]) || !empty($tag)) { + if (!Db::has('ez' . $key) || !empty($tag)) { $di = new DInjector(); $di->set($key, $value); $di->set('ezsql\ConfigInterface', 'ezsql\Config'); @@ -90,8 +93,9 @@ public static function initialize(?string $vendor = null, ?array $setting = null } } - setInstance($GLOBALS['ez' . $key]); - return $GLOBALS['ez' . $key]; + $db = Db::get('ez' . $key); + Db::set('global', $db); + return $db; } } diff --git a/lib/Database/ez_mysqli.php b/lib/Database/ez_mysqli.php index 7de25a4f..90641b0e 100644 --- a/lib/Database/ez_mysqli.php +++ b/lib/Database/ez_mysqli.php @@ -5,10 +5,10 @@ namespace ezsql\Database; use Exception; +use ezsql\Db; use ezsql\ezsqlModel; use ezsql\ConfigInterface; use ezsql\DatabaseInterface; -use function ezsql\functions\setInstance; class ez_mysqli extends ezsqlModel implements DatabaseInterface { @@ -44,9 +44,9 @@ public function __construct(ConfigInterface $settings = null) parent::__construct(); $this->database = $settings; - if (empty($GLOBALS['ez' . \MYSQLI])) - $GLOBALS['ez' . \MYSQLI] = $this; - setInstance($this); + if (!Db::has('ez' . \MYSQLI)) + Db::set('ez' . \MYSQLI, $this); + Db::set('global', $this); } // __construct public function settings() diff --git a/lib/Database/ez_pdo.php b/lib/Database/ez_pdo.php index eec3acd1..644afbed 100644 --- a/lib/Database/ez_pdo.php +++ b/lib/Database/ez_pdo.php @@ -5,10 +5,10 @@ namespace ezsql\Database; use Exception; +use ezsql\Db; use ezsql\ezsqlModel; use ezsql\ConfigInterface; use ezsql\DatabaseInterface; -use function ezsql\functions\setInstance; class ez_pdo extends ezsqlModel implements DatabaseInterface { @@ -47,9 +47,9 @@ public function __construct(ConfigInterface $settings = null) // Turn on track errors ini_set('track_errors', '1'); - if (empty($GLOBALS['ez' . \Pdo])) - $GLOBALS['ez' . \Pdo] = $this; - setInstance($this); + if (!Db::has('ez' . \Pdo)) + Db::set('ez' . \Pdo, $this); + Db::set('global', $this); } // __construct public function settings() diff --git a/lib/Database/ez_pgsql.php b/lib/Database/ez_pgsql.php index 71f5aeb7..8ace292a 100644 --- a/lib/Database/ez_pgsql.php +++ b/lib/Database/ez_pgsql.php @@ -5,10 +5,10 @@ namespace ezsql\Database; use Exception; +use ezsql\Db; use ezsql\ezsqlModel; use ezsql\ConfigInterface; use ezsql\DatabaseInterface; -use function ezsql\functions\setInstance; class ez_pgsql extends ezsqlModel implements DatabaseInterface { @@ -44,9 +44,9 @@ public function __construct(ConfigInterface $settings = null) parent::__construct(); $this->database = $settings; - if (empty($GLOBALS['ez' . \PGSQL])) - $GLOBALS['ez' . \PGSQL] = $this; - setInstance($this); + if (!Db::has('ez' . \PGSQL)) + Db::set('ez' . \PGSQL, $this); + Db::set('global', $this); } // __construct public function settings() diff --git a/lib/Database/ez_sqlite3.php b/lib/Database/ez_sqlite3.php index f36ac7f6..1cf729f7 100644 --- a/lib/Database/ez_sqlite3.php +++ b/lib/Database/ez_sqlite3.php @@ -5,10 +5,10 @@ namespace ezsql\Database; use Exception; +use ezsql\Db; use ezsql\ezsqlModel; use ezsql\ConfigInterface; use ezsql\DatabaseInterface; -use function ezsql\functions\setInstance; class ez_sqlite3 extends ezsqlModel implements DatabaseInterface { @@ -51,9 +51,9 @@ public function __construct(ConfigInterface $settings = null) // Turn on track errors ini_set('track_errors', '1'); - if (!isset($GLOBALS['ez' . \SQLITE3])) - $GLOBALS['ez' . \SQLITE3] = $this; - setInstance($this); + if (!Db::has('ez' . \SQLITE3)) + Db::set('ez' . \SQLITE3, $this); + Db::set('global', $this); } public function settings() diff --git a/lib/Database/ez_sqlsrv.php b/lib/Database/ez_sqlsrv.php index aca7a533..fb0f34e0 100644 --- a/lib/Database/ez_sqlsrv.php +++ b/lib/Database/ez_sqlsrv.php @@ -5,10 +5,10 @@ namespace ezsql\Database; use Exception; +use ezsql\Db; use ezsql\ezsqlModel; use ezsql\ConfigInterface; use ezsql\DatabaseInterface; -use function ezsql\functions\setInstance; class ez_sqlsrv extends ezsqlModel implements DatabaseInterface { @@ -53,9 +53,9 @@ public function __construct(ConfigInterface $settings = null) parent::__construct(); $this->database = $settings; - if (empty($GLOBALS['ez' . \SQLSRV])) - $GLOBALS['ez' . \SQLSRV] = $this; - setInstance($this); + if (!Db::has('ez' . \SQLSRV)) + Db::set('ez' . \SQLSRV, $this); + Db::set('global', $this); } public function settings() diff --git a/lib/Db.php b/lib/Db.php new file mode 100644 index 00000000..2da863e3 --- /dev/null +++ b/lib/Db.php @@ -0,0 +1,66 @@ +_position = 0; } // rewind @@ -111,7 +111,7 @@ public function current($mode = self::RESULT_AS_OBJECT) * Returns the current position in the resultset * @return int */ - public function key() + public function key(): int { return $this->_position; } // key @@ -119,7 +119,7 @@ public function key() /** * Sets the position of the resultset up by one */ - public function next() + public function next(): void { ++$this->_position; } // next @@ -128,7 +128,7 @@ public function next() * Sets position of the resultset down by one, if the position is below the * start, the position is set to the start position */ - public function previous() + public function previous(): void { --$this->_position; @@ -141,7 +141,7 @@ public function previous() * Whether the current position contains a row, or not * @return boolean */ - public function valid() + public function valid(): bool { return isset($this->_resultset[$this->_position]); } // valid @@ -159,6 +159,7 @@ public function fetch_assoc() } else { $return_val = false; } + return $return_val; } // fetch_assoc @@ -175,6 +176,7 @@ public function fetch_row() } else { $return_val = false; } + return $return_val; } // fetch_row @@ -191,6 +193,7 @@ public function fetch_object() } else { $return_val = false; } + return $return_val; } // fetch_object @@ -206,6 +209,7 @@ public function fetch_json() } else { $return_val = false; } + return $return_val; } // fetch_assoc //public function diff --git a/tests/ezFunctionsTest.php b/tests/ezFunctionsTest.php index cf685cc2..0208dc97 100644 --- a/tests/ezFunctionsTest.php +++ b/tests/ezFunctionsTest.php @@ -5,7 +5,6 @@ use ezsql\Tests\EZTestCase; use function ezsql\functions\{ - setInstance, getInstance, clearInstance, get_vendor, @@ -219,11 +218,6 @@ public function testNotBetween() $this->assertArraySubset([3 => 'data2'], notBetween('field', 'data', 'data2')); } - public function testSetInstance() - { - $this->assertFalse(setInstance()); - } - public function testSelect_into() { $this->assertFalse(select_into('field', 'data', 'data2')); From cccbe8a1318e13a0003307629fdb8535d0a4e05a Mon Sep 17 00:00:00 2001 From: techno-express Date: Mon, 25 Apr 2022 14:54:22 -0400 Subject: [PATCH 16/19] update some tests for PHP 8.1 behavior changes - update functions return type - PHP 8.1 compatible, whoever where this library return false for some access issues, 8.1 will throw errors/exceptions instead --- lib/ezFunctions.php | 38 ++++++++++++++++++------------------- tests/ezFunctionsTest.php | 5 ++++- tests/mysqli/mysqliTest.php | 20 ++++++++++++++++--- 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/lib/ezFunctions.php b/lib/ezFunctions.php index 3ad54532..615b7aed 100644 --- a/lib/ezFunctions.php +++ b/lib/ezFunctions.php @@ -4,12 +4,12 @@ namespace ezsql\functions; +use ezsql\Db; use ezsql\ezQuery; use ezsql\ezSchema; use ezsql\Database; use ezsql\ezQueryInterface; use ezsql\DatabaseInterface; -use ezsql\Db; use ezsql\ezsqlModelInterface; if (!\function_exists('ezFunctions')) { @@ -244,7 +244,7 @@ function changingColumn(string $columnName, ...$datatype) * * @return array */ - function eq($x, $y, $and = null, ...$args) + function eq($x, $y, $and = null, ...$args): array { $expression = array(); \array_push($expression, $x, \EQ, $y, $and, ...$args); @@ -270,7 +270,7 @@ function eq($x, $y, $and = null, ...$args) * * @return array */ - function neq($x, $y, $and = null, ...$args) + function neq($x, $y, $and = null, ...$args): array { $expression = array(); \array_push($expression, $x, \NEQ, $y, $and, ...$args); @@ -287,7 +287,7 @@ function neq($x, $y, $and = null, ...$args) * * @return array */ - function ne($x, $y, $and = null, ...$args) + function ne($x, $y, $and = null, ...$args): array { $expression = array(); \array_push($expression, $x, \NE, $y, $and, ...$args); @@ -304,7 +304,7 @@ function ne($x, $y, $and = null, ...$args) * * @return array */ - function lt($x, $y, $and = null, ...$args) + function lt($x, $y, $and = null, ...$args): array { $expression = array(); \array_push($expression, $x, \LT, $y, $and, ...$args); @@ -321,7 +321,7 @@ function lt($x, $y, $and = null, ...$args) * * @return array */ - function lte($x, $y, $and = null, ...$args) + function lte($x, $y, $and = null, ...$args): array { $expression = array(); \array_push($expression, $x, \LTE, $y, $and, ...$args); @@ -338,7 +338,7 @@ function lte($x, $y, $and = null, ...$args) * * @return array */ - function gt($x, $y, $and = null, ...$args) + function gt($x, $y, $and = null, ...$args): array { $expression = array(); \array_push($expression, $x, \GT, $y, $and, ...$args); @@ -355,7 +355,7 @@ function gt($x, $y, $and = null, ...$args) * * @return array */ - function gte($x, $y, $and = null, ...$args) + function gte($x, $y, $and = null, ...$args): array { $expression = array(); \array_push($expression, $x, \GTE, $y, $and, ...$args); @@ -372,7 +372,7 @@ function gte($x, $y, $and = null, ...$args) * * @return array */ - function isNull($x, $y = 'null', $and = null, ...$args) + function isNull($x, $y = 'null', $and = null, ...$args): array { $expression = array(); \array_push($expression, $x, \_isNULL, $y, $and, ...$args); @@ -389,7 +389,7 @@ function isNull($x, $y = 'null', $and = null, ...$args) * * @return array */ - function isNotNull($x, $y = 'null', $and = null, ...$args) + function isNotNull($x, $y = 'null', $and = null, ...$args): array { $expression = array(); \array_push($expression, $x, \_notNULL, $y, $and, ...$args); @@ -406,7 +406,7 @@ function isNotNull($x, $y = 'null', $and = null, ...$args) * * @return array */ - function like($x, $y, $and = null, ...$args) + function like($x, $y, $and = null, ...$args): array { $expression = array(); \array_push($expression, $x, \_LIKE, $y, $and, ...$args); @@ -423,7 +423,7 @@ function like($x, $y, $and = null, ...$args) * * @return array */ - function notLike($x, $y, $and = null, ...$args) + function notLike($x, $y, $and = null, ...$args): array { $expression = array(); \array_push($expression, $x, \_notLIKE, $y, $and, ...$args); @@ -440,7 +440,7 @@ function notLike($x, $y, $and = null, ...$args) * * @return array */ - function in($x, $y, ...$args) + function in($x, $y, ...$args): array { $expression = array(); \array_push($expression, $x, \_IN, $y, ...$args); @@ -457,7 +457,7 @@ function in($x, $y, ...$args) * * @return array */ - function notIn($x, $y, ...$args) + function notIn($x, $y, ...$args): array { $expression = array(); \array_push($expression, $x, \_notIN, $y, ...$args); @@ -474,7 +474,7 @@ function notIn($x, $y, ...$args) * * @return array */ - function between($x, $y, $y2, ...$args) + function between($x, $y, $y2, ...$args): array { $expression = array(); \array_push($expression, $x, \_BETWEEN, $y, $y2, \_AND, ...$args); @@ -491,7 +491,7 @@ function between($x, $y, $y2, ...$args) * * @return array */ - function notBetween($x, $y, $y2, ...$args) + function notBetween($x, $y, $y2, ...$args): array { $expression = array(); \array_push($expression, $x, \_notBETWEEN, $y, $y2, \_AND, ...$args); @@ -540,7 +540,7 @@ function get_results($output = \OBJECT, $instance = null) * * @return string cleaned string */ - function clean_string(string $string) + function clean_string(string $string): string { $patterns = array( // strip out: '@]*?>.*?@si', // Strip out javascript @@ -563,7 +563,7 @@ function clean_string(string $string) * @param string $filename will be preprocess with `sanitize_path()` * @return boolean */ - function is_traversal(string $basePath, string $filename) + function is_traversal(string $basePath, string $filename): bool { if (\strpos(\urldecode($filename), '..') !== false) return true; @@ -588,7 +588,7 @@ function is_traversal(string $basePath, string $filename) * @param string $path original file/path to be sanitized. * @return string */ - function sanitize_path(string $path) + function sanitize_path(string $path): string { $file = \preg_replace("/\.[\.]+/", "", $path); $file = \preg_replace("/^[\/]+/", "", $file); diff --git a/tests/ezFunctionsTest.php b/tests/ezFunctionsTest.php index 0208dc97..d91b3acd 100644 --- a/tests/ezFunctionsTest.php +++ b/tests/ezFunctionsTest.php @@ -64,7 +64,10 @@ protected function setUp(): void public function testClean_string() { - $this->assertEquals("' help", clean_string("' help")); + if ((float) \phpversion() >= 8.1) + $this->assertEquals("' help", clean_string("' help")); + else + $this->assertEquals("' help", clean_string("' help")); } public function testSanitize_path() diff --git a/tests/mysqli/mysqliTest.php b/tests/mysqli/mysqliTest.php index bdae11c5..85e7e9ff 100644 --- a/tests/mysqli/mysqliTest.php +++ b/tests/mysqli/mysqliTest.php @@ -99,7 +99,12 @@ public function testConnect() $this->errors = array(); set_error_handler(array($this, 'errorHandler')); - $this->assertFalse($this->object->connect('no', '')); + if ((float) \phpversion() >= 8.1) { + $this->expectException(\mysqli_sql_exception::class); + $this->assertFalse($this->object->connect('no', '')); + } else + $this->assertFalse($this->object->connect('no', '')); + $this->assertFalse($this->object->connect('self::TEST_DB_USER', 'self::TEST_DB_PASSWORD', ' self::TEST_DB_HOST', 'self::TEST_DB_PORT')); $result = $this->object->connect(self::TEST_DB_USER, self::TEST_DB_PASSWORD); @@ -284,8 +289,17 @@ public function testCreatingReplacing() { $this->object->quick_connect(); $this->object->prepareOff(); - $this->assertFalse($this->object->replacing([])); - $this->assertFalse($this->object->creating([])); + if ((float) \phpversion() >= 8.1) { + $this->expectException(\mysqli_sql_exception::class); + $this->assertFalse($this->object->replacing([])); + } else + $this->assertFalse($this->object->replacing([])); + + if ((float) \phpversion() >= 8.1) { + $this->expectException(\mysqli_sql_exception::class); + $this->assertFalse($this->object->creating([])); + } else + $this->assertFalse($this->object->creating([])); set_table('unit_test'); $this->assertEquals( From 74df1141602b4b6148672d9373441c6d3597bd94 Mon Sep 17 00:00:00 2001 From: if3lc Date: Sat, 14 Jan 2023 20:44:22 +0300 Subject: [PATCH 17/19] Example usage fixed --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d8c8aaf1..8afcb5ec 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ $db = Database::initialize('****', [$dsn_path_user, $password, $database, $other use ezsql\Config; use ezsql\Database\ez_****; -$setting = new Config('****', [$dsn_path_user, $password, $database, $other_settings]); +$settings = new Config('****', [$dsn_path_user, $password, $database, $other_settings]); $db = new ez_****($settings); ``` From bc6e1d0db188cfd535061d1040d3e75d2fd90483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaz=C4=B1m=20=C3=96lmez?= Date: Wed, 30 Apr 2025 04:29:18 +0300 Subject: [PATCH 18/19] Fix Error: Uncaught TypeError: Argument 1 passed Fix in error: Fatal error: Uncaught TypeError: Argument 1 passed to ezsql\Database\ez_pdo::escape() must be of the type string, null given, called in /var/www/vendor/ezsql/ezsql/lib/ezQuery.php on line 633 and defined in /var/www/vendor/ezsql/ezsql/lib/Database/ez_pdo.php:173 Stack trace: #0 /var/www/vendor/ezsql/ezsql/lib/ezQuery.php(633): ezsql\Database\ez_pdo->escape(NULL) #1 /var/www/ajax.php(478): ezsql\ezQuery->update('restaurant', Array, Array) #2 {main} thrown in /var/www/vendor/ezsql/ezsql/lib/Database/ez_pdo.php on line 173 --- lib/ezQuery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ezQuery.php b/lib/ezQuery.php index 21fccb3d..4d0ff831 100644 --- a/lib/ezQuery.php +++ b/lib/ezQuery.php @@ -622,7 +622,7 @@ public function update(string $table = null, $keyValue, ...$whereConditions) $sql = "UPDATE $table SET "; foreach ($keyValue as $key => $val) { - if (\strtolower($val) == 'null') { + if (is_null($val) || \strtolower($val) == 'null') { $sql .= "$key = NULL, "; } elseif (\in_array(\strtolower($val), array('current_timestamp()', 'date()', 'now()'))) { $sql .= "$key = CURRENT_TIMESTAMP(), "; From 0eb24c8307fc5cd79adecebb650217c3f49c7077 Mon Sep 17 00:00:00 2001 From: Zag Date: Thu, 30 Oct 2025 11:46:47 +0000 Subject: [PATCH 19/19] Fix reference to argument in closure for params Fix reference to argument in closure for params See issue 222 --- lib/Database/ez_mysqli.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Database/ez_mysqli.php b/lib/Database/ez_mysqli.php index 90641b0e..0d338359 100644 --- a/lib/Database/ez_mysqli.php +++ b/lib/Database/ez_mysqli.php @@ -291,7 +291,7 @@ public function query_prepared(string $query, array $param = null) $params = []; $types = \array_reduce( $param, - function ($string, &$arg) use (&$params) { + function ($string, $arg) use (&$params) { $params[] = &$arg; if (\is_float($arg)) $string .= 'd';