9 Replies Latest reply on Jul 17, 2014 3:07 PM by davidrcrowe

    PHP Execute aborts after newFindAllCommand but not after newCompoundFindCommand

    davidrcrowe

      Summary

      PHP Execute aborts after newFindAllCommand but not after newCompoundFindCommand

      Product

      FileMaker Server

      Version

      12

      Operating system version

      Windows Server 2008 R2 Standard Service Pack 1

      Description of the issue

      My PHP application issues "newCompoundFindCommand" or "newFindAllCommand" depending on whether the user, via the web form, enters any search constraints. The following sequence is repeatable:
      1) Search for everything. PHP "echo" prior to the $findCommand->execute() is printed, but the first statement following, is not printed.
      2) Search with a constraint (software now issues newCompoundFindCommand). Works fine.
      3) Search again for everything. Now it works fine and continues to work fine until the user logs out of the application or refreshes the browser, at which point the error occurs again.

      It is certainly possible that this is an error in my code, but there appears to be an exception within the FM PHP API, and given the limited information given to FM in the case of newFindAllCommand, it is hard to see how any inputs could be causing such a drastic failure.

      Steps to reproduce the problem

      See above.

      Expected result

      newFindAllCommand should always return all records on the specified layout.

      Actual result

      FM PHP API "execute" command appears to silently abort.

      Exact text of any error message(s) that appear

      No error message.

      Workaround

      None so far. Adding a field that is always a constant value would be a workaround, but the application does not have control over the layout, so it would force the database designer to add this field to every layout for which this application will be used.

        • 1. Re: PHP Execute aborts after newFindAllCommand but not after newCompoundFindCommand
          davidrcrowe

               I have reduced the code to illustrate the problem better. Password redacted.

                

               If "session_start()" is included, the $result = $findCommand->execute(); never returns (the second "echo" is not executed).

                

               This does not occur when using other types of find commands other than newFindAllCommand

                

               - David Crowe

                

               <?php
               require_once "FileMaker.php";
                
               // **BUG**
               // ** FAILS IF THE NEXT LINE IS NOT COMMENTED OUT **
               session_start();
                
               $username  = "David Crowe";
               $layout = 'National SID PHP Detail';
                
               // Login
               $database = 'IFAST-Central';
               $hostspec = 'http://66.101.198.14';
               $password= "REDACTED";
               $fm = new FileMaker($database, $hostspec, $username, $password);
               // Check error
               if( FileMaker::isError($fm))
               {
               echo "<p style=\"color:red\">Login failed in ".$database."@".$hostspec."@".$username.$fm->getMessage()."</p>";
               return;
               }
                
                
               $findCommand = $fm->newFindAllCommand($layout);
                
               echo "<p>Do execute";
               $result = $findCommand->execute();
               echo "<p>Execute completed";
               ?>
                
          • 2. Re: PHP Execute aborts after newFindAllCommand but not after newCompoundFindCommand
            TSGal

                 David Crowe:

                 Thank you for your posts.

                 I have sent all of your information to our Development and Testing departments for review.  When I receive any feedback, I will let you know.

                 TSGal
                 FileMaker, Inc.

            • 3. Re: PHP Execute aborts after newFindAllCommand but not after newCompoundFindCommand
              TSGal

                   David Crowe:

                   Our testers were unable to replicate the issue.

                   One tester mentioned that '$result = $findCommand->execute()' is returning an error.  Therefore, try adding the following to your PHP script after execute():

                   $result = $findCommand->execute()
                   if (FileMaker::isError($result)) {
                       echo "Error: {$result->getMessage()}\n";
                       exit;
                   }

                   -----

                   What is the result of -findall XML command?

                   You can run:  http://<machine IP>/fmi/xml/fmresultset.xml?-db=IFAST-Central&-lay=National SID PHP Detail&-findall

                   -----

                   Testing would also like a sample database and a PHP script with a reproducible case.  This will make it easier to test.

                   Check your Inbox at the top of this page for instructions where to send the files.

                   TSGal
                   FileMaker, Inc.

              • 4. Re: PHP Execute aborts after newFindAllCommand but not after newCompoundFindCommand
                TSGal

                     David Crowe:'

                     I received your PHP code, but not the database file.  Regardless, the PHP file has been sent to the tester.

                     TSGal
                     FileMaker, Inc.

                • 5. Re: PHP Execute aborts after newFindAllCommand but not after newCompoundFindCommand
                  davidrcrowe

                       I will try to create a demo file and send it to you along with a username/password, in which the problem can be replicated. I was away for the weekend, so it may be a day or two before I get to this.

                  • 6. Re: PHP Execute aborts after newFindAllCommand but not after newCompoundFindCommand
                    davidrcrowe

                         I think I have figured the problem out. Basically, if an out-of-memory problem is too severe, the FM API crashes silently. In the attached ZIP file you can see the test PHP code that I used, plus screenshots. Crash 1, Crash 2 and Crash 3 differ by the number of fields on the layout (1 more each time).

                          

                         Crash 1 is IIS catching the crash (this is rare and I've only seen this once).

                         Crash 2 is FM reporting the out of memory condition.

                          

                         Crash 3 is where the FM API crashes before it can report an error.

                          

                         I increased the maximum memory for a process in PHP.INI and the problem went away. The FM API should clearly report out of memory conditions and not crash.

                    • 7. Re: PHP Execute aborts after newFindAllCommand but not after newCompoundFindCommand
                      TSGal

                           David Crowe:

                           There are no screen shots attached to your post.  Make sure you click "Choose File" to upload an image.  Or, send me the screen shots to the email address given to you in my private message.  Regardless, I have sent your comments to Testing for review.

                           TSGal
                           FileMaker, Inc.

                      • 8. Re: PHP Execute aborts after newFindAllCommand but not after newCompoundFindCommand
                        TSGal

                             David Crowe:

                             Even though our Testing department was unable to replicate the issue, there were some changes made to memory management using PHP.  Please download the latest update of FileMaker Server 13.0v3 and let me know if the issue still exists.  You can download the update through Knowledge Base Article #13615 at:

                        http://help.filemaker.com/app/answers/detail/a_id/13615

                             TSGal
                             FileMaker, Inc.

                        • 9. Re: PHP Execute aborts after newFindAllCommand but not after newCompoundFindCommand
                          davidrcrowe

                               I will update FileMaker on our server, but this will take some time as outgoing access to the internet is normally forbidden, so it has to be arranged. I will then change the PHP setting that gave me the workaround, and see what happens.

                               Thanks for taking my bug report seriously.