From 10f0d311375fb95daeb6e5bc3fbf380dff6419e3 Mon Sep 17 00:00:00 2001 From: Pavel Dohnal Date: Wed, 22 Apr 2020 10:35:47 +0200 Subject: [PATCH] Make sure the file is opened for export [MAILPOET-2716] --- lib/Subscribers/ImportExport/Export/Export.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Subscribers/ImportExport/Export/Export.php b/lib/Subscribers/ImportExport/Export/Export.php index aae5c7a4a1..61f55d8aa6 100644 --- a/lib/Subscribers/ImportExport/Export/Export.php +++ b/lib/Subscribers/ImportExport/Export/Export.php @@ -25,7 +25,7 @@ class Export { public $dynamicSubscribersGetter; public function __construct($data) { - if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { + if (strpos((string)@ini_get('disable_functions'), 'set_time_limit') === false) { set_time_limit(0); } @@ -89,6 +89,9 @@ class Export { $processedSubscribers = 0; $formattedSubscriberFields = $this->formattedSubscriberFields; $cSVFile = fopen($this->exportFile, 'w'); + if ($cSVFile === false) { + throw new \Exception(__('Failed opening file for export.', 'mailpoet')); + } $formatCSV = function($row) { return '"' . str_replace('"', '\"', $row) . '"'; };