steveR4

Possible bug(s) in FileMaker Server PHP script

Discussion created by steveR4 on Feb 8, 2016

Product and version FileMaker Server PHP Script

OS and version

Browser and version

Hardware

Description record validation in PHP script

How to replicate

Workaround


Issue 1

 

The PHP code may have changed since, but the version that I'm looking at has a couple of (potential) issues in FMResultSet.php The _validationMask is being set with an integer value rather than a bit shift of the integer value. Obvious, even in the obfuscated code, picking one if statement out of the many as an example:

 

if ($V06e3d36f['four-digit-year'] == 'no' && $V06e3d36f['result'] == 'timestamp')

{

  $V8fa14cdd->_impl->_validationRules[FILEMAKER_RULE_TIMESTAMP_FIELD] = true;

  $V8fa14cdd->_impl->_validationMask|= FILEMAKER_RULE_TIMESTAMP_FIELD;

}


Obvious - even in the obfuscated code - should have a bitshift, like:

 

if ($V06e3d36f['four-digit-year'] == 'no' && $V06e3d36f['result'] == 'timestamp')

{

  $V8fa14cdd->_impl->_validationRules[FILEMAKER_RULE_TIMESTAMP_FIELD] = true;

  $V8fa14cdd->_impl->_validationMask|= 1 << FILEMAKER_RULE_TIMESTAMP_FIELD;

}


This applies to all if statements in both nearly identical sections of code for both the Layout and RelatedSet field definitions.


Issue 2

 

This may not be a problem as I'm only performing a visual check here. Same location as Issue 1, different problem. There are two nearly identical case statements (both with Issue 1) in FMResultSet.php but they differ just slightly

 

if ($V06e3d36f['time-of-day'] == 'yes')

{

  $V8fa14cdd->_impl->_validationRules[FILEMAKER_RULE_TIMEOFDAY] = true;

  $V8fa14cdd->_impl->_validationMask|= FILEMAKER_RULE_TIMEOFDAY;

}

 

further down...

 

if ($V06e3d36f['time-of-day'] == 'yes' || $V06e3d36f['result'] == 'time')

{

  $V8fa14cdd->_impl->_validationRules[FILEMAKER_RULE_TIMEOFDAY] = true;

  $V8fa14cdd->_impl->_validationMask|= FILEMAKER_RULE_TIMEOFDAY;

}

Outcomes