diff --git a/src/Csv.php b/src/Csv.php index eee55de..319265f 100644 --- a/src/Csv.php +++ b/src/Csv.php @@ -1137,7 +1137,7 @@ class Csv { : ''; $enclosure_quoted = preg_quote($this->enclosure, '/'); $pattern = "/" . $delimiter_quoted . $enclosure_quoted . "|\n|\r/i"; - if ($this->enclose_all || preg_match($pattern, $value) || (strpos($value, ' ') === 0 || substr($value, -1) == ' ')) { + if ($this->enclose_all || preg_match($pattern, $value) || strpos($value, ' ') === 0 || substr($value, -1) == ' ') { $value = str_replace($this->enclosure, $this->enclosure . $this->enclosure, $value); $value = $this->enclosure . $value . $this->enclosure; } diff --git a/tests/methods/HasToString.php b/tests/methods/HasToString.php new file mode 100644 index 0000000..9c17166 --- /dev/null +++ b/tests/methods/HasToString.php @@ -0,0 +1,9 @@ +