bug39538.phpt 741 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. $file = __DIR__ . "/bug39538.csv";
  7. @unlink($file);
  8. foreach ($content as $v) {
  9. file_put_contents($file, $v);
  10. print_r (fgetcsv(fopen($file, "r"), filesize($file)));
  11. }
  12. @unlink($file);
  13. ?>
  14. --EXPECT--
  15. Array
  16. (
  17. [0] =>
  18. this is an test
  19. [1] => next data
  20. [2] => p
  21. arsed
  22. )
  23. Array
  24. (
  25. [0] =>
  26. this is an test
  27. [1] => next data
  28. [2] => p
  29. arsed
  30. )
  31. Array
  32. (
  33. [0] =>
  34. this is an test
  35. [1] => next data
  36. [2] => p
  37. arsed
  38. )