2 Replies Latest reply on Feb 21, 2014 3:29 PM by philmodjunk

    FileMaker 13 PHP API collapses repeating field's values

    jnouwen

      Summary

      FileMaker 13 PHP API collapses repeating field's values

      Product

      FileMaker Server

      Version

      13.0.1

      Operating system version

      Mac OS X 10.9.1 (13B42)

      Description of the issue

      You have a repeating field in a table with three repetitions. A record has in those repetitions "orange", "apple", and "banana" respectively. Accessing that field through the PHP API by way of:

           echo $record->getField( "SomeRepeatingField", 1 );

      will output "apple" when running under FileMaker Server 11. Running with FileMaker Server 13 will output nothing.

      Dumping out the structure of the FileMakerRecord that gets returned into $record you can see that only the last repetition is included by FileMaker Server 13:

      FileMaker Server 11: ["SomeRepeatingField"]=> array(2) { [0]=> string(1) "orange" [1]=> string(1) "apple" [2]=> string(1) "banana" }

      FileMaker Server 13: ["SomeRepeatingField"]=> array(1) { [0]=> string(1) "banana" }

      The number of repeating fields doesn't seem to matter as I noticed the problem in a field with two repetitions and tested it by adding a third. It's always the last repetition that gets returned.

      Steps to reproduce the problem

      1) Host a FileMaker 13 file with a repeating field in a table that has 3 repetitions
      2) Create a new record and in the three repetitions of the field, place "orange", "apple", and "banana" respectively.
      3) Load a record through a newFindCommand()
      4) Using getField(), output the second repetition (index 1)

      Expected result

      "apple"

      Actual result

      Nothing

      Exact text of any error message(s) that appear

      No errors appear but the "repetition does not exist" error on line 32 of the API's FileMaker/Implementation/RecordImpl.php gets run, precisely because the repetition does indeed not exist.

      Configuration information

      FileMaker Server 11 was running with the PHP API that came with it. The same goes for FileMaker Server 13 and its bundled PHP API.

      (As an aside, it's amusing that while the FileMaker Server 13 release notes state "FileMaker Server 13 has corrected the syntax in the FileMaker API for PHP to remove deprecated features. For FileMaker Server 11 and earlier, you would receive deprecation warnings if you used the FileMaker API for PHP with PHP 5.3.", that's not actually true. The warnings still fire until you remove all the return-by-reference usage in the API's implementation files.)

      Workaround

      Stop using repeating fields (which we should really do anyway).