Commit f33c27ad authored by Arda Kılıçdağı's avatar Arda Kılıçdağı

PHP7 Support

parent 3cd44d09
...@@ -6,3 +6,4 @@ composer.lock ...@@ -6,3 +6,4 @@ composer.lock
*.sublime-project *.sublime-project
*.sublime-workspace *.sublime-workspace
*.project *.project
/.idea
\ No newline at end of file
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
"illuminate/support": "4.2.*", "illuminate/support": "4.2.*",
"illuminate/container": "4.2.*", "illuminate/container": "4.2.*",
"illuminate/database": "4.2.*", "illuminate/database": "4.2.*",
"illuminate/events": "4.2.*" "illuminate/events": "4.2.*",
"alcaeus/mongo-php-adapter": "^1.1.0"
}, },
"require-dev": { "require-dev": {
"orchestra/testbench": "2.2.*", "orchestra/testbench": "2.2.*",
......
...@@ -56,7 +56,22 @@ class Collection { ...@@ -56,7 +56,22 @@ class Collection {
$start = microtime(true); $start = microtime(true);
$result = call_user_func_array(array($this->collection, $method), $parameters); //$result = call_user_func_array(array($this->collection, $method), $parameters);
// Fix for PHP7
// https://github.com/LearningLocker/learninglocker/issues/893#issue-203456708
// based on https://github.com/alcaeus/mongo-php-adapter/issues/107#issuecomment-219393254
if (PHP_VERSION_ID >= 70000 && in_array($method, array('insert', 'batchInsert', 'save'))) {
$saveData = array_shift($parameters);
$saveParams = array_shift($parameters);
if (NULL==$saveParams) {
$saveParams = array();
}
$result = call_user_func_array(array($this->collection, $method), array(&$saveData, $saveParams));
} else {
$result = call_user_func_array(array($this->collection, $method), $parameters);
}
// Once we have run the query we will calculate the time that it took to run and // Once we have run the query we will calculate the time that it took to run and
// then log the query, bindings, and execution time so we will report them on // then log the query, bindings, and execution time so we will report them on
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment