Add LIBXML_NONET to simplexml_load_string

This commit is contained in:
Laurent Destailleur 2021-09-30 20:00:48 +02:00
parent 0bf1db2fd4
commit 166d3b08d6
7 changed files with 7 additions and 7 deletions

View File

@ -232,7 +232,7 @@ class PrestaShopWebservice
if ($response != '') {
libxml_clear_errors();
libxml_use_internal_errors(true);
$xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA);
$xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
if (libxml_get_errors()) {
$msg = var_export(libxml_get_errors(), true);
libxml_clear_errors();

View File

@ -51,7 +51,7 @@ if ($action == 'getlastversion') {
$result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
if (function_exists('simplexml_load_string')) {
$sfurl = simplexml_load_string($result['content']);
$sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
} else {
setEventMessages($langs->trans("ErrorPHPDoesNotSupport", "xml"), null, 'errors');
}

View File

@ -171,7 +171,7 @@ if (GETPOST('target') == 'remote') {
if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') {
$xmlfile = $xmlarray['content'];
//print "xmlfilestart".$xmlfile."xmlfileend";
$xml = simplexml_load_string($xmlfile);
$xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
} else {
$errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
setEventMessages($errormsg, null, 'errors');

View File

@ -61,7 +61,7 @@ $version = '0.0';
if ($action == 'getlastversion') {
$result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
$sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
}

View File

@ -1683,7 +1683,7 @@ class Setup extends DolibarrApi
if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') {
$xmlfile = $xmlarray['content'];
//print "xmlfilestart".$xmlfile."endxmlfile";
$xml = simplexml_load_string($xmlfile);
$xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
} else {
$errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
throw new RestException(500, $errormsg);

View File

@ -240,7 +240,7 @@ class RssParser
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
//print 'xx'.LIBXML_NOCDATA;
libxml_use_internal_errors(false);
$rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA);
$rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA|LIBXML_NOCDATA);
} else {
if (!function_exists('xml_parser_create')) {
$this->error = 'Function xml_parser_create are not supported by your PHP';

View File

@ -346,7 +346,7 @@ if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
$resgetcommitstrip = getURLContent("https://www.commitstrip.com/en/feed/");
}
if ($resgetcommitstrip && $resgetcommitstrip['http_code'] == '200') {
$xml = simplexml_load_string($resgetcommitstrip['content']);
$xml = simplexml_load_string($resgetcommitstrip['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
$little = $xml->channel->item[0]->children('content', true);
print preg_replace('/width="650" height="658"/', '', $little->encoded);
}