AnsweredAssumed Answered

FileMaker.php: bug in PerformScriptImpl.php results in error when script does not exist

Question asked by daalcivare on Mar 20, 2012
Latest reply on Mar 26, 2012 by TSGal

Summary

FileMaker.php: bug in PerformScriptImpl.php results in error when script does not exist

Product

FileMaker Server

Version

FileMaker.php api version 1.1

Operating system version

Windows XP

Description of the issue

when attempting to call a script that does not exist filemaker.php api results in an "Only variable references should be returned by reference" error.

Steps to reproduce the problem

<?php
require_once('FileMaker.php');

$conn = new FileMaker();
$conn->setProperty('database','ENTER_VALID_DB');
$conn->setProperty('host', 'ENTER_VALID_HOST');
$conn->setProperty('username','ENTER_VALID_USERNAME');
$conn->setProperty('password', 'ENTER_VALID_PASSWORD');

$layout = 'ENTER_VALID_LAYOUT';
$script = 'enter_INVALID_script_name';

$cmd = $conn->newPerformScriptCommand($layout,$script);
if (FileMaker::isError($cmd)) {
   exit('EXCEPTION: ' . $cmd->getCode() . ': ' . $cmd->getMessage());
}

$result = $cmd->execute();
if (FileMaker::isError($result)) {
   exit('EXCEPTION2: ' . $result->getCode() . ': ' . $result->getMessage());
} else {
   echo 'SUCCESS';
}

Expected result

EXCEPTION2: 104: Script is missing

Actual result

Notice: Only variable references should be returned by reference in C:\local\bin\php5.2\FileMaker\Command.php on line 126
EXCEPTION2: 104: Script is missing

Exact text of any error message(s) that appear

see above

Workaround

diff --git a/FileMaker/Implementation/Command/PerformScriptImpl.php b/FileMaker/Implementation/Command/PerformScriptImpl.php
index 5804fd8..5b6d44e 100644
--- a/FileMaker/Implementation/Command/PerformScriptImpl.php
+++ b/FileMaker/Implementation/Command/PerformScriptImpl.php
@@ -8,7 +8,7 @@
$this->_script = $V2550889a;
$this->_scriptParams = $V9b479e5e;
}
- function execute()
+ function &execute()
  {
  $V21ffce5b = $this->_getCommandParams();
  $V21ffce5b['-findany'] = true;

Outcomes