ID: 29719 Updated by: [EMAIL PROTECTED] Reported By: tjerk dot meesters at gmail dot com -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: Linux-2.4 -PHP Version: php-4.3.9RC2 +PHP Version: 4.3.9RC2 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2004-09-02 22:57:17] tjerk dot meesters at gmail dot com I'd like to remind you that this issue is still not resolved. It gives the wrong results when dealing with a line like below: """testing"""; The above is returned as: testing" (empty field) ------------------------------------------------------------------------ [2004-08-20 02:40:06] t dot meesters at triptic dot nl I meant that the problem is still there ;-) I've been browsing through the code and finally came up with the following patch: *** file.c.orig Fri Aug 20 02:30:27 2004 --- file.c Fri Aug 20 02:30:37 2004 *************** *** 2391,2399 **** if ((p = memchr(p2, delimiter, (e - p2)))) { p2 = s; s = p + 1; - if (*p2 == enclosure) { - p2++; - } /* copy data to buffer */ buf2 = erealloc(buf2, buf2_len + (p - p2) + 1); --- 2391,2396 ---- After setting p2 to s it doesn't seem like a good idea to check if the first character is a delimiter, since you might want to start a string with two consecutive double quotes. By increasing p2, thus effectively removing the first double quote, the trim_enclosed() function will regard the remaining double quote as garbage and ignore it. The patch has been tested and passes the above mentioned tests. ------------------------------------------------------------------------ [2004-08-18 23:35:23] t dot meesters at triptic dot nl Oops, I think the line wrapping caused an error in my initial input: please note that test #3 should be: """test with inline double quotes""" (on one line) Sorry for the inconvenience. ------------------------------------------------------------------------ [2004-08-18 23:15:15] [EMAIL PROTECTED] With latest CVS I get the correct output of: Array ( [0] => test [1] => test spaced string [2] => test; with delimeter [3] => "test with inline double quotes" [4] => test with newlines [5] => "test with newlines and double quotes" ) ------------------------------------------------------------------------ [2004-08-18 23:08:04] t dot meesters at triptic dot nl Result is now: Array ( [0] => test [1] => test spaced string [2] => test; with delimeter [3] => test with inline double quotes" [4] => test with newlines [5] => "test with newlines and double quotes" ) Although the test with newlines and double quotes works fine now, the problem still lies with test 3: the inline double quote. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/29719 -- Edit this bug report at http://bugs.php.net/?id=29719&edit=1