You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2019/12/14 23:22:44 UTC
[openwhisk-runtime-php] 04/05: Add getenv support to PHP 7.1 and
7.2 runtimes
This is an automated email from the ASF dual-hosted git repository.
rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-runtime-php.git
commit a2f3ad3bf9cddc8e13c08f0bb797ad4fb8f4adb1
Author: Rob Allen <ro...@akrabat.com>
AuthorDate: Sat Dec 14 19:33:27 2019 +0000
Add getenv support to PHP 7.1 and 7.2 runtimes
---
core/php7.1Action/router.php | 4 +++-
core/php7.2Action/router.php | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/core/php7.1Action/router.php b/core/php7.1Action/router.php
index eadc153..db63b7d 100644
--- a/core/php7.1Action/router.php
+++ b/core/php7.1Action/router.php
@@ -199,7 +199,9 @@ function run() : array
$env['PHP_VERSION'] = $_ENV['PHP_VERSION'];
foreach (array_keys($post) as $param) {
if ($param !== "value") {
- $env['__OW_' . strtoupper($param)] = $post[$param];
+ $envKeyName = '__OW_' . strtoupper($param);
+ $env[$envKeyName] = $post[$param];
+ putenv($envKeyName . '=' . $post[$param]);
}
}
diff --git a/core/php7.2Action/router.php b/core/php7.2Action/router.php
index 3bf01a1..78c5108 100644
--- a/core/php7.2Action/router.php
+++ b/core/php7.2Action/router.php
@@ -220,7 +220,9 @@ function run() : array
// assign environment variables from the posted data
foreach (array_keys($post) as $param) {
if ($param !== "value") {
- $_ENV['__OW_' . strtoupper($param)] = $post[$param];
+ $envKeyName = '__OW_' . strtoupper($param);
+ $_ENV[$envKeyName] = $post[$param];
+ putenv($envKeyName . '=' . $post[$param]);
}
}