Registrations - More work to remove invalid characters that break XML.

This commit is contained in:
FusionPBX
2020-05-13 21:06:10 -06:00
committed by GitHub
parent fecb64b3e8
commit a24d77f427

View File

@@ -89,6 +89,7 @@ if (!class_exists('registrations')) {
$cmd = "api sofia xmlstatus profile ".$field['sip_profile_name']." reg";
$xml_response = trim(event_socket_request($fp, $cmd));
$xml_response = iconv("utf-8", "utf-8//ignore", $xml_response);
$xml_response = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/u', '', $xml_response);
if ($xml_response == "Invalid Profile!") { $xml_response = "<error_msg>".$text['label-message']."</error_msg>"; }
$xml_response = str_replace("<profile-info>", "<profile_info>", $xml_response);
$xml_response = str_replace("</profile-info>", "</profile_info>", $xml_response);
@@ -99,9 +100,10 @@ if (!class_exists('registrations')) {
$xml = new SimpleXMLElement($xml_response);
}
catch(Exception $e) {
echo basename(__FILE__).'<br />';
echo 'line: '.__line__.'<br />';
echo 'error: '.$e->getMessage();
echo basename(__FILE__)."<br />\n";
echo "line: ".__line__."<br />\n";
echo "error: ".$e->getMessage()."<br />\n";
//echo $xml_response;
exit;
}
$array = json_decode(json_encode($xml), true);