@@ -36,7 +36,13 @@ public function testHtmlCantRead(): void
36
36
fwrite ($ handle , "{$ row [0 ]}, {$ row [1 ]}, {$ row [2 ]}\n" );
37
37
}
38
38
fclose ($ handle );
39
- self ::assertSame ('text/html ' , mime_content_type ($ filename ));
39
+ // Php8.3- identify file as text/html.
40
+ // Php8.4+ identify file as text/csv, and this type of change
41
+ // has been known to be retrofitted to prior versions.
42
+ $ mime = mime_content_type ($ filename );
43
+ if ($ mime !== 'text/csv ' ) {
44
+ self ::assertSame ('text/html ' , $ mime );
45
+ }
40
46
self ::assertSame ('Csv ' , IOFactory::identify ($ filename ));
41
47
$ reader = new CsvReader ();
42
48
$ spreadsheet = $ reader ->load ($ filename );
@@ -60,7 +66,13 @@ public function testHtmlCanRead(): void
60
66
fwrite ($ handle , "{$ row [0 ]}, {$ row [1 ]}, {$ row [2 ]}\n" );
61
67
}
62
68
fclose ($ handle );
63
- self ::assertSame ('text/html ' , mime_content_type ($ filename ));
69
+ // Php8.3- identify file as text/html.
70
+ // Php8.4+ identify file as text/csv, and this type of change
71
+ // has been known to be retrofitted to prior versions.
72
+ $ mime = mime_content_type ($ filename );
73
+ if ($ mime !== 'text/csv ' ) {
74
+ self ::assertSame ('text/html ' , $ mime );
75
+ }
64
76
self ::assertSame ('Html ' , IOFactory::identify ($ filename ));
65
77
$ reader = new CsvReader ();
66
78
$ spreadsheet = $ reader ->load ($ filename );
0 commit comments