File tree 2 files changed +9
-1
lines changed
src/PhpSpreadsheet/Reader
tests/PhpSpreadsheetTests/Reader/Csv
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
84
84
*/
85
85
private static $ constructorCallback ;
86
86
87
+ /** Will be changed to false in next major release */
88
+ public const DEFAULT_TEST_AUTODETECT = true ;
89
+
87
90
/**
88
91
* Attempt autodetect line endings (deprecated after PHP8.1)?
89
92
*/
90
- private bool $ testAutodetect = true ;
93
+ private bool $ testAutodetect = self :: DEFAULT_TEST_AUTODETECT ;
91
94
92
95
protected bool $ castFormattedNumberToNumeric = false ;
93
96
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ class CsvLineEndingTest extends TestCase
12
12
{
13
13
private string $ tempFile = '' ;
14
14
15
+ private static bool $ alwaysFalse = false ;
16
+
15
17
protected function tearDown (): void
16
18
{
17
19
if ($ this ->tempFile !== '' ) {
@@ -30,6 +32,9 @@ public function testEndings(string $ending): void
30
32
$ data = ['123 ' , '456 ' , '789 ' ];
31
33
file_put_contents ($ filename , implode ($ ending , $ data ));
32
34
$ reader = new Csv ();
35
+ if (Csv::DEFAULT_TEST_AUTODETECT === self ::$ alwaysFalse ) {
36
+ $ reader ->setTestAutoDetect (true );
37
+ }
33
38
$ spreadsheet = $ reader ->load ($ filename );
34
39
$ sheet = $ spreadsheet ->getActiveSheet ();
35
40
self ::assertEquals ($ data [0 ], $ sheet ->getCell ('A1 ' )->getValue ());
You can’t perform that action at this time.
0 commit comments