From 05826c2bbf838a81a2c8223dae720e55b663976e Mon Sep 17 00:00:00 2001 From: Fonata Date: Thu, 13 May 2021 19:23:56 +0200 Subject: [PATCH] Make return value of parseFile() explicit as false if parsing failed In practise this changes nothing because $this->file_data would typically be empty. The only exception is if the object was reused from a previous parsing operation. --- src/Csv.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Csv.php b/src/Csv.php index 2f2cfa7..b423b23 100644 --- a/src/Csv.php +++ b/src/Csv.php @@ -612,13 +612,13 @@ class Csv { $file = $this->file; } - if (empty($this->file_data)) { - /** - * @see self::keep_file_data - * Usually, _parse_string will clean this - * Instead of leaving stale data for the next parseFile call behind. - */ - $this->load_data($file); + /** + * @see self::keep_file_data + * Usually, _parse_string will clean this + * Instead of leaving stale data for the next parseFile call behind. + */ + if (empty($this->file_data) && !$this->loadFile($file)) { + return false; } return !empty($this->file_data) ? $this->_parse_string() : false;