[dialplans] Allow multiple extensions per xml (#6437)

* [dialplans] Allow multiple extensions per xml

* remove extra character
This commit is contained in:
agree 2022-07-23 15:16:25 -04:00 committed by GitHub
parent ea4a5e7f67
commit 6e40068040
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -108,10 +108,14 @@
//disable xml entities and load the xml object to test if the xml is valid
libxml_disable_entity_loader(true);
$xml = simplexml_load_string($dialplan_xml, 'SimpleXMLElement', LIBXML_NOCDATA);
if (!$xml) {
//$errors = libxml_get_errors();
$dialplan_valid = false;
preg_match_all('/^\s*<extension.+>(?:[\S\s])+<\/extension>\s*$/mU', $dialplan_xml, $matches);
foreach($matches as $match) {
$xml = simplexml_load_string($match[0], 'SimpleXMLElement', LIBXML_NOCDATA);
if (!$xml) {
//$errors = libxml_get_errors();
$dialplan_valid = false;
break;
}
}
//save the xml to the database