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

dejan_r created an issue. See original summary.

dejan_r’s picture

Issue summary: View changes

  • Amermod committed e2811a8 on 7.x-1.x
    Issue #2861574: Bug involving statements that have a duration 0S
    
amermod’s picture

Status: Active » Patch (to be ported)

Hi,

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

amermod’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.