are there actually issues with the S3 sync? It should work fine, even with the warning, since S3 server does not usually redirect.
I think commeting out the line
//curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
is better than the workaround because this makes 2 HTTP requests if open_basedir is on.
Let me know if it works.