You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by dg...@apache.org on 2018/07/10 02:34:32 UTC
[incubator-openwhisk-runtime-php] 01/04: Do not write sentinels on
a second init
This is an automated email from the ASF dual-hosted git repository.
dgrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-runtime-php.git
commit 52b3fbc5de61a6c1d1eeb701387d4f99ec4ef4aa
Author: Rob Allen <ro...@akrabat.com>
AuthorDate: Mon Jul 9 09:27:17 2018 +0100
Do not write sentinels on a second init
If a second /init is attempted, we don't want to write sentinels as this
will truncate the log stream.
---
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 3c24ff3..d023f1a 100644
--- a/core/php7.1Action/router.php
+++ b/core/php7.1Action/router.php
@@ -93,7 +93,9 @@ function init() : array
{
// check that we haven't already been initialised
if (file_exists(ACTION_CONFIG_FILE)) {
- throw new RuntimeException('Cannot initialize the action more than once.', 403);
+ writeTo("php://stdout", 'Error: Cannot initialize the action more than once.');
+ http_response_code(403);
+ return ['error' => 'Cannot initialize the action more than once.'];
}
// data is POSTed to us as a JSON string
diff --git a/core/php7.2Action/router.php b/core/php7.2Action/router.php
index 890d55c..87456d1 100644
--- a/core/php7.2Action/router.php
+++ b/core/php7.2Action/router.php
@@ -124,7 +124,9 @@ function init() : array
{
// check that we haven't already been initialised
if (file_exists(ACTION_CONFIG_FILE)) {
- throw new RuntimeException('Cannot initialize the action more than once.', 403);
+ writeTo("php://stdout", 'Error: Cannot initialize the action more than once.');
+ http_response_code(403);
+ return ['error' => 'Cannot initialize the action more than once.'];
}
// data is POSTed to us as a JSON string