Hello David,

 i looked up the fputcsv() magic in the file manually and agree that this
is fairly correct (as i wrote before). But when i execute the test the
second var_export() is supposed to show the input from the .phpt file.
Unfortunatley i get a FAIL from run-tests.php:

FAIL various fputcsv() functionality tests [ext/standard/tests/file/fputcsv.phpt]
040+   16 => 'aaa,"\\"bbb",ccc',
041+   17 => 'aaa"\\"a""","bbb"',
042+   18 => '"\\""","aaa"""',
043+   19 => '"\\"""",aaa
044+ ',
040-   16 => 'aaa,"\\"bbb,ccc',
041-   17 => 'aaa"\\"a","bbb"',
042-   18 => '"\\"","aaa"',
043-   19 => '"\\""",aaa',[EMAIL PROTECTED] /usr/src/php-cvs $

Care to look into this (done with current HEAD)?

best regards
marcus

Thursday, September 2, 2004, 6:17:51 PM, you wrote:

> Marcus Boerger wrote:

>> Hello David,
>> 
>>   as promised i looked at the patch. Besides a small misstake it looks
>> good. But it seems to work different then fgetcsv(). In other words if
>> you write using fputcsv() you are not sure to get the same back with
>> fgetcsv(). Though my current opinion is that fputcsv() is doing it right.
>> The attached patch includes a testfile that demonstrates the problem.
>> 
>>   anyone having thoughts?

> I agree that if you write something with fputcsv() and then read it with 
> fgetcsv() you should get back what you started with.

> I don't see what's broken though. (Maybe I am misunderstanding your test 
> cases.) The original array in the test file is:

>> +$list = array (
>> +  0 => 'aaa,bbb',
>> +  1 => 'aaa,"bbb"',
>> +  2 => '"aaa","bbb"',
>> +  3 => 'aaa,bbb',
>> +  4 => '"aaa",bbb',
>> +  5 => '"aaa",   "bbb"',
>> +  6 => ',',
>> +  7 => 'aaa,',
>> +  8 => ',"aaa"',
>> +  9 => '"",""',
>> +  10 => '"""""",',
>> +  11 => '""""",aaa',
>> +  12 => 'aaa,bbb   ',
>> +  13 => 'aaa,"bbb   "',
>> +  14 => 'aaa"aaa","bbb"bbb',
>> +  15 => 'aaa"aaa""",bbb',
>> +  16 => 'aaa,"\\"bbb,ccc',
>> +  17 => 'aaa"\\"a","bbb"',
>> +  18 => '"\\"","aaa"',
>> +  19 => '"\\""",aaa',

> And then what gets printed out by fputcsv() is this: (which is 
> different, but that's OK, since fputcsv() has worked its encoding magic):

>> +$list = array (
>> +  0 => 'aaa,bbb',
>> +  1 => 'aaa,"""bbb"""',
>> +  2 => '"""aaa""","""bbb"""',
>> +  3 => 'aaa,bbb',
>> +  4 => '"""aaa""",bbb',
>> +  5 => '"""aaa""","   ""bbb"""',
>> +  6 => ',',
>> +  7 => 'aaa,',
>> +  8 => ',"""aaa"""',
>> +  9 => '"""""",""""""',
>> +  10 => '"""""""""""""",',
>> +  11 => '"""""""""""",aaa',
>> +  12 => 'aaa,"bbb   "',
>> +  13 => 'aaa,"""bbb   """',
>> +  14 => '"aaa""aaa""","""bbb""bbb"',
>> +  15 => '"aaa""aaa""""""",bbb',
>> +  16 => 'aaa,"""\\""bbb",ccc',
>> +  17 => '"aaa""\\""a""","""bbb"""',
>> +  18 => '"""\\""""","""aaa"""',
>> +  19 => '"""\\""""""",aaa',
>> +);

> And then this is the array after being read in by fgetcsv():

>> +$list = array (
>> +  0 => 'aaa,bbb',
>> +  1 => 'aaa,"bbb"',
>> +  2 => '"aaa","bbb"',
>> +  3 => 'aaa,bbb',
>> +  4 => '"aaa",bbb',
>> +  5 => '"aaa",   "bbb"',
>> +  6 => ',',
>> +  7 => 'aaa,',
>> +  8 => ',"aaa"',
>> +  9 => '"",""',
>> +  10 => '"""""",',
>> +  11 => '""""",aaa',
>> +  12 => 'aaa,bbb   ',
>> +  13 => 'aaa,"bbb   "',
>> +  14 => 'aaa"aaa","bbb"bbb',
>> +  15 => 'aaa"aaa""",bbb',
>> +  16 => 'aaa,"\\"bbb,ccc',
>> +  17 => 'aaa"\\"a","bbb"',
>> +  18 => '"\\"","aaa"',
>> +  19 => '"\\""",aaa',
>> +);

> Which seems to be the same as the original array?

> David




-- 
Best regards,
 Marcus                            mailto:[EMAIL PROTECTED]

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to