xref: /PHP-8.3/ext/standard/tests/file/bug66588.phpt (revision 52e7e0f5)
1--TEST--
2Bug #66588 SplFileObject::fgetcsv incorrectly returns a row on premature EOF
3--DESCRIPTION--
4This bug is about the different behavior with and without trailing newline both should behave the same,
5and neither should return FALSE.
6--FILE--
7<?php
8
9$s = fopen("php://memory", "w+");
10fwrite($s, "\",bar");
11rewind($s);
12var_dump(fgetcsv($s));
13fclose($s);
14
15$s = fopen("php://memory", "w+");
16fwrite($s, "\",bar\n");
17rewind($s);
18var_dump(fgetcsv($s));
19fclose($s);
20?>
21--EXPECT--
22array(1) {
23  [0]=>
24  string(4) ",bar"
25}
26array(1) {
27  [0]=>
28  string(5) ",bar
29"
30}
31