Commit cc20ee30 authored by Jens Segers's avatar Jens Segers Committed by GitHub

Merge pull request #1197 from Ardakilic/2.0-forpr

PHP7 Support for Laravel 4.2
parents 3cd44d09 f33c27ad
......@@ -6,3 +6,4 @@ composer.lock
*.sublime-project
*.sublime-workspace
*.project
/.idea
\ No newline at end of file
......@@ -14,7 +14,8 @@
"illuminate/support": "4.2.*",
"illuminate/container": "4.2.*",
"illuminate/database": "4.2.*",
"illuminate/events": "4.2.*"
"illuminate/events": "4.2.*",
"alcaeus/mongo-php-adapter": "^1.1.0"
},
"require-dev": {
"orchestra/testbench": "2.2.*",
......
......@@ -56,7 +56,22 @@ class Collection {
$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
// 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