1--TEST--
2Test fgetcsv() : usage variations - with length as 0
3--FILE--
4<?php
5/* Testing fgetcsv() to rwad from a file with length argument equal to zero */
6
7echo "*** Testing fgetcsv() : with length as 0 ***\n";
8
9/* the array is with three elements in it. Each element should be read as
10   1st element is delimiter, 2nd element is enclosure
11   and 3rd element is csv fields
12*/
13$csv_lists = array (
14  array(',', '"', '"water",fruit'),
15  array(',', '"', '"water","fruit"'),
16  array(' ', '^', '^water^ ^fruit^'),
17  array(':', '&', '&water&:&fruit&'),
18  array('=', '=', '=water===fruit='),
19  array('-', '-', '-water--fruit-air'),
20  array('-', '-', '-water---fruit---air-'),
21  array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
22);
23
24$filename = __DIR__ . '/fgetcsv_variation2.tmp';
25@unlink($filename);
26
27$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
28                     "a+", "a+b", "a+t",
29                     "w+", "w+b", "w+t",
30                     "x+", "x+b", "x+t");
31
32$loop_counter = 1;
33foreach ($csv_lists as $csv_list) {
34  for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
35    // create the file and add the content with has csv fields
36    if ( strstr($file_modes[$mode_counter], "r") ) {
37      $file_handle = fopen($filename, "w");
38    } else {
39      $file_handle = fopen($filename, $file_modes[$mode_counter] );
40    }
41    if ( !$file_handle ) {
42      echo "Error: failed to create file $filename!\n";
43      exit();
44    }
45    $delimiter = $csv_list[0];
46    $enclosure = $csv_list[1];
47    $csv_field = $csv_list[2];
48
49    fwrite($file_handle, $csv_field . "\n");
50    // write another line of text and a blank line
51    // this will be used to test, if the fgetcsv() read more than a line and its
52    // working when only a blank line is read
53    fwrite($file_handle, "This is line of text without csv fields\n");
54    fwrite($file_handle, "\n"); // blank line
55
56    // close the file if the mode to be used is read mode  and re-open using read mode
57    // else rewind the file pointer to beginning of the file
58    if ( strstr($file_modes[$mode_counter], "r" ) ) {
59      fclose($file_handle);
60      $file_handle = fopen($filename, $file_modes[$mode_counter]);
61    } else {
62      // rewind the file pointer to bof
63      rewind($file_handle);
64    }
65
66    echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
67
68    // call fgetcsv() to parse csv fields
69
70    // use length as 0
71    fseek($file_handle, 0, SEEK_SET);
72    var_dump( fgetcsv($file_handle, 0, $delimiter, $enclosure) );
73    // check the file pointer position and if eof
74    var_dump( ftell($file_handle) );
75    var_dump( feof($file_handle) );
76
77    // close the file
78    fclose($file_handle);
79    //delete file
80    unlink($filename);
81  } //end of mode loop
82} // end of foreach
83
84echo "Done\n";
85?>
86--EXPECT--
87*** Testing fgetcsv() : with length as 0 ***
88
89-- Testing fgetcsv() with file opened using r mode --
90array(2) {
91  [0]=>
92  string(5) "water"
93  [1]=>
94  string(5) "fruit"
95}
96int(14)
97bool(false)
98
99-- Testing fgetcsv() with file opened using rb mode --
100array(2) {
101  [0]=>
102  string(5) "water"
103  [1]=>
104  string(5) "fruit"
105}
106int(14)
107bool(false)
108
109-- Testing fgetcsv() with file opened using rt mode --
110array(2) {
111  [0]=>
112  string(5) "water"
113  [1]=>
114  string(5) "fruit"
115}
116int(14)
117bool(false)
118
119-- Testing fgetcsv() with file opened using r+ mode --
120array(2) {
121  [0]=>
122  string(5) "water"
123  [1]=>
124  string(5) "fruit"
125}
126int(14)
127bool(false)
128
129-- Testing fgetcsv() with file opened using r+b mode --
130array(2) {
131  [0]=>
132  string(5) "water"
133  [1]=>
134  string(5) "fruit"
135}
136int(14)
137bool(false)
138
139-- Testing fgetcsv() with file opened using r+t mode --
140array(2) {
141  [0]=>
142  string(5) "water"
143  [1]=>
144  string(5) "fruit"
145}
146int(14)
147bool(false)
148
149-- Testing fgetcsv() with file opened using a+ mode --
150array(2) {
151  [0]=>
152  string(5) "water"
153  [1]=>
154  string(5) "fruit"
155}
156int(14)
157bool(false)
158
159-- Testing fgetcsv() with file opened using a+b mode --
160array(2) {
161  [0]=>
162  string(5) "water"
163  [1]=>
164  string(5) "fruit"
165}
166int(14)
167bool(false)
168
169-- Testing fgetcsv() with file opened using a+t mode --
170array(2) {
171  [0]=>
172  string(5) "water"
173  [1]=>
174  string(5) "fruit"
175}
176int(14)
177bool(false)
178
179-- Testing fgetcsv() with file opened using w+ mode --
180array(2) {
181  [0]=>
182  string(5) "water"
183  [1]=>
184  string(5) "fruit"
185}
186int(14)
187bool(false)
188
189-- Testing fgetcsv() with file opened using w+b mode --
190array(2) {
191  [0]=>
192  string(5) "water"
193  [1]=>
194  string(5) "fruit"
195}
196int(14)
197bool(false)
198
199-- Testing fgetcsv() with file opened using w+t mode --
200array(2) {
201  [0]=>
202  string(5) "water"
203  [1]=>
204  string(5) "fruit"
205}
206int(14)
207bool(false)
208
209-- Testing fgetcsv() with file opened using x+ mode --
210array(2) {
211  [0]=>
212  string(5) "water"
213  [1]=>
214  string(5) "fruit"
215}
216int(14)
217bool(false)
218
219-- Testing fgetcsv() with file opened using x+b mode --
220array(2) {
221  [0]=>
222  string(5) "water"
223  [1]=>
224  string(5) "fruit"
225}
226int(14)
227bool(false)
228
229-- Testing fgetcsv() with file opened using x+t mode --
230array(2) {
231  [0]=>
232  string(5) "water"
233  [1]=>
234  string(5) "fruit"
235}
236int(14)
237bool(false)
238
239-- Testing fgetcsv() with file opened using r mode --
240array(2) {
241  [0]=>
242  string(5) "water"
243  [1]=>
244  string(5) "fruit"
245}
246int(16)
247bool(false)
248
249-- Testing fgetcsv() with file opened using rb mode --
250array(2) {
251  [0]=>
252  string(5) "water"
253  [1]=>
254  string(5) "fruit"
255}
256int(16)
257bool(false)
258
259-- Testing fgetcsv() with file opened using rt mode --
260array(2) {
261  [0]=>
262  string(5) "water"
263  [1]=>
264  string(5) "fruit"
265}
266int(16)
267bool(false)
268
269-- Testing fgetcsv() with file opened using r+ mode --
270array(2) {
271  [0]=>
272  string(5) "water"
273  [1]=>
274  string(5) "fruit"
275}
276int(16)
277bool(false)
278
279-- Testing fgetcsv() with file opened using r+b mode --
280array(2) {
281  [0]=>
282  string(5) "water"
283  [1]=>
284  string(5) "fruit"
285}
286int(16)
287bool(false)
288
289-- Testing fgetcsv() with file opened using r+t mode --
290array(2) {
291  [0]=>
292  string(5) "water"
293  [1]=>
294  string(5) "fruit"
295}
296int(16)
297bool(false)
298
299-- Testing fgetcsv() with file opened using a+ mode --
300array(2) {
301  [0]=>
302  string(5) "water"
303  [1]=>
304  string(5) "fruit"
305}
306int(16)
307bool(false)
308
309-- Testing fgetcsv() with file opened using a+b mode --
310array(2) {
311  [0]=>
312  string(5) "water"
313  [1]=>
314  string(5) "fruit"
315}
316int(16)
317bool(false)
318
319-- Testing fgetcsv() with file opened using a+t mode --
320array(2) {
321  [0]=>
322  string(5) "water"
323  [1]=>
324  string(5) "fruit"
325}
326int(16)
327bool(false)
328
329-- Testing fgetcsv() with file opened using w+ mode --
330array(2) {
331  [0]=>
332  string(5) "water"
333  [1]=>
334  string(5) "fruit"
335}
336int(16)
337bool(false)
338
339-- Testing fgetcsv() with file opened using w+b mode --
340array(2) {
341  [0]=>
342  string(5) "water"
343  [1]=>
344  string(5) "fruit"
345}
346int(16)
347bool(false)
348
349-- Testing fgetcsv() with file opened using w+t mode --
350array(2) {
351  [0]=>
352  string(5) "water"
353  [1]=>
354  string(5) "fruit"
355}
356int(16)
357bool(false)
358
359-- Testing fgetcsv() with file opened using x+ mode --
360array(2) {
361  [0]=>
362  string(5) "water"
363  [1]=>
364  string(5) "fruit"
365}
366int(16)
367bool(false)
368
369-- Testing fgetcsv() with file opened using x+b mode --
370array(2) {
371  [0]=>
372  string(5) "water"
373  [1]=>
374  string(5) "fruit"
375}
376int(16)
377bool(false)
378
379-- Testing fgetcsv() with file opened using x+t mode --
380array(2) {
381  [0]=>
382  string(5) "water"
383  [1]=>
384  string(5) "fruit"
385}
386int(16)
387bool(false)
388
389-- Testing fgetcsv() with file opened using r mode --
390array(2) {
391  [0]=>
392  string(5) "water"
393  [1]=>
394  string(5) "fruit"
395}
396int(16)
397bool(false)
398
399-- Testing fgetcsv() with file opened using rb mode --
400array(2) {
401  [0]=>
402  string(5) "water"
403  [1]=>
404  string(5) "fruit"
405}
406int(16)
407bool(false)
408
409-- Testing fgetcsv() with file opened using rt mode --
410array(2) {
411  [0]=>
412  string(5) "water"
413  [1]=>
414  string(5) "fruit"
415}
416int(16)
417bool(false)
418
419-- Testing fgetcsv() with file opened using r+ mode --
420array(2) {
421  [0]=>
422  string(5) "water"
423  [1]=>
424  string(5) "fruit"
425}
426int(16)
427bool(false)
428
429-- Testing fgetcsv() with file opened using r+b mode --
430array(2) {
431  [0]=>
432  string(5) "water"
433  [1]=>
434  string(5) "fruit"
435}
436int(16)
437bool(false)
438
439-- Testing fgetcsv() with file opened using r+t mode --
440array(2) {
441  [0]=>
442  string(5) "water"
443  [1]=>
444  string(5) "fruit"
445}
446int(16)
447bool(false)
448
449-- Testing fgetcsv() with file opened using a+ mode --
450array(2) {
451  [0]=>
452  string(5) "water"
453  [1]=>
454  string(5) "fruit"
455}
456int(16)
457bool(false)
458
459-- Testing fgetcsv() with file opened using a+b mode --
460array(2) {
461  [0]=>
462  string(5) "water"
463  [1]=>
464  string(5) "fruit"
465}
466int(16)
467bool(false)
468
469-- Testing fgetcsv() with file opened using a+t mode --
470array(2) {
471  [0]=>
472  string(5) "water"
473  [1]=>
474  string(5) "fruit"
475}
476int(16)
477bool(false)
478
479-- Testing fgetcsv() with file opened using w+ mode --
480array(2) {
481  [0]=>
482  string(5) "water"
483  [1]=>
484  string(5) "fruit"
485}
486int(16)
487bool(false)
488
489-- Testing fgetcsv() with file opened using w+b mode --
490array(2) {
491  [0]=>
492  string(5) "water"
493  [1]=>
494  string(5) "fruit"
495}
496int(16)
497bool(false)
498
499-- Testing fgetcsv() with file opened using w+t mode --
500array(2) {
501  [0]=>
502  string(5) "water"
503  [1]=>
504  string(5) "fruit"
505}
506int(16)
507bool(false)
508
509-- Testing fgetcsv() with file opened using x+ mode --
510array(2) {
511  [0]=>
512  string(5) "water"
513  [1]=>
514  string(5) "fruit"
515}
516int(16)
517bool(false)
518
519-- Testing fgetcsv() with file opened using x+b mode --
520array(2) {
521  [0]=>
522  string(5) "water"
523  [1]=>
524  string(5) "fruit"
525}
526int(16)
527bool(false)
528
529-- Testing fgetcsv() with file opened using x+t mode --
530array(2) {
531  [0]=>
532  string(5) "water"
533  [1]=>
534  string(5) "fruit"
535}
536int(16)
537bool(false)
538
539-- Testing fgetcsv() with file opened using r mode --
540array(2) {
541  [0]=>
542  string(5) "water"
543  [1]=>
544  string(5) "fruit"
545}
546int(16)
547bool(false)
548
549-- Testing fgetcsv() with file opened using rb mode --
550array(2) {
551  [0]=>
552  string(5) "water"
553  [1]=>
554  string(5) "fruit"
555}
556int(16)
557bool(false)
558
559-- Testing fgetcsv() with file opened using rt mode --
560array(2) {
561  [0]=>
562  string(5) "water"
563  [1]=>
564  string(5) "fruit"
565}
566int(16)
567bool(false)
568
569-- Testing fgetcsv() with file opened using r+ mode --
570array(2) {
571  [0]=>
572  string(5) "water"
573  [1]=>
574  string(5) "fruit"
575}
576int(16)
577bool(false)
578
579-- Testing fgetcsv() with file opened using r+b mode --
580array(2) {
581  [0]=>
582  string(5) "water"
583  [1]=>
584  string(5) "fruit"
585}
586int(16)
587bool(false)
588
589-- Testing fgetcsv() with file opened using r+t mode --
590array(2) {
591  [0]=>
592  string(5) "water"
593  [1]=>
594  string(5) "fruit"
595}
596int(16)
597bool(false)
598
599-- Testing fgetcsv() with file opened using a+ mode --
600array(2) {
601  [0]=>
602  string(5) "water"
603  [1]=>
604  string(5) "fruit"
605}
606int(16)
607bool(false)
608
609-- Testing fgetcsv() with file opened using a+b mode --
610array(2) {
611  [0]=>
612  string(5) "water"
613  [1]=>
614  string(5) "fruit"
615}
616int(16)
617bool(false)
618
619-- Testing fgetcsv() with file opened using a+t mode --
620array(2) {
621  [0]=>
622  string(5) "water"
623  [1]=>
624  string(5) "fruit"
625}
626int(16)
627bool(false)
628
629-- Testing fgetcsv() with file opened using w+ mode --
630array(2) {
631  [0]=>
632  string(5) "water"
633  [1]=>
634  string(5) "fruit"
635}
636int(16)
637bool(false)
638
639-- Testing fgetcsv() with file opened using w+b mode --
640array(2) {
641  [0]=>
642  string(5) "water"
643  [1]=>
644  string(5) "fruit"
645}
646int(16)
647bool(false)
648
649-- Testing fgetcsv() with file opened using w+t mode --
650array(2) {
651  [0]=>
652  string(5) "water"
653  [1]=>
654  string(5) "fruit"
655}
656int(16)
657bool(false)
658
659-- Testing fgetcsv() with file opened using x+ mode --
660array(2) {
661  [0]=>
662  string(5) "water"
663  [1]=>
664  string(5) "fruit"
665}
666int(16)
667bool(false)
668
669-- Testing fgetcsv() with file opened using x+b mode --
670array(2) {
671  [0]=>
672  string(5) "water"
673  [1]=>
674  string(5) "fruit"
675}
676int(16)
677bool(false)
678
679-- Testing fgetcsv() with file opened using x+t mode --
680array(2) {
681  [0]=>
682  string(5) "water"
683  [1]=>
684  string(5) "fruit"
685}
686int(16)
687bool(false)
688
689-- Testing fgetcsv() with file opened using r mode --
690array(2) {
691  [0]=>
692  string(11) "water=fruit"
693  [1]=>
694  string(0) ""
695}
696int(16)
697bool(false)
698
699-- Testing fgetcsv() with file opened using rb mode --
700array(2) {
701  [0]=>
702  string(11) "water=fruit"
703  [1]=>
704  string(0) ""
705}
706int(16)
707bool(false)
708
709-- Testing fgetcsv() with file opened using rt mode --
710array(2) {
711  [0]=>
712  string(11) "water=fruit"
713  [1]=>
714  string(0) ""
715}
716int(16)
717bool(false)
718
719-- Testing fgetcsv() with file opened using r+ mode --
720array(2) {
721  [0]=>
722  string(11) "water=fruit"
723  [1]=>
724  string(0) ""
725}
726int(16)
727bool(false)
728
729-- Testing fgetcsv() with file opened using r+b mode --
730array(2) {
731  [0]=>
732  string(11) "water=fruit"
733  [1]=>
734  string(0) ""
735}
736int(16)
737bool(false)
738
739-- Testing fgetcsv() with file opened using r+t mode --
740array(2) {
741  [0]=>
742  string(11) "water=fruit"
743  [1]=>
744  string(0) ""
745}
746int(16)
747bool(false)
748
749-- Testing fgetcsv() with file opened using a+ mode --
750array(2) {
751  [0]=>
752  string(11) "water=fruit"
753  [1]=>
754  string(0) ""
755}
756int(16)
757bool(false)
758
759-- Testing fgetcsv() with file opened using a+b mode --
760array(2) {
761  [0]=>
762  string(11) "water=fruit"
763  [1]=>
764  string(0) ""
765}
766int(16)
767bool(false)
768
769-- Testing fgetcsv() with file opened using a+t mode --
770array(2) {
771  [0]=>
772  string(11) "water=fruit"
773  [1]=>
774  string(0) ""
775}
776int(16)
777bool(false)
778
779-- Testing fgetcsv() with file opened using w+ mode --
780array(2) {
781  [0]=>
782  string(11) "water=fruit"
783  [1]=>
784  string(0) ""
785}
786int(16)
787bool(false)
788
789-- Testing fgetcsv() with file opened using w+b mode --
790array(2) {
791  [0]=>
792  string(11) "water=fruit"
793  [1]=>
794  string(0) ""
795}
796int(16)
797bool(false)
798
799-- Testing fgetcsv() with file opened using w+t mode --
800array(2) {
801  [0]=>
802  string(11) "water=fruit"
803  [1]=>
804  string(0) ""
805}
806int(16)
807bool(false)
808
809-- Testing fgetcsv() with file opened using x+ mode --
810array(2) {
811  [0]=>
812  string(11) "water=fruit"
813  [1]=>
814  string(0) ""
815}
816int(16)
817bool(false)
818
819-- Testing fgetcsv() with file opened using x+b mode --
820array(2) {
821  [0]=>
822  string(11) "water=fruit"
823  [1]=>
824  string(0) ""
825}
826int(16)
827bool(false)
828
829-- Testing fgetcsv() with file opened using x+t mode --
830array(2) {
831  [0]=>
832  string(11) "water=fruit"
833  [1]=>
834  string(0) ""
835}
836int(16)
837bool(false)
838
839-- Testing fgetcsv() with file opened using r mode --
840array(1) {
841  [0]=>
842  string(14) "water-fruitair"
843}
844int(18)
845bool(false)
846
847-- Testing fgetcsv() with file opened using rb mode --
848array(1) {
849  [0]=>
850  string(14) "water-fruitair"
851}
852int(18)
853bool(false)
854
855-- Testing fgetcsv() with file opened using rt mode --
856array(1) {
857  [0]=>
858  string(14) "water-fruitair"
859}
860int(18)
861bool(false)
862
863-- Testing fgetcsv() with file opened using r+ mode --
864array(1) {
865  [0]=>
866  string(14) "water-fruitair"
867}
868int(18)
869bool(false)
870
871-- Testing fgetcsv() with file opened using r+b mode --
872array(1) {
873  [0]=>
874  string(14) "water-fruitair"
875}
876int(18)
877bool(false)
878
879-- Testing fgetcsv() with file opened using r+t mode --
880array(1) {
881  [0]=>
882  string(14) "water-fruitair"
883}
884int(18)
885bool(false)
886
887-- Testing fgetcsv() with file opened using a+ mode --
888array(1) {
889  [0]=>
890  string(14) "water-fruitair"
891}
892int(18)
893bool(false)
894
895-- Testing fgetcsv() with file opened using a+b mode --
896array(1) {
897  [0]=>
898  string(14) "water-fruitair"
899}
900int(18)
901bool(false)
902
903-- Testing fgetcsv() with file opened using a+t mode --
904array(1) {
905  [0]=>
906  string(14) "water-fruitair"
907}
908int(18)
909bool(false)
910
911-- Testing fgetcsv() with file opened using w+ mode --
912array(1) {
913  [0]=>
914  string(14) "water-fruitair"
915}
916int(18)
917bool(false)
918
919-- Testing fgetcsv() with file opened using w+b mode --
920array(1) {
921  [0]=>
922  string(14) "water-fruitair"
923}
924int(18)
925bool(false)
926
927-- Testing fgetcsv() with file opened using w+t mode --
928array(1) {
929  [0]=>
930  string(14) "water-fruitair"
931}
932int(18)
933bool(false)
934
935-- Testing fgetcsv() with file opened using x+ mode --
936array(1) {
937  [0]=>
938  string(14) "water-fruitair"
939}
940int(18)
941bool(false)
942
943-- Testing fgetcsv() with file opened using x+b mode --
944array(1) {
945  [0]=>
946  string(14) "water-fruitair"
947}
948int(18)
949bool(false)
950
951-- Testing fgetcsv() with file opened using x+t mode --
952array(1) {
953  [0]=>
954  string(14) "water-fruitair"
955}
956int(18)
957bool(false)
958
959-- Testing fgetcsv() with file opened using r mode --
960array(3) {
961  [0]=>
962  string(11) "water-fruit"
963  [1]=>
964  string(3) "air"
965  [2]=>
966  string(0) ""
967}
968int(22)
969bool(false)
970
971-- Testing fgetcsv() with file opened using rb mode --
972array(3) {
973  [0]=>
974  string(11) "water-fruit"
975  [1]=>
976  string(3) "air"
977  [2]=>
978  string(0) ""
979}
980int(22)
981bool(false)
982
983-- Testing fgetcsv() with file opened using rt mode --
984array(3) {
985  [0]=>
986  string(11) "water-fruit"
987  [1]=>
988  string(3) "air"
989  [2]=>
990  string(0) ""
991}
992int(22)
993bool(false)
994
995-- Testing fgetcsv() with file opened using r+ mode --
996array(3) {
997  [0]=>
998  string(11) "water-fruit"
999  [1]=>
1000  string(3) "air"
1001  [2]=>
1002  string(0) ""
1003}
1004int(22)
1005bool(false)
1006
1007-- Testing fgetcsv() with file opened using r+b mode --
1008array(3) {
1009  [0]=>
1010  string(11) "water-fruit"
1011  [1]=>
1012  string(3) "air"
1013  [2]=>
1014  string(0) ""
1015}
1016int(22)
1017bool(false)
1018
1019-- Testing fgetcsv() with file opened using r+t mode --
1020array(3) {
1021  [0]=>
1022  string(11) "water-fruit"
1023  [1]=>
1024  string(3) "air"
1025  [2]=>
1026  string(0) ""
1027}
1028int(22)
1029bool(false)
1030
1031-- Testing fgetcsv() with file opened using a+ mode --
1032array(3) {
1033  [0]=>
1034  string(11) "water-fruit"
1035  [1]=>
1036  string(3) "air"
1037  [2]=>
1038  string(0) ""
1039}
1040int(22)
1041bool(false)
1042
1043-- Testing fgetcsv() with file opened using a+b mode --
1044array(3) {
1045  [0]=>
1046  string(11) "water-fruit"
1047  [1]=>
1048  string(3) "air"
1049  [2]=>
1050  string(0) ""
1051}
1052int(22)
1053bool(false)
1054
1055-- Testing fgetcsv() with file opened using a+t mode --
1056array(3) {
1057  [0]=>
1058  string(11) "water-fruit"
1059  [1]=>
1060  string(3) "air"
1061  [2]=>
1062  string(0) ""
1063}
1064int(22)
1065bool(false)
1066
1067-- Testing fgetcsv() with file opened using w+ mode --
1068array(3) {
1069  [0]=>
1070  string(11) "water-fruit"
1071  [1]=>
1072  string(3) "air"
1073  [2]=>
1074  string(0) ""
1075}
1076int(22)
1077bool(false)
1078
1079-- Testing fgetcsv() with file opened using w+b mode --
1080array(3) {
1081  [0]=>
1082  string(11) "water-fruit"
1083  [1]=>
1084  string(3) "air"
1085  [2]=>
1086  string(0) ""
1087}
1088int(22)
1089bool(false)
1090
1091-- Testing fgetcsv() with file opened using w+t mode --
1092array(3) {
1093  [0]=>
1094  string(11) "water-fruit"
1095  [1]=>
1096  string(3) "air"
1097  [2]=>
1098  string(0) ""
1099}
1100int(22)
1101bool(false)
1102
1103-- Testing fgetcsv() with file opened using x+ mode --
1104array(3) {
1105  [0]=>
1106  string(11) "water-fruit"
1107  [1]=>
1108  string(3) "air"
1109  [2]=>
1110  string(0) ""
1111}
1112int(22)
1113bool(false)
1114
1115-- Testing fgetcsv() with file opened using x+b mode --
1116array(3) {
1117  [0]=>
1118  string(11) "water-fruit"
1119  [1]=>
1120  string(3) "air"
1121  [2]=>
1122  string(0) ""
1123}
1124int(22)
1125bool(false)
1126
1127-- Testing fgetcsv() with file opened using x+t mode --
1128array(3) {
1129  [0]=>
1130  string(11) "water-fruit"
1131  [1]=>
1132  string(3) "air"
1133  [2]=>
1134  string(0) ""
1135}
1136int(22)
1137bool(false)
1138
1139-- Testing fgetcsv() with file opened using r mode --
1140array(6) {
1141  [0]=>
1142  string(4) """"""
1143  [1]=>
1144  string(1) """
1145  [2]=>
1146  string(1) ","
1147  [3]=>
1148  string(1) """
1149  [4]=>
1150  string(1) ","
1151  [5]=>
1152  string(4) ",,,,"
1153}
1154int(24)
1155bool(false)
1156
1157-- Testing fgetcsv() with file opened using rb mode --
1158array(6) {
1159  [0]=>
1160  string(4) """"""
1161  [1]=>
1162  string(1) """
1163  [2]=>
1164  string(1) ","
1165  [3]=>
1166  string(1) """
1167  [4]=>
1168  string(1) ","
1169  [5]=>
1170  string(4) ",,,,"
1171}
1172int(24)
1173bool(false)
1174
1175-- Testing fgetcsv() with file opened using rt mode --
1176array(6) {
1177  [0]=>
1178  string(4) """"""
1179  [1]=>
1180  string(1) """
1181  [2]=>
1182  string(1) ","
1183  [3]=>
1184  string(1) """
1185  [4]=>
1186  string(1) ","
1187  [5]=>
1188  string(4) ",,,,"
1189}
1190int(24)
1191bool(false)
1192
1193-- Testing fgetcsv() with file opened using r+ mode --
1194array(6) {
1195  [0]=>
1196  string(4) """"""
1197  [1]=>
1198  string(1) """
1199  [2]=>
1200  string(1) ","
1201  [3]=>
1202  string(1) """
1203  [4]=>
1204  string(1) ","
1205  [5]=>
1206  string(4) ",,,,"
1207}
1208int(24)
1209bool(false)
1210
1211-- Testing fgetcsv() with file opened using r+b mode --
1212array(6) {
1213  [0]=>
1214  string(4) """"""
1215  [1]=>
1216  string(1) """
1217  [2]=>
1218  string(1) ","
1219  [3]=>
1220  string(1) """
1221  [4]=>
1222  string(1) ","
1223  [5]=>
1224  string(4) ",,,,"
1225}
1226int(24)
1227bool(false)
1228
1229-- Testing fgetcsv() with file opened using r+t mode --
1230array(6) {
1231  [0]=>
1232  string(4) """"""
1233  [1]=>
1234  string(1) """
1235  [2]=>
1236  string(1) ","
1237  [3]=>
1238  string(1) """
1239  [4]=>
1240  string(1) ","
1241  [5]=>
1242  string(4) ",,,,"
1243}
1244int(24)
1245bool(false)
1246
1247-- Testing fgetcsv() with file opened using a+ mode --
1248array(6) {
1249  [0]=>
1250  string(4) """"""
1251  [1]=>
1252  string(1) """
1253  [2]=>
1254  string(1) ","
1255  [3]=>
1256  string(1) """
1257  [4]=>
1258  string(1) ","
1259  [5]=>
1260  string(4) ",,,,"
1261}
1262int(24)
1263bool(false)
1264
1265-- Testing fgetcsv() with file opened using a+b mode --
1266array(6) {
1267  [0]=>
1268  string(4) """"""
1269  [1]=>
1270  string(1) """
1271  [2]=>
1272  string(1) ","
1273  [3]=>
1274  string(1) """
1275  [4]=>
1276  string(1) ","
1277  [5]=>
1278  string(4) ",,,,"
1279}
1280int(24)
1281bool(false)
1282
1283-- Testing fgetcsv() with file opened using a+t mode --
1284array(6) {
1285  [0]=>
1286  string(4) """"""
1287  [1]=>
1288  string(1) """
1289  [2]=>
1290  string(1) ","
1291  [3]=>
1292  string(1) """
1293  [4]=>
1294  string(1) ","
1295  [5]=>
1296  string(4) ",,,,"
1297}
1298int(24)
1299bool(false)
1300
1301-- Testing fgetcsv() with file opened using w+ mode --
1302array(6) {
1303  [0]=>
1304  string(4) """"""
1305  [1]=>
1306  string(1) """
1307  [2]=>
1308  string(1) ","
1309  [3]=>
1310  string(1) """
1311  [4]=>
1312  string(1) ","
1313  [5]=>
1314  string(4) ",,,,"
1315}
1316int(24)
1317bool(false)
1318
1319-- Testing fgetcsv() with file opened using w+b mode --
1320array(6) {
1321  [0]=>
1322  string(4) """"""
1323  [1]=>
1324  string(1) """
1325  [2]=>
1326  string(1) ","
1327  [3]=>
1328  string(1) """
1329  [4]=>
1330  string(1) ","
1331  [5]=>
1332  string(4) ",,,,"
1333}
1334int(24)
1335bool(false)
1336
1337-- Testing fgetcsv() with file opened using w+t mode --
1338array(6) {
1339  [0]=>
1340  string(4) """"""
1341  [1]=>
1342  string(1) """
1343  [2]=>
1344  string(1) ","
1345  [3]=>
1346  string(1) """
1347  [4]=>
1348  string(1) ","
1349  [5]=>
1350  string(4) ",,,,"
1351}
1352int(24)
1353bool(false)
1354
1355-- Testing fgetcsv() with file opened using x+ mode --
1356array(6) {
1357  [0]=>
1358  string(4) """"""
1359  [1]=>
1360  string(1) """
1361  [2]=>
1362  string(1) ","
1363  [3]=>
1364  string(1) """
1365  [4]=>
1366  string(1) ","
1367  [5]=>
1368  string(4) ",,,,"
1369}
1370int(24)
1371bool(false)
1372
1373-- Testing fgetcsv() with file opened using x+b mode --
1374array(6) {
1375  [0]=>
1376  string(4) """"""
1377  [1]=>
1378  string(1) """
1379  [2]=>
1380  string(1) ","
1381  [3]=>
1382  string(1) """
1383  [4]=>
1384  string(1) ","
1385  [5]=>
1386  string(4) ",,,,"
1387}
1388int(24)
1389bool(false)
1390
1391-- Testing fgetcsv() with file opened using x+t mode --
1392array(6) {
1393  [0]=>
1394  string(4) """"""
1395  [1]=>
1396  string(1) """
1397  [2]=>
1398  string(1) ","
1399  [3]=>
1400  string(1) """
1401  [4]=>
1402  string(1) ","
1403  [5]=>
1404  string(4) ",,,,"
1405}
1406int(24)
1407bool(false)
1408Done
1409