There is a problem with the following line of code in the function _opigno_tincan_api_set_result line 166:
// Remove all the 0 in the formatted duration
$duration_string = preg_replace('/0\D/i', '', $duration_string);
This does not take into account if the duration ends in 10S ,20S ,30S ,40S ,50S seconds and in that case it removes the 0S and leaves number without a character to give it a meaning which results in failed statement.
Examples:
//removes the 0M correctly but also the 0S
Example input: DT0M10S
Example output: DT1
Expected output DT10S
Example input: DT5M10S
Example output: DT5M1
Expected output DT5M10S
Somewhat better solution(still not perfect):
$duration_string = preg_replace('/(\D)0\D/', '${1}', $duration_string);
Comments
Comment #2
dejan_r commentedComment #4
amermod commentedHi,
Thanks for your issue.
Based on your research, I found the good regex to use: $duration_string = preg_replace('/(\D)0{1}\D/i', '$1', $duration_string);
It passes your examples and I didn't find any problem with this regex.
I've committed this and it will be for the next release.
Thanks again.
Best regards,
Allan
Comment #5
amermod commented