Hmm, interesting. Running a vanilla ZC 1.5.5-2016-03-29 under XAMPP via PHP 5.4, the currency update occurs successfully. Changing to PHP 7.0.2, and only the USD currency (the default) is successfully processed via ECB (but that's a red herring).
When I look at my /logs folder, the logs report the same information as you'd posted, with the exception of:
Code:
[02-May-2016 13:10:13 UTC] PHP Warning: file(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in C:\xampp\htdocs\zc155\cAndy-iVH-SloaN\includes\functions\localization.php on line 115
That log entry is the "tell". Apparently either PHP 7.x or that version of XAMPP has got allow_url_fopen set to Off. Having that set causes the currencies-updater to head down a CURL path to retrieve the information, but an invalid response is received from ecb; here's the var_export dump of the $XMLContent after the request:
Code:
[02-May-2016 13:20:39 UTC] array (
0 => '<html lang="en"> <head> <title>European Central Bank</title> <style type="text/css"> body{ font-family: "Droid Sans", sans-serif; margin:0; padding:0; background-color: #9099ab; text-align: center; } h1{ font-size:38px; font-weight: normal; color:#003299; } @media screen and (max-width: 480px) { h1{ font-size: 30px; } } p { font-size: 15px; line-height: 20px; color: #333; margin-bottom: 20px; } p.signature{ font-style: italic; color:#DF0101; } .centredFrame { margin: 0 auto; text-align: center; width: 70%; } .content{ margin-top:40px; padding:40px; background-color: #fff; border:1px solid #CDE3E0; -moz-border-radius: 20px; border-radius: 20px; } </style>',
1 => ' <link href="https://fonts.googleapis.com/css?family=Droid+Sans" rel="stylesheet" type="text/css">',
2 => ' </head> <body> <div class="centredFrame"> <div class="content"> <img src="https://www.ecb.europa.eu/pic_failover/ecb_logo_EN.png"> <h1>A problem occurred while trying to access this page</h1> <body>We apologize for any inconvenience this might have caused.</body> <p class="signature">Reference number: #18.12b81cb8.1462195235.4fbb3617</p> <p class="signature">HTTP status code: 403</p> </div> </div> </body> </html>',
)
So, I went back to PHP 5.4 and commented-out the file-request to retrieve the ecb information (so that the code would go down the CURL path there as well) and re-ran the currency-update with ... no issue.
That said, it looks like the ecb issue has to do with a curl-related change introduced somewhere in the PHP 5.5, 5.6 and 7.0 timeframe!
The boc processing is going to run into the same issue, with the exception that its handling is missing the highlighted check (which is why the divide-by-0 is being issued):
Code:
function quote_boc_currency($currencyCode = '', $base = DEFAULT_CURRENCY)
{
if ($currencyCode == $base) return 1;
static $CSVContent;
$requested = $currencyCode;
$url = 'http://www.bankofcanada.ca/stats/assets/csv/fx-seven-day.csv';
$currencyArray = array();
$currencyArray['CAD'] = 1;
if (!isset($CSVContent) || $CSVContent == '') {
$CSVContent = file($url);
if (! is_object($CSVContent) && function_exists('curl_init')) {
$CSVContent = doCurlCurrencyRequest('GET', $url);
$CSVContent = explode("\n", $CSVContent);
}
}
foreach ($CSVContent as $line) {
if (substr($line, 0, 1) == '#' || substr($line, 0, 4) == 'Date' || trim($line) == '') continue;
$data = explode(',', $line);
$curName = $data[1];
$curRate = $data[sizeof($data)-1];
$currencyArray[trim($curName)] = (float)$curRate;
}
if (!isset($currencyArray[DEFAULT_CURRENCY]) || 0 == $currencyArray[DEFAULT_CURRENCY]) return ''; // no valid value, so abort
$rate = (string)($currencyArray[DEFAULT_CURRENCY]/(float)$currencyArray[$requested]);
return $rate;
}
So, net-net there are two separate issues:
1. The fact that the currency updates aren't happening under PHP 7.0. As a work-around, you could update your XAMPP installation's php.ini file to set allow_url_fopen=On while the ZC-dev CURL experts figure out what the root-cause is.
2. The divide-by-0 coming from the boc currency handler; see suggested change above.
Bookmarks