number of backslashes (David Soria Parra, Pierre)
@ -42,6 +42,8 @@ PHP NEWS
- Fixed wrong signature initialization in imagepng (Takeshi Abe)
- Added optimization for imageline with horizontal and vertial lines (Pierre)
- Fixed bug #39576 (array_walk() doesn't separate userdata zval). (Tony)
- Fixed bug #39538 (fgetcsv can't handle starting newlines and trailing odd
number of backslashes). (David Soria Parra, Pierre)
- Fixed bug #39454 (Returning a SOAP array segfaults PHP). (Dmitry)
- Fixed bug #39445 (Calling debug_backtrace() in the __toString() function
produces a crash). (Dmitry)
@ -2171,9 +2171,11 @@ PHPAPI void php_fgetcsv(php_stream *stream, /* {{{ */
size_t new_len;
char *new_temp;
memcpy(tptr, hunk_begin, bptr - hunk_begin);
tptr += (bptr - hunk_begin);
hunk_begin = bptr;
if (hunk_begin != line_end) {
}
/* add the embedded line end to the field */
memcpy(tptr, line_end, line_end_len);
@ -0,0 +1,40 @@
--TEST--
bug 39538
--FILE--
<?php
$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\"");
$file = dirname(__FILE__) . "/bug39538.csv";
@unlink($file);
foreach ($content as $v) {
file_put_contents($file, $v);
print_r (fgetcsv(fopen($file, "r"), filesize($file)));
--EXPECT--
Array
(
[0] =>
this is an test
[1] => next data
[2] => p
arsed
)