Annotation of embedaddon/php/ext/standard/tests/file/bug39538.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #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);
! 9: foreach ($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--
! 16: Array
! 17: (
! 18: [0] =>
! 19: this is an test
! 20: [1] => next data
! 21: [2] => p
! 22: arsed
! 23: )
! 24: Array
! 25: (
! 26: [0] =>
! 27: this is an test
! 28: [1] => next data
! 29: [2] => p
! 30: arsed
! 31: )
! 32: Array
! 33: (
! 34: [0] =>
! 35:
this is an test
! 36: [1] => next data
! 37: [2] => p
! 38:
arsed
! 39: )
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>