mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 15:33:23 +01:00
Try to avoid "PHP Warning: DOMDocument::loadXML(): Empty string supplied as input"
This commit is contained in:
parent
a5602845c9
commit
6cd8f67985
@ -74,15 +74,26 @@ class importexport_arrayxml {
|
||||
* @param string $_xml
|
||||
* @return array
|
||||
*/
|
||||
public static function xml2array( $_xml ) {
|
||||
if ( $_xml instanceof DOMElement ) {
|
||||
public static function xml2array( $_xml )
|
||||
{
|
||||
if($_xml instanceof DOMElement)
|
||||
{
|
||||
$n = &$_xml;
|
||||
} else {
|
||||
}
|
||||
elseif($_xml)
|
||||
{
|
||||
$n = new DOMDocument;
|
||||
$loaded = $n->loadXML($_xml);
|
||||
if(!$loaded) return array();
|
||||
if(!$loaded)
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
$xml_array = array();
|
||||
if(!$_xml || !$n)
|
||||
{
|
||||
return $xml_array;
|
||||
}
|
||||
|
||||
foreach($n->childNodes as $nc) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user