From: Ilia Alshanetsky Date: Mon, 24 Feb 2003 03:15:54 +0000 (+0000) Subject: MFH X-Git-Tag: php-4.3.2RC1~134 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1544debc9f6ecccebdca94db00abb5f4703f5f52;p=php MFH --- diff --git a/ext/standard/file.c b/ext/standard/file.c index e565f9f00c..dfd1e1e3da 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -2210,6 +2210,21 @@ PHP_FUNCTION(fgetcsv) /* 2A. handle enclosure delimited field */ while (*bptr) { + /* we need to determine if the enclosure is 'real' or is it escaped */ + if (*(bptr - 1) == '\\') { + int escape_cnt = 0; + char *bptr_p = bptr - 2; + + while (bptr_p > buf && *bptr_p == '\\') { + escape_cnt++; + bptr_p--; + } + if (!(escape_cnt % 2)) { + goto normal_char; + continue; + } + } + if (*bptr == enclosure) { /* handle the enclosure */ if ( *(bptr+1) == enclosure) { @@ -2223,6 +2238,7 @@ PHP_FUNCTION(fgetcsv) break; /* .. from handling this field - resumes at 3. */ } } else { +normal_char: /* normal character */ *tptr++ = *bptr++;