mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 17:04:14 +01:00
Try to avoid "PHP Warning: DOMDocument::loadXML(): Empty string supplied as input"
This commit is contained in:
parent
77935c1feb
commit
ddaef879a8
@ -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