summaryrefslogtreecommitdiff
path: root/ext/standard/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/file.c')
-rw-r--r--ext/standard/file.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 80de164ab8..15c2e902c4 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -1991,8 +1991,14 @@ PHP_FUNCTION(fgetcsv)
while(isspace((int) *bptr) && (*bptr!=delimiter)) bptr++;
/* 2. Read field, leaving bptr pointing at start of next field */
if (enclosure && *bptr == enclosure) {
+ bptr++; /* move on to first character in field */
+
+ /* Check if there is an end to the enclosure */
+ if (!strchr(bptr, enclosure)) {
+ continue;
+ }
+
/* 2A. handle enclosure delimited field */
- bptr++; /* move on to first character in field */
while (*bptr) {
if (*bptr == enclosure) {
/* handle the enclosure */