How do debug array_multisort warning

Sometimes I find the warning “Array sizes are inconsistent” in the logs, for the command array_multisort().

This is my code:

            $columns_1 = array_column($data, 'col1');
            $columns_2 = array_column($data, 'col2');
            $columns_3 = array_column($data, 'col3');
            array_multisort($columns_1, SORT_ASC, $columns_2, SORT_ASC, $columns_3, SORT_ASC, $data);

The content of the $data-variable is fetched from an remote api.

I expect the reason for the error, is that the remote data sometimes is wrong/corrupted.

Is there any method to “catch” when there is a warning in array_multisort()?

I have tried to check for if all the arrays are of the same size and if not, not execute array_multisort, but that does not prevent the warning.