Support array result include sequence action (#120)
diff --git a/core/php7.4Action/Dockerfile b/core/php7.4Action/Dockerfile
index d0d7806..cda7f07 100644
--- a/core/php7.4Action/Dockerfile
+++ b/core/php7.4Action/Dockerfile
@@ -26,12 +26,12 @@
# or build it from a release
FROM golang:1.18 AS builder_release
-ARG GO_PROXY_RELEASE_VERSION=1.18@1.19.0
+ARG GO_PROXY_RELEASE_VERSION=1.18@1.20.0
RUN curl -sL \
https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
| tar xzf -\
&& cd openwhisk-runtime-go-*/main\
- && GO111MODULE=on go build -o /bin/proxy
+ && GO111MODULE=on GO111MODULE=on go build -o /bin/proxy
FROM php:7.4-cli-buster
diff --git a/core/php8.0Action/Dockerfile b/core/php8.0Action/Dockerfile
index 5480d5f..303b292 100644
--- a/core/php8.0Action/Dockerfile
+++ b/core/php8.0Action/Dockerfile
@@ -26,12 +26,12 @@
# or build it from a release
FROM golang:1.18 AS builder_release
-ARG GO_PROXY_RELEASE_VERSION=1.18@1.19.0
+ARG GO_PROXY_RELEASE_VERSION=1.18@1.20.0
RUN curl -sL \
https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
| tar xzf -\
&& cd openwhisk-runtime-go-*/main\
- && GO111MODULE=on go build -o /bin/proxy
+ && GO111MODULE=on CGO_ENABLED=0 go build -o /bin/proxy
FROM php:8.0-cli-buster
diff --git a/tests/src/test/scala/runtime/actionContainers/Php7ActionContainerTests.scala b/tests/src/test/scala/runtime/actionContainers/Php7ActionContainerTests.scala
index 2a46442..827cb09 100644
--- a/tests/src/test/scala/runtime/actionContainers/Php7ActionContainerTests.scala
+++ b/tests/src/test/scala/runtime/actionContainers/Php7ActionContainerTests.scala
@@ -486,4 +486,49 @@
runRes.get.fields.get("result") shouldBe Some(JsString("it works"))
}
}
+
+ it should "support return array result" in {
+ val srcs = Seq(
+ Seq("index.php") ->
+ """
+ | <?php
+ | function main(array $args) : array
+ | {
+ | $result=array("a","b");
+ | return $result;
+ | }
+ """.stripMargin)
+
+ val code = ZipBuilder.mkBase64Zip(srcs)
+
+ withPhp7Container { c =>
+ c.init(initPayload(code))._1 should be(200)
+
+ val (runCode, runRes) = c.run(runPayload(JsObject()))
+ runCode should be(200)
+ runRes shouldBe Some(JsObject("0" -> JsString("a"), "1" -> JsString("b")))
+ }
+ }
+
+ it should "support array as input param" in {
+ val srcs = Seq(
+ Seq("index.php") ->
+ """
+ | <?php
+ | function main(array $args) : array
+ | {
+ | return $args;
+ | }
+ """.stripMargin)
+
+ val code = ZipBuilder.mkBase64Zip(srcs)
+
+ withPhp7Container { c =>
+ c.init(initPayload(code))._1 should be(200)
+
+ val (runCode, runRes) = c.run(runPayload(JsArray(JsString("a"), JsString("b"))))
+ runCode should be(200)
+ runRes shouldBe Some(JsObject("0" -> JsString("a"), "1" -> JsString("b")))
+ }
+ }
}