[Webkit-unassigned] [Bug 183309] Create analysis task should use build time as fallback when commit time is not available.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 5 17:30:15 PST 2018


https://bugs.webkit.org/show_bug.cgi?id=183309

--- Comment #9 from dewei_zhu at apple.com ---
Comment on attachment 334946
  --> https://bugs.webkit.org/attachment.cgi?id=334946
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=334946&action=review

>>>>>> Websites/perf.webkit.org/public/privileged-api/create-analysis-task.php:97
>>>>>> +    return $result ? ($result[0]['time'] ? $result[0]['time'] : $result[0]['build_time']) : null;
>>>>> 
>>>>> Can't we just do $result[0]['time'] || $result[0]['build_time'] ?
>>>> 
>>>> No. Logical operator will return true / false in PHP. http://php.net/manual/en/language.operators.logical.php
>>> 
>>> Okay. In that case, do
>>> $first_result = array_get($result, 0, array());
>>> return array_key_exists('time', $first_result) : $first_result['time'] : $first_result['build_time'];
>> 
>> Sounds a good idea. The 'time' key will always exist as long as there is a matching entry. Changing `array_key_exists('time', $first_result) : $first_result['time'] : $first_result['build_time']` to `$first_result['time'] ? $first_result['time'] : $first_result['build_time']` would make it work.
> 
> Okay. We should be careful for the case when time is 0 and NULL.

We've already have some code that assumes time is never to be 0. For example: line 29 of create-analysis-task.php `if (!$start_run_time || !$end_run_time || $start_run_time == $end_run_time)`

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180306/f66053aa/attachment.html>


More information about the webkit-unassigned mailing list