php-fhir: TypeError : strlen(): Argument #1 ($string) must be of type string, bool given in FHIRTiming

I am getting the following error TypeError : strlen(): Argument #1 ($string) must be of type string, bool given when trying to parse a FHIRTiming object with the following input data:

<timing>
  <repeat>
     <frequency value="1"/>
     <period value="1"/>
     <periodUnit value="d"/>
  </repeat>
</timing>

The error is caused by a check if there are decimals. When there are no decimals strstr will return false and strlen(false) will produce this error.

https://github.com/dcarbone/php-fhir/blob/master/template/properties/methods/primitive/decimal_type.php#L39

Besides that is frequency of type PositiveInt so a decimal should not be accepted.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 19 (19 by maintainers)

Most upvoted comments

No that is not fixable without another json parser.

I get it from a scientific perspective, when you send 1.000 you are very sure that is has that precision. It is different from just 1.

So when sending lab results it can make a difference in theory. But we don’t use it and our dosings will not use such a precision.

Thanks for the quick response. I have tested it and it works.