vmware-archive/kubeless

PHP Function returns junk if event->data has more than one key in the input payload

flavioschuindt opened this issue · 0 comments

Is this a BUG REPORT or FEATURE REQUEST?: BUG REPORT

What happened: PHP Function returns junk if event->data has more than one key

What you expected to happen: PHP Function should return the proper output no matter the quantity of keys in the input data

How to reproduce it (as minimally and precisely as possible):

  • Create a simple function that echoes the input passed:
kubeless function deploy hello-php-data --runtime php7.4 --handler foo --from-file hellowithdata.php

hellowithdata.php:

<?php

function foo($event, $context) {
  return json_encode($event->data);
}
  • Call the function with a simple payload. It works:
kubeless function call hello-php-data --data '{"foo": "bar"}'                                                                                                                                                        
{"foo":"bar"}
  • Call the same function with an extra key/value in the input. It outputs junk, i.e., something in binary:
kubeless function call hello-php-data --data '{"foo": "bar", "a":"b"}'                                                                                                                                              
�VJ��W�RJJ,R�QJ��j��

Anything else we need to know?: Tested same type of function in other runtimes (python, ruby and nodejs) and both scenarios above worked fine.

Environment:

  • Kubernetes version (use kubectl version): 1.18.9
  • Kubeless version (use kubeless version): 1.0.8
  • Cloud provider or physical cluster: physical cluster