xref: /PHP-5.5/ext/standard/tests/file/bug39538.phpt (revision 3e326b91)
1--TEST--
2Bug #39538 (fgetcsv can't handle starting newlines and trailing odd number of backslashes)
3--FILE--
4<?php
5$content = array("\"\nthis is an test\", \"next data\", \"p\narsed\"","\"\r\nthis is an test\", \"next data\", \"p\r\narsed\"","\"\n\rthis is an test\", \"next data\", \"p\n\rarsed\"");
6
7$file = dirname(__FILE__) . "/bug39538.csv";
8@unlink($file);
9foreach ($content as $v) {
10	file_put_contents($file, $v);
11	print_r (fgetcsv(fopen($file, "r"), filesize($file)));
12}
13@unlink($file);
14?>
15--EXPECT--
16Array
17(
18    [0] =>
19this is an test
20    [1] => next data
21    [2] => p
22arsed
23)
24Array
25(
26    [0] =>
27this is an test
28    [1] => next data
29    [2] => p
30arsed
31)
32Array
33(
34    [0] =>
35
35this is an test
36    [1] => next data
37    [2] => p
38
38arsed
39)
40