diff --git a/app/workers/functions.php b/app/workers/functions.php index f9023c3ad..1acde1f62 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -414,8 +414,8 @@ class FunctionsV1 extends Worker $orchestration->setMemory((int) App::getEnv('_APP_FUNCTIONS_MEMORY', 256)); $orchestration->setSwap((int) App::getEnv('_APP_FUNCTIONS_MEMORY_SWAP', 256)); - foreach ($vars as &$value) { - $value = strval($value); + foreach ($vars as $key => $value) { + $vars[$key] = strval($value); } $id = $orchestration->run( diff --git a/composer.json b/composer.json index 1e424fc4a..22635d9d1 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,7 @@ "utopia-php/image": "0.5.*", "resque/php-resque": "1.3.6", "matomo/device-detector": "4.2.3", - "utopia-php/orchestration": "0.2.0", + "utopia-php/orchestration": "0.2.1", "dragonmantank/cron-expression": "3.1.0", "influxdb/influxdb-php": "1.15.2", "phpmailer/phpmailer": "6.5.0", diff --git a/composer.lock b/composer.lock index 747f8cc80..b465c73b7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "86c1d7779c0c083c4493e154d6bb3ee0", + "content-hash": "e86dfb61222e6281eaa23561c5958534", "packages": [ { "name": "adhocore/jwt", @@ -1909,16 +1909,16 @@ }, { "name": "utopia-php/orchestration", - "version": "0.2.0", + "version": "0.2.1", "source": { "type": "git", "url": "https://github.com/utopia-php/orchestration.git", - "reference": "de10509017768cf2b62363bb39912002ab41dafb" + "reference": "55da7a331a45d5887de8122268dfccd15fee94d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/orchestration/zipball/de10509017768cf2b62363bb39912002ab41dafb", - "reference": "de10509017768cf2b62363bb39912002ab41dafb", + "url": "https://api.github.com/repos/utopia-php/orchestration/zipball/55da7a331a45d5887de8122268dfccd15fee94d1", + "reference": "55da7a331a45d5887de8122268dfccd15fee94d1", "shasum": "" }, "require": { @@ -1958,9 +1958,9 @@ ], "support": { "issues": "https://github.com/utopia-php/orchestration/issues", - "source": "https://github.com/utopia-php/orchestration/tree/0.2.0" + "source": "https://github.com/utopia-php/orchestration/tree/0.2.1" }, - "time": "2021-08-16T12:52:42+00:00" + "time": "2021-09-03T11:29:20+00:00" }, { "name": "utopia-php/preloader", @@ -4995,6 +4995,7 @@ "type": "github" } ], + "abandoned": true, "time": "2020-09-28T06:45:17+00:00" }, { diff --git a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php index 4b52aa26c..77968e503 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php @@ -209,6 +209,7 @@ class FunctionsCustomClientTest extends Scope $this->assertEquals('foobar', $output['APPWRITE_FUNCTION_DATA']); $this->assertEquals($this->getUser()['$id'], $output['APPWRITE_FUNCTION_USER_ID']); $this->assertNotEmpty($output['APPWRITE_FUNCTION_JWT']); + $this->assertEquals($projectId, $output['APPWRITE_FUNCTION_PROJECT_ID']); $executions = $this->client->call(Client::METHOD_GET, '/functions/'.$functionId.'/executions', [ 'content-type' => 'application/json', diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 58740150d..e14a35d93 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -606,6 +606,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('foobar', $output['APPWRITE_FUNCTION_DATA']); $this->assertEquals('', $output['APPWRITE_FUNCTION_USER_ID']); $this->assertEmpty($output['APPWRITE_FUNCTION_JWT']); + $this->assertEquals($this->getProject()['$id'], $output['APPWRITE_FUNCTION_PROJECT_ID']); $executions = $this->client->call(Client::METHOD_GET, '/functions/'.$functionId.'/executions', array_merge([ 'content-type' => 'application/json', diff --git a/tests/resources/functions/php-fn.tar.gz b/tests/resources/functions/php-fn.tar.gz index 5e359122f..96cdc5b25 100644 Binary files a/tests/resources/functions/php-fn.tar.gz and b/tests/resources/functions/php-fn.tar.gz differ diff --git a/tests/resources/functions/php-fn/index.php b/tests/resources/functions/php-fn/index.php index 449658e1e..343214b3f 100644 --- a/tests/resources/functions/php-fn/index.php +++ b/tests/resources/functions/php-fn/index.php @@ -29,6 +29,7 @@ $output = [ 'APPWRITE_FUNCTION_DATA' => $_ENV['APPWRITE_FUNCTION_DATA'], 'APPWRITE_FUNCTION_USER_ID' => $_ENV['APPWRITE_FUNCTION_USER_ID'], 'APPWRITE_FUNCTION_JWT' => $_ENV['APPWRITE_FUNCTION_JWT'], + 'APPWRITE_FUNCTION_PROJECT_ID' => $_ENV['APPWRITE_FUNCTION_PROJECT_ID'], ]; echo json_encode($output);