File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
src/PhpSpreadsheet/Reader
tests/PhpSpreadsheetTests/Reader/Csv Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -84,10 +84,13 @@ class Csv extends BaseReader
8484 */
8585 private static $ constructorCallback ;
8686
87+ /** Will be changed to false in next major release */
88+ public const DEFAULT_TEST_AUTODETECT = true ;
89+
8790 /**
8891 * Attempt autodetect line endings (deprecated after PHP8.1)?
8992 */
90- private bool $ testAutodetect = true ;
93+ private bool $ testAutodetect = self :: DEFAULT_TEST_AUTODETECT ;
9194
9295 protected bool $ castFormattedNumberToNumeric = false ;
9396
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ class CsvLineEndingTest extends TestCase
1212{
1313 private string $ tempFile = '' ;
1414
15+ private static bool $ alwaysFalse = false ;
16+
1517 protected function tearDown (): void
1618 {
1719 if ($ this ->tempFile !== '' ) {
@@ -30,6 +32,9 @@ public function testEndings(string $ending): void
3032 $ data = ['123 ' , '456 ' , '789 ' ];
3133 file_put_contents ($ filename , implode ($ ending , $ data ));
3234 $ reader = new Csv ();
35+ if (Csv::DEFAULT_TEST_AUTODETECT === self ::$ alwaysFalse ) {
36+ $ reader ->setTestAutoDetect (true );
37+ }
3338 $ spreadsheet = $ reader ->load ($ filename );
3439 $ sheet = $ spreadsheet ->getActiveSheet ();
3540 self ::assertEquals ($ data [0 ], $ sheet ->getCell ('A1 ' )->getValue ());
You can’t perform that action at this time.
0 commit comments