-
Notifications
You must be signed in to change notification settings - Fork 529
Description
When using the feed API to export a CSV file (.../feed/data.json?id=...&csv=1), the downloaded CSV file contains the following deprecation warnings:
<br />
<b>Deprecated</b>: Creation of dynamic property SharedHelper::$csv_dp is deprecated in <b>/opt/emoncms/Modules/feed/engine/shared_helper.php</b> on line <b>29</b><br />
<br />
<b>Deprecated</b>: Creation of dynamic property SharedHelper::$csv_dp_separator is deprecated in <b>/opt/emoncms/Modules/feed/engine/shared_helper.php</b> on line <b>30</b><br />
This is similar to issue: #1837
The impact is somewhat awkward, as with a default installation the PHP errors are sent to the output, which means they appear in the CSV file, meaning the file is not valid for processing elsewhere.
A workaround is to ensure PHP error logging isn't sent to the output, by adding display_errors = false to /opt/emoncms/settings.ini.
Looking at the code referenced by the PHP warnings (/opt/emoncms/Modules/feed/engine/shared_helper.php):
class SharedHelper
{
private $export_fh;
private $csv_field_separator;
private $csv_decimal_places;
private $csv_decimal_place_separator;
private $timezone;
private $timeformat;
private $date;
public function __construct($feed_settings=false)
{
if ($feed_settings) {
$this->csv_field_separator = $feed_settings["csv_field_separator"];
$this->csv_dp = $feed_settings["csv_decimal_places"];
$this->csv_dp_separator = $feed_settings["csv_decimal_place_separator"];
}
}
It appears that the class is writing to member variables csv_dp and csv_dp_separator, which aren't defined. However member variables csv_decimal_places and csv_decimal_place_separator do exist and don't appear to be used. I presume the correct fix would be to change these two variables so the names are consistent everywhere.