KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Make sure to use the proper return value when using PHP EXECUTE
PRODUCT: 4D | VERSION: 15.1 | PLATFORM: Mac & Win
Published On: January 22, 2016

PHP EXECUTE allows the developer to use either Blob or Text to recieve any return variable from the PHP function/script being executed. It is very important that the developer choose the appropriate variable type for the return value or else the returned value may not make sense.

If the PHP function/script is returning a Binary format then a 4D BLOB variable must be used because the Binary data could not be saved to 4D TEXT variable.

When a call to a PHP function/script completes, if the execution was successful and it returns Binary data then the boolean return value will be True (identifying that the execution was successful) however the returned value will be Null:

C_TEXT($textResult)
$ok:=PHP Execute(pathToScript;"";$textResult)//$ok is true, testResult is null


The simple fix for this is to just change the return variable to a BLOB:
C_BLOB($blobResult)
$ok:=PHP Execute(pathToScript;"";$blobResult)//$ok is true, blobResult is filled