1 Reply Latest reply on Mar 1, 2012 6:08 PM by rmanook

    Potential Bug in FileMakerImpl.php

    daalcivare

      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();



        • 1. Re: Potential Bug in FileMakerImpl.php
          rmanook

          Hi Dana Alcivare:

          Thanks for posting and for the thorough bug submission.

          Is it possible to have you send me files with:
          A. The result of both queries
          B. A file for the result when FM_db1 is queried separately
          C. A file for the result when FM_db2 is qureied separately

          I will send you a private message including this request and the email address to send it to.  To view this, click on the 'Inbox' link in the upper right corner of this forum next to the 'Signed in as' link.

          Also, just to make sure all of our ducks are in a row, while the layouts share the same name is layout B a copy of layout A which could explain the duplicate results?

          And in your steps to reproduce, is having the same layout name integral to reproducing the result?  I mention this because my tests in this particular scenario did not yield the result listed above.

          Thanks,
          tsturtle
          FileMaker, Inc