Add LIBXML_NONET to simplexml_load_string
This commit is contained in:
parent
0bf1db2fd4
commit
166d3b08d6
@ -232,7 +232,7 @@ class PrestaShopWebservice
|
|||||||
if ($response != '') {
|
if ($response != '') {
|
||||||
libxml_clear_errors();
|
libxml_clear_errors();
|
||||||
libxml_use_internal_errors(true);
|
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()) {
|
if (libxml_get_errors()) {
|
||||||
$msg = var_export(libxml_get_errors(), true);
|
$msg = var_export(libxml_get_errors(), true);
|
||||||
libxml_clear_errors();
|
libxml_clear_errors();
|
||||||
|
|||||||
@ -51,7 +51,7 @@ if ($action == 'getlastversion') {
|
|||||||
$result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
|
$result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
|
||||||
//var_dump($result['content']);
|
//var_dump($result['content']);
|
||||||
if (function_exists('simplexml_load_string')) {
|
if (function_exists('simplexml_load_string')) {
|
||||||
$sfurl = simplexml_load_string($result['content']);
|
$sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("ErrorPHPDoesNotSupport", "xml"), null, 'errors');
|
setEventMessages($langs->trans("ErrorPHPDoesNotSupport", "xml"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -171,7 +171,7 @@ if (GETPOST('target') == 'remote') {
|
|||||||
if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') {
|
if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') {
|
||||||
$xmlfile = $xmlarray['content'];
|
$xmlfile = $xmlarray['content'];
|
||||||
//print "xmlfilestart".$xmlfile."xmlfileend";
|
//print "xmlfilestart".$xmlfile."xmlfileend";
|
||||||
$xml = simplexml_load_string($xmlfile);
|
$xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
|
||||||
} else {
|
} 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'];
|
$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');
|
setEventMessages($errormsg, null, 'errors');
|
||||||
|
|||||||
@ -61,7 +61,7 @@ $version = '0.0';
|
|||||||
if ($action == 'getlastversion') {
|
if ($action == 'getlastversion') {
|
||||||
$result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
|
$result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
|
||||||
//var_dump($result['content']);
|
//var_dump($result['content']);
|
||||||
$sfurl = simplexml_load_string($result['content']);
|
$sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1683,7 +1683,7 @@ class Setup extends DolibarrApi
|
|||||||
if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') {
|
if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') {
|
||||||
$xmlfile = $xmlarray['content'];
|
$xmlfile = $xmlarray['content'];
|
||||||
//print "xmlfilestart".$xmlfile."endxmlfile";
|
//print "xmlfilestart".$xmlfile."endxmlfile";
|
||||||
$xml = simplexml_load_string($xmlfile);
|
$xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
|
||||||
} else {
|
} 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'];
|
$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);
|
throw new RestException(500, $errormsg);
|
||||||
|
|||||||
@ -240,7 +240,7 @@ class RssParser
|
|||||||
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
|
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
|
||||||
//print 'xx'.LIBXML_NOCDATA;
|
//print 'xx'.LIBXML_NOCDATA;
|
||||||
libxml_use_internal_errors(false);
|
libxml_use_internal_errors(false);
|
||||||
$rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA);
|
$rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA|LIBXML_NOCDATA);
|
||||||
} else {
|
} else {
|
||||||
if (!function_exists('xml_parser_create')) {
|
if (!function_exists('xml_parser_create')) {
|
||||||
$this->error = 'Function xml_parser_create are not supported by your PHP';
|
$this->error = 'Function xml_parser_create are not supported by your PHP';
|
||||||
|
|||||||
@ -346,7 +346,7 @@ if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
|
|||||||
$resgetcommitstrip = getURLContent("https://www.commitstrip.com/en/feed/");
|
$resgetcommitstrip = getURLContent("https://www.commitstrip.com/en/feed/");
|
||||||
}
|
}
|
||||||
if ($resgetcommitstrip && $resgetcommitstrip['http_code'] == '200') {
|
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);
|
$little = $xml->channel->item[0]->children('content', true);
|
||||||
print preg_replace('/width="650" height="658"/', '', $little->encoded);
|
print preg_replace('/width="650" height="658"/', '', $little->encoded);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user