xref: /PHP-8.4/ext/standard/tests/file/bug12556.phpt (revision f756b96e)
1--TEST--
2Bug #12556 (fgetcsv() ignores lengths when quotes not closed)
3--FILE--
4<?php
5$fp = fopen(__DIR__."/test.csv", "r");
6while($line = fgetcsv($fp, 24, escape: "\\")) {
7    $line = str_replace("\x0d\x0a", "\x0a", $line);
8    var_dump($line);
9}
10fclose($fp);
11?>
12--EXPECT--
13array(4) {
14  [0]=>
15  string(1) "6"
16  [1]=>
17  string(1) "7"
18  [2]=>
19  string(1) "8"
20  [3]=>
21  string(5) "line1"
22}
23array(4) {
24  [0]=>
25  string(1) "1"
26  [1]=>
27  string(1) "2"
28  [2]=>
29  string(1) "3"
30  [3]=>
31  string(186) "line2
322,4,5,line3
332,4,5,line3
342,4,5,line3
352,4,5,line3
362,4,5,line3
372,4,5,line3
382,4,5,line3
392,4,5,line3
402,4,5,line3
412,4,5,line3
422,4,5,line3
432,4,5,line3
442,4,5,line3
452,4,5,line3
462,4,5,line3
47"
48}
49