From 798d498001acefab49f072af001a9b6267440721 Mon Sep 17 00:00:00 2001 From: Bartek Fabiszewski Date: Mon, 22 May 2017 23:00:09 +0200 Subject: [PATCH] Mapping values to references fails on php7 --- helpers/position.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/helpers/position.php b/helpers/position.php index 69e004c..465466d 100644 --- a/helpers/position.php +++ b/helpers/position.php @@ -265,11 +265,11 @@ */ private function loadWithQuery($query, $bindParams = NULL) { $stmt = self::$db->prepare($query); - if (is_array($bindParams) && ($types = array_shift($bindParams))) { - call_user_func_array( - [ $stmt, 'bind_param' ], - array_merge([ $types ], array_map(function(&$param) { return $param; }, $bindParams)) - ); + if (is_array($bindParams)) { + foreach ($bindParams as $key => &$value) { + $bindParams[$key] = $value; + } + call_user_func_array([ $stmt, 'bind_param' ], $bindParams); } if ($stmt->execute()) { $stmt->bind_result($this->id, $this->timestamp, $this->userId, $this->trackId,