Avoid errors caused by corrupted xml files
This commit is contained in:
@@ -121,7 +121,7 @@ class ContingentImportService implements SingletonInterface
|
||||
{
|
||||
libxml_use_internal_errors (true);
|
||||
/** @var \SimpleXMLElement $xmlData */
|
||||
if (!$xmlData = simplexml_load_file($file)) {
|
||||
if (!$xmlData = simplexml_load_string(file_get_contents($file))) {
|
||||
libxml_clear_errors();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -171,8 +171,12 @@ class DateImportService implements SingletonInterface
|
||||
*/
|
||||
public function parseProductXmlFile($file)
|
||||
{
|
||||
libxml_use_internal_errors (true);
|
||||
/** @var \SimpleXMLElement $xmlData */
|
||||
$xmlData = simplexml_load_file($file);
|
||||
if (!$xmlData = simplexml_load_string(file_get_contents($file))) {
|
||||
libxml_clear_errors();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($xmlData->reise[0] === null) {
|
||||
return 0;
|
||||
@@ -798,14 +802,18 @@ class DateImportService implements SingletonInterface
|
||||
if (!array_key_exists($key, $list)) {
|
||||
$list[$key] = [];
|
||||
}
|
||||
$list[$key] = array_merge($list[$key], $section);
|
||||
$list[$key] += $section;
|
||||
}
|
||||
}
|
||||
|
||||
protected function importPickups()
|
||||
{
|
||||
libxml_use_internal_errors (true);
|
||||
$path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexport/zustiege.xml');
|
||||
$xmlData = simplexml_load_file($path);
|
||||
if (!$xmlData = simplexml_load_string(file_get_contents($path))) {
|
||||
libxml_clear_errors();
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($xmlData->zustieg as $entry)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user