AnsweredAssumed Answered

Potential Bug in FileMakerImpl.php

Question asked by daalcivare on Feb 15, 2012
Latest reply on Mar 1, 2012 by rmanook

Summary

Potential Bug in FileMakerImpl.php

Product

FileMaker Server

Version

11.0.3.309

Operating system version

Windows 7 SP1 32-bit

Description of the issue

When connecting to different databases within one PHP file the getLayout function returns layout information only for the first database that was connected to.

Steps to reproduce the problem

preconditions:
- filemaker server and custom php component installed on one server
- two databases have been published to connect via php. Referred to as FM_db1 and FM_db2.
- each database above has a layout. Referred to as FMLayout for both databases
- apache 2.2 is serving the php scripts (though i assume the same will happen with IIS)

* run this script on apache (or IIS)

// start script
<?php

require_once('FileMaker.php');

$connection = new FileMaker();
$connection->setProperty('database', 'FM_db1');
$connection->setProperty('host', 'http://localhost:8080');
$connection->setProperty('username', 'username');
$connection->setProperty('password', 'password');

$layouts = $connection->getLayout('FMLayout');
echo 'orders layout
';
echo print_r($layouts, true);
echo '
';


$connection = new FileMaker();
$connection->setProperty('database', 'FM_db2');
$connection->setProperty('host', 'http://localhost:8080');
$connection->setProperty('username', 'username');
$connection->setProperty('password', 'password');

$layouts = $connection->getLayout('FMLayout');
echo 'orders layout
';
echo print_r($layouts, true);
echo '
';
?>

Expected result

for the first print_r expect to see layout information for FM_db1

for the second print_r expect to see layout information for FM_db2

Actual result

for the first print_r see layout information for FM_db1

for the second print_r see layout information for FM_db1, not FM_db2.

Workaround

in getLayout function of FileMakerImpl.php, line 195 reads:

function &getLayout($Vf43ac2d2)
{
static $V34d59fda = array();


to get correct layout information, remove the static keyword:

function &getLayout($Vf43ac2d2)
{
$V34d59fda = array();



Outcomes