BUG : FileMaker PHP API is stripping leading / trailing spaces from GetField
It is possible to enter data into a FM field, which may have leading / trailing spaces. When using the php interface, the SetFeild is storing the leading/trailing spaces in the FM database as expected. However, when you then use GetField to retrieve the same data field, the leading/trailing spaces are being trimmed. In my case, I have a field with student attendance data for the day. There are 10 characters max for time possible time slots in each day.If attendance is entered for timeslot 4, then the field will contain 3 spaces and the 4th will be the attendance code (eg. P - Present)When viewed via the php interface however, it's trimming the leading spaces so the absence code now appears in time slot one instead of the expected 4th time slot. (yes, I could have used repetitions or related fields, but this code has been in use since FM4 days and the ramifications of changing structure is not worth the effort) line 272 of FMResultSet.php has trim($this->V6468d939);which specifically trims spaces both beginning and endcommenting this section so that (the full line reads) $this->V43432a31['fields'][$this->V26005321] = $this->V6468d939; I cannot see any reason for the 'trim' statement being used. I would expect the field to return exactly what is stored. The end user (ie. us the developers) can decide to trim the data if appropriate. It is also inconsistent behaviour - you are able to set data with spaces, but when you retrieve the same data, the spaces are trimmed. The workaround, is in FM create a calculated field with substitutes the space with another 'safe' character, then in your php code, swap the 'safe' character with a space again - however I believe this shouldn't be necessary. feedback / comments welcome. regards Kent.
Thank you for your post.
I have forwarded your entire post to our Development and Software Quality Assurance (Testing) departments for review and confirmation. In the mean time, use your substitution workaround.