Monday, July 12, 2010

Shhh! How to Silence the "Only variable references should be returned by reference" Notice

This is one of those weird issues that I've probably run into a half dozen times, and it gets me every time.

When using the FileMaker API for PHP to call a FileMaker script, you'll sometimes get this notice:

Notice: Only variable references should be returned by reference in C:\inetpub\www.somewebsite.com\data\FileMaker\Command.php on line 127


I'm still not sure what causes this notice to be displayed, but I do know how to prevent it from being displayed. Simply add the error silencing "@" symbol to the execute comand. For example...

// Create a "perform script" command.
$fm_request = $fm -> newPerformScriptCommand ( 'PHP - Layout', 'Some Script', $script_param );

// Execute the request.
$fm_result = @ $fm_request -> execute ();


And that should do it!

-- Tim