Ok, yet another update that should work a bit more universally. As we are applying the temporary fix to many of our client's shops that all have different USPS modules, the code needed to be a bit more variable for closing the tags up at the end after weeding out the garbage in the USPS response XML.
FIRST BACKUP YOUR includes/modules/shipping/usps.php file.
Before this line:
return json_decode(json_encode(simplexml_load_string($body)),TRUE);
Add the following code:
//BOF Code fix for USPS problems starting on 11/9/2013 by batchtech.com
preg_match('/\<.*\>.?\<.*\>/', $body, $matches);
$body = implode($matches);
if (strpos($body, '<?xml version="1.0" encoding="UTF-8"?>') === false)
$body = '<?xml version="1.0" encoding="UTF-8"?>' . $body;
$tagsArray = array('MailService', 'Postage', 'Package', 'RateV4Response');
for ($i=0; $i<sizeof($tagsArray); $i++) {
if (strrpos($body, '<' . $tagsArray[$i]) > strrpos($body, '</' . $tagsArray[$i] . '>')) {
$body .= '</' . $tagsArray[$i] . '>';
}
}
//EOF Code fix for USPS problems starting on 11/9/2013 by batchtech.com
Hopefully this will at least fix domestic for you until USPS gets the situation resolved.
-David