I've managed to get it to upgrade by changing that line from
"if (in_array(ini_get('allow_url_fopen'), array('On', 'on', '1')) || !preg_match('/^https?:\/\//', $url)) {"
to
"if (in_array(ini_get('allow_url_fopenxyz'), array('On', 'on', '1')) || !preg_match('/^https?:\/\//', $url)) {"
Basically it forces the upgrade script to use an alternative method to get the files!