1--TEST--
2Test fgetcsv() : usage variations - with different enclosure but same delimiter
3--FILE--
4<?php
5/* Testing fgetcsv() by reading from a file when different enclosure that is not
6   present in the data being read and delimiter which is present in the data  */
7
8echo "*** Testing fgetcsv() : with different enclosure but same delimiter char ***\n";
9
10/* the array is with three elements in it. Each element should be read as
11   1st element is delimiter, 2nd element is enclosure
12   and 3rd element is csv fields
13*/
14$csv_lists = array (
15  array(',', '"', '"water",fruit'),
16  array(',', '"', '"water","fruit"'),
17  array(' ', '^', '^water^ ^fruit^'),
18  array(':', '&', '&water&:&fruit&'),
19  array('=', '=', '=water===fruit='),
20  array('-', '-', '-water--fruit-air'),
21  array('-', '-', '-water---fruit---air-'),
22  array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
23);
24
25$filename = __DIR__ . '/fgetcsv_variation11.tmp';
26@unlink($filename);
27
28$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
29                     "a+", "a+b", "a+t",
30                     "w+", "w+b", "w+t",
31                     "x+", "x+b", "x+t");
32
33$loop_counter = 1;
34foreach ($csv_lists as $csv_list) {
35  for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
36    // create the file and add the content with has csv fields
37    if ( strstr($file_modes[$mode_counter], "r") ) {
38      $file_handle = fopen($filename, "w");
39    } else {
40      $file_handle = fopen($filename, $file_modes[$mode_counter] );
41    }
42    if ( !$file_handle ) {
43      echo "Error: failed to create file $filename!\n";
44      exit();
45    }
46    $delimiter = $csv_list[0];
47    $enclosure = $csv_list[1];
48    $csv_field = $csv_list[2];
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 blan 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
71    // use different delimiter but same enclosure char
72    fseek($file_handle, 0, SEEK_SET);
73    $enc = "+";
74    var_dump( fgetcsv($file_handle, 1024, $delimiter, $enc) );
75    // check the file pointer position and if eof
76    var_dump( ftell($file_handle) );
77    var_dump( feof($file_handle) );
78
79    // close the file
80    fclose($file_handle);
81    //delete file
82    unlink($filename);
83  } //end of mode loop
84} // end of foreach
85
86echo "Done\n";
87?>
88--EXPECT--
89*** Testing fgetcsv() : with different enclosure but same delimiter char ***
90
91-- Testing fgetcsv() with file opened using r mode --
92array(2) {
93  [0]=>
94  string(7) ""water""
95  [1]=>
96  string(5) "fruit"
97}
98int(14)
99bool(false)
100
101-- Testing fgetcsv() with file opened using rb mode --
102array(2) {
103  [0]=>
104  string(7) ""water""
105  [1]=>
106  string(5) "fruit"
107}
108int(14)
109bool(false)
110
111-- Testing fgetcsv() with file opened using rt mode --
112array(2) {
113  [0]=>
114  string(7) ""water""
115  [1]=>
116  string(5) "fruit"
117}
118int(14)
119bool(false)
120
121-- Testing fgetcsv() with file opened using r+ mode --
122array(2) {
123  [0]=>
124  string(7) ""water""
125  [1]=>
126  string(5) "fruit"
127}
128int(14)
129bool(false)
130
131-- Testing fgetcsv() with file opened using r+b mode --
132array(2) {
133  [0]=>
134  string(7) ""water""
135  [1]=>
136  string(5) "fruit"
137}
138int(14)
139bool(false)
140
141-- Testing fgetcsv() with file opened using r+t mode --
142array(2) {
143  [0]=>
144  string(7) ""water""
145  [1]=>
146  string(5) "fruit"
147}
148int(14)
149bool(false)
150
151-- Testing fgetcsv() with file opened using a+ mode --
152array(2) {
153  [0]=>
154  string(7) ""water""
155  [1]=>
156  string(5) "fruit"
157}
158int(14)
159bool(false)
160
161-- Testing fgetcsv() with file opened using a+b mode --
162array(2) {
163  [0]=>
164  string(7) ""water""
165  [1]=>
166  string(5) "fruit"
167}
168int(14)
169bool(false)
170
171-- Testing fgetcsv() with file opened using a+t mode --
172array(2) {
173  [0]=>
174  string(7) ""water""
175  [1]=>
176  string(5) "fruit"
177}
178int(14)
179bool(false)
180
181-- Testing fgetcsv() with file opened using w+ mode --
182array(2) {
183  [0]=>
184  string(7) ""water""
185  [1]=>
186  string(5) "fruit"
187}
188int(14)
189bool(false)
190
191-- Testing fgetcsv() with file opened using w+b mode --
192array(2) {
193  [0]=>
194  string(7) ""water""
195  [1]=>
196  string(5) "fruit"
197}
198int(14)
199bool(false)
200
201-- Testing fgetcsv() with file opened using w+t mode --
202array(2) {
203  [0]=>
204  string(7) ""water""
205  [1]=>
206  string(5) "fruit"
207}
208int(14)
209bool(false)
210
211-- Testing fgetcsv() with file opened using x+ mode --
212array(2) {
213  [0]=>
214  string(7) ""water""
215  [1]=>
216  string(5) "fruit"
217}
218int(14)
219bool(false)
220
221-- Testing fgetcsv() with file opened using x+b mode --
222array(2) {
223  [0]=>
224  string(7) ""water""
225  [1]=>
226  string(5) "fruit"
227}
228int(14)
229bool(false)
230
231-- Testing fgetcsv() with file opened using x+t mode --
232array(2) {
233  [0]=>
234  string(7) ""water""
235  [1]=>
236  string(5) "fruit"
237}
238int(14)
239bool(false)
240
241-- Testing fgetcsv() with file opened using r mode --
242array(2) {
243  [0]=>
244  string(7) ""water""
245  [1]=>
246  string(7) ""fruit""
247}
248int(16)
249bool(false)
250
251-- Testing fgetcsv() with file opened using rb mode --
252array(2) {
253  [0]=>
254  string(7) ""water""
255  [1]=>
256  string(7) ""fruit""
257}
258int(16)
259bool(false)
260
261-- Testing fgetcsv() with file opened using rt mode --
262array(2) {
263  [0]=>
264  string(7) ""water""
265  [1]=>
266  string(7) ""fruit""
267}
268int(16)
269bool(false)
270
271-- Testing fgetcsv() with file opened using r+ mode --
272array(2) {
273  [0]=>
274  string(7) ""water""
275  [1]=>
276  string(7) ""fruit""
277}
278int(16)
279bool(false)
280
281-- Testing fgetcsv() with file opened using r+b mode --
282array(2) {
283  [0]=>
284  string(7) ""water""
285  [1]=>
286  string(7) ""fruit""
287}
288int(16)
289bool(false)
290
291-- Testing fgetcsv() with file opened using r+t mode --
292array(2) {
293  [0]=>
294  string(7) ""water""
295  [1]=>
296  string(7) ""fruit""
297}
298int(16)
299bool(false)
300
301-- Testing fgetcsv() with file opened using a+ mode --
302array(2) {
303  [0]=>
304  string(7) ""water""
305  [1]=>
306  string(7) ""fruit""
307}
308int(16)
309bool(false)
310
311-- Testing fgetcsv() with file opened using a+b mode --
312array(2) {
313  [0]=>
314  string(7) ""water""
315  [1]=>
316  string(7) ""fruit""
317}
318int(16)
319bool(false)
320
321-- Testing fgetcsv() with file opened using a+t mode --
322array(2) {
323  [0]=>
324  string(7) ""water""
325  [1]=>
326  string(7) ""fruit""
327}
328int(16)
329bool(false)
330
331-- Testing fgetcsv() with file opened using w+ mode --
332array(2) {
333  [0]=>
334  string(7) ""water""
335  [1]=>
336  string(7) ""fruit""
337}
338int(16)
339bool(false)
340
341-- Testing fgetcsv() with file opened using w+b mode --
342array(2) {
343  [0]=>
344  string(7) ""water""
345  [1]=>
346  string(7) ""fruit""
347}
348int(16)
349bool(false)
350
351-- Testing fgetcsv() with file opened using w+t mode --
352array(2) {
353  [0]=>
354  string(7) ""water""
355  [1]=>
356  string(7) ""fruit""
357}
358int(16)
359bool(false)
360
361-- Testing fgetcsv() with file opened using x+ mode --
362array(2) {
363  [0]=>
364  string(7) ""water""
365  [1]=>
366  string(7) ""fruit""
367}
368int(16)
369bool(false)
370
371-- Testing fgetcsv() with file opened using x+b mode --
372array(2) {
373  [0]=>
374  string(7) ""water""
375  [1]=>
376  string(7) ""fruit""
377}
378int(16)
379bool(false)
380
381-- Testing fgetcsv() with file opened using x+t mode --
382array(2) {
383  [0]=>
384  string(7) ""water""
385  [1]=>
386  string(7) ""fruit""
387}
388int(16)
389bool(false)
390
391-- Testing fgetcsv() with file opened using r mode --
392array(2) {
393  [0]=>
394  string(7) "^water^"
395  [1]=>
396  string(7) "^fruit^"
397}
398int(16)
399bool(false)
400
401-- Testing fgetcsv() with file opened using rb mode --
402array(2) {
403  [0]=>
404  string(7) "^water^"
405  [1]=>
406  string(7) "^fruit^"
407}
408int(16)
409bool(false)
410
411-- Testing fgetcsv() with file opened using rt mode --
412array(2) {
413  [0]=>
414  string(7) "^water^"
415  [1]=>
416  string(7) "^fruit^"
417}
418int(16)
419bool(false)
420
421-- Testing fgetcsv() with file opened using r+ mode --
422array(2) {
423  [0]=>
424  string(7) "^water^"
425  [1]=>
426  string(7) "^fruit^"
427}
428int(16)
429bool(false)
430
431-- Testing fgetcsv() with file opened using r+b mode --
432array(2) {
433  [0]=>
434  string(7) "^water^"
435  [1]=>
436  string(7) "^fruit^"
437}
438int(16)
439bool(false)
440
441-- Testing fgetcsv() with file opened using r+t mode --
442array(2) {
443  [0]=>
444  string(7) "^water^"
445  [1]=>
446  string(7) "^fruit^"
447}
448int(16)
449bool(false)
450
451-- Testing fgetcsv() with file opened using a+ mode --
452array(2) {
453  [0]=>
454  string(7) "^water^"
455  [1]=>
456  string(7) "^fruit^"
457}
458int(16)
459bool(false)
460
461-- Testing fgetcsv() with file opened using a+b mode --
462array(2) {
463  [0]=>
464  string(7) "^water^"
465  [1]=>
466  string(7) "^fruit^"
467}
468int(16)
469bool(false)
470
471-- Testing fgetcsv() with file opened using a+t mode --
472array(2) {
473  [0]=>
474  string(7) "^water^"
475  [1]=>
476  string(7) "^fruit^"
477}
478int(16)
479bool(false)
480
481-- Testing fgetcsv() with file opened using w+ mode --
482array(2) {
483  [0]=>
484  string(7) "^water^"
485  [1]=>
486  string(7) "^fruit^"
487}
488int(16)
489bool(false)
490
491-- Testing fgetcsv() with file opened using w+b mode --
492array(2) {
493  [0]=>
494  string(7) "^water^"
495  [1]=>
496  string(7) "^fruit^"
497}
498int(16)
499bool(false)
500
501-- Testing fgetcsv() with file opened using w+t mode --
502array(2) {
503  [0]=>
504  string(7) "^water^"
505  [1]=>
506  string(7) "^fruit^"
507}
508int(16)
509bool(false)
510
511-- Testing fgetcsv() with file opened using x+ mode --
512array(2) {
513  [0]=>
514  string(7) "^water^"
515  [1]=>
516  string(7) "^fruit^"
517}
518int(16)
519bool(false)
520
521-- Testing fgetcsv() with file opened using x+b mode --
522array(2) {
523  [0]=>
524  string(7) "^water^"
525  [1]=>
526  string(7) "^fruit^"
527}
528int(16)
529bool(false)
530
531-- Testing fgetcsv() with file opened using x+t mode --
532array(2) {
533  [0]=>
534  string(7) "^water^"
535  [1]=>
536  string(7) "^fruit^"
537}
538int(16)
539bool(false)
540
541-- Testing fgetcsv() with file opened using r mode --
542array(2) {
543  [0]=>
544  string(7) "&water&"
545  [1]=>
546  string(7) "&fruit&"
547}
548int(16)
549bool(false)
550
551-- Testing fgetcsv() with file opened using rb mode --
552array(2) {
553  [0]=>
554  string(7) "&water&"
555  [1]=>
556  string(7) "&fruit&"
557}
558int(16)
559bool(false)
560
561-- Testing fgetcsv() with file opened using rt mode --
562array(2) {
563  [0]=>
564  string(7) "&water&"
565  [1]=>
566  string(7) "&fruit&"
567}
568int(16)
569bool(false)
570
571-- Testing fgetcsv() with file opened using r+ mode --
572array(2) {
573  [0]=>
574  string(7) "&water&"
575  [1]=>
576  string(7) "&fruit&"
577}
578int(16)
579bool(false)
580
581-- Testing fgetcsv() with file opened using r+b mode --
582array(2) {
583  [0]=>
584  string(7) "&water&"
585  [1]=>
586  string(7) "&fruit&"
587}
588int(16)
589bool(false)
590
591-- Testing fgetcsv() with file opened using r+t mode --
592array(2) {
593  [0]=>
594  string(7) "&water&"
595  [1]=>
596  string(7) "&fruit&"
597}
598int(16)
599bool(false)
600
601-- Testing fgetcsv() with file opened using a+ mode --
602array(2) {
603  [0]=>
604  string(7) "&water&"
605  [1]=>
606  string(7) "&fruit&"
607}
608int(16)
609bool(false)
610
611-- Testing fgetcsv() with file opened using a+b mode --
612array(2) {
613  [0]=>
614  string(7) "&water&"
615  [1]=>
616  string(7) "&fruit&"
617}
618int(16)
619bool(false)
620
621-- Testing fgetcsv() with file opened using a+t mode --
622array(2) {
623  [0]=>
624  string(7) "&water&"
625  [1]=>
626  string(7) "&fruit&"
627}
628int(16)
629bool(false)
630
631-- Testing fgetcsv() with file opened using w+ mode --
632array(2) {
633  [0]=>
634  string(7) "&water&"
635  [1]=>
636  string(7) "&fruit&"
637}
638int(16)
639bool(false)
640
641-- Testing fgetcsv() with file opened using w+b mode --
642array(2) {
643  [0]=>
644  string(7) "&water&"
645  [1]=>
646  string(7) "&fruit&"
647}
648int(16)
649bool(false)
650
651-- Testing fgetcsv() with file opened using w+t mode --
652array(2) {
653  [0]=>
654  string(7) "&water&"
655  [1]=>
656  string(7) "&fruit&"
657}
658int(16)
659bool(false)
660
661-- Testing fgetcsv() with file opened using x+ mode --
662array(2) {
663  [0]=>
664  string(7) "&water&"
665  [1]=>
666  string(7) "&fruit&"
667}
668int(16)
669bool(false)
670
671-- Testing fgetcsv() with file opened using x+b mode --
672array(2) {
673  [0]=>
674  string(7) "&water&"
675  [1]=>
676  string(7) "&fruit&"
677}
678int(16)
679bool(false)
680
681-- Testing fgetcsv() with file opened using x+t mode --
682array(2) {
683  [0]=>
684  string(7) "&water&"
685  [1]=>
686  string(7) "&fruit&"
687}
688int(16)
689bool(false)
690
691-- Testing fgetcsv() with file opened using r mode --
692array(6) {
693  [0]=>
694  string(0) ""
695  [1]=>
696  string(5) "water"
697  [2]=>
698  string(0) ""
699  [3]=>
700  string(0) ""
701  [4]=>
702  string(5) "fruit"
703  [5]=>
704  string(0) ""
705}
706int(16)
707bool(false)
708
709-- Testing fgetcsv() with file opened using rb mode --
710array(6) {
711  [0]=>
712  string(0) ""
713  [1]=>
714  string(5) "water"
715  [2]=>
716  string(0) ""
717  [3]=>
718  string(0) ""
719  [4]=>
720  string(5) "fruit"
721  [5]=>
722  string(0) ""
723}
724int(16)
725bool(false)
726
727-- Testing fgetcsv() with file opened using rt mode --
728array(6) {
729  [0]=>
730  string(0) ""
731  [1]=>
732  string(5) "water"
733  [2]=>
734  string(0) ""
735  [3]=>
736  string(0) ""
737  [4]=>
738  string(5) "fruit"
739  [5]=>
740  string(0) ""
741}
742int(16)
743bool(false)
744
745-- Testing fgetcsv() with file opened using r+ mode --
746array(6) {
747  [0]=>
748  string(0) ""
749  [1]=>
750  string(5) "water"
751  [2]=>
752  string(0) ""
753  [3]=>
754  string(0) ""
755  [4]=>
756  string(5) "fruit"
757  [5]=>
758  string(0) ""
759}
760int(16)
761bool(false)
762
763-- Testing fgetcsv() with file opened using r+b mode --
764array(6) {
765  [0]=>
766  string(0) ""
767  [1]=>
768  string(5) "water"
769  [2]=>
770  string(0) ""
771  [3]=>
772  string(0) ""
773  [4]=>
774  string(5) "fruit"
775  [5]=>
776  string(0) ""
777}
778int(16)
779bool(false)
780
781-- Testing fgetcsv() with file opened using r+t mode --
782array(6) {
783  [0]=>
784  string(0) ""
785  [1]=>
786  string(5) "water"
787  [2]=>
788  string(0) ""
789  [3]=>
790  string(0) ""
791  [4]=>
792  string(5) "fruit"
793  [5]=>
794  string(0) ""
795}
796int(16)
797bool(false)
798
799-- Testing fgetcsv() with file opened using a+ mode --
800array(6) {
801  [0]=>
802  string(0) ""
803  [1]=>
804  string(5) "water"
805  [2]=>
806  string(0) ""
807  [3]=>
808  string(0) ""
809  [4]=>
810  string(5) "fruit"
811  [5]=>
812  string(0) ""
813}
814int(16)
815bool(false)
816
817-- Testing fgetcsv() with file opened using a+b mode --
818array(6) {
819  [0]=>
820  string(0) ""
821  [1]=>
822  string(5) "water"
823  [2]=>
824  string(0) ""
825  [3]=>
826  string(0) ""
827  [4]=>
828  string(5) "fruit"
829  [5]=>
830  string(0) ""
831}
832int(16)
833bool(false)
834
835-- Testing fgetcsv() with file opened using a+t mode --
836array(6) {
837  [0]=>
838  string(0) ""
839  [1]=>
840  string(5) "water"
841  [2]=>
842  string(0) ""
843  [3]=>
844  string(0) ""
845  [4]=>
846  string(5) "fruit"
847  [5]=>
848  string(0) ""
849}
850int(16)
851bool(false)
852
853-- Testing fgetcsv() with file opened using w+ mode --
854array(6) {
855  [0]=>
856  string(0) ""
857  [1]=>
858  string(5) "water"
859  [2]=>
860  string(0) ""
861  [3]=>
862  string(0) ""
863  [4]=>
864  string(5) "fruit"
865  [5]=>
866  string(0) ""
867}
868int(16)
869bool(false)
870
871-- Testing fgetcsv() with file opened using w+b mode --
872array(6) {
873  [0]=>
874  string(0) ""
875  [1]=>
876  string(5) "water"
877  [2]=>
878  string(0) ""
879  [3]=>
880  string(0) ""
881  [4]=>
882  string(5) "fruit"
883  [5]=>
884  string(0) ""
885}
886int(16)
887bool(false)
888
889-- Testing fgetcsv() with file opened using w+t mode --
890array(6) {
891  [0]=>
892  string(0) ""
893  [1]=>
894  string(5) "water"
895  [2]=>
896  string(0) ""
897  [3]=>
898  string(0) ""
899  [4]=>
900  string(5) "fruit"
901  [5]=>
902  string(0) ""
903}
904int(16)
905bool(false)
906
907-- Testing fgetcsv() with file opened using x+ mode --
908array(6) {
909  [0]=>
910  string(0) ""
911  [1]=>
912  string(5) "water"
913  [2]=>
914  string(0) ""
915  [3]=>
916  string(0) ""
917  [4]=>
918  string(5) "fruit"
919  [5]=>
920  string(0) ""
921}
922int(16)
923bool(false)
924
925-- Testing fgetcsv() with file opened using x+b mode --
926array(6) {
927  [0]=>
928  string(0) ""
929  [1]=>
930  string(5) "water"
931  [2]=>
932  string(0) ""
933  [3]=>
934  string(0) ""
935  [4]=>
936  string(5) "fruit"
937  [5]=>
938  string(0) ""
939}
940int(16)
941bool(false)
942
943-- Testing fgetcsv() with file opened using x+t mode --
944array(6) {
945  [0]=>
946  string(0) ""
947  [1]=>
948  string(5) "water"
949  [2]=>
950  string(0) ""
951  [3]=>
952  string(0) ""
953  [4]=>
954  string(5) "fruit"
955  [5]=>
956  string(0) ""
957}
958int(16)
959bool(false)
960
961-- Testing fgetcsv() with file opened using r mode --
962array(5) {
963  [0]=>
964  string(0) ""
965  [1]=>
966  string(5) "water"
967  [2]=>
968  string(0) ""
969  [3]=>
970  string(5) "fruit"
971  [4]=>
972  string(3) "air"
973}
974int(18)
975bool(false)
976
977-- Testing fgetcsv() with file opened using rb mode --
978array(5) {
979  [0]=>
980  string(0) ""
981  [1]=>
982  string(5) "water"
983  [2]=>
984  string(0) ""
985  [3]=>
986  string(5) "fruit"
987  [4]=>
988  string(3) "air"
989}
990int(18)
991bool(false)
992
993-- Testing fgetcsv() with file opened using rt mode --
994array(5) {
995  [0]=>
996  string(0) ""
997  [1]=>
998  string(5) "water"
999  [2]=>
1000  string(0) ""
1001  [3]=>
1002  string(5) "fruit"
1003  [4]=>
1004  string(3) "air"
1005}
1006int(18)
1007bool(false)
1008
1009-- Testing fgetcsv() with file opened using r+ mode --
1010array(5) {
1011  [0]=>
1012  string(0) ""
1013  [1]=>
1014  string(5) "water"
1015  [2]=>
1016  string(0) ""
1017  [3]=>
1018  string(5) "fruit"
1019  [4]=>
1020  string(3) "air"
1021}
1022int(18)
1023bool(false)
1024
1025-- Testing fgetcsv() with file opened using r+b mode --
1026array(5) {
1027  [0]=>
1028  string(0) ""
1029  [1]=>
1030  string(5) "water"
1031  [2]=>
1032  string(0) ""
1033  [3]=>
1034  string(5) "fruit"
1035  [4]=>
1036  string(3) "air"
1037}
1038int(18)
1039bool(false)
1040
1041-- Testing fgetcsv() with file opened using r+t mode --
1042array(5) {
1043  [0]=>
1044  string(0) ""
1045  [1]=>
1046  string(5) "water"
1047  [2]=>
1048  string(0) ""
1049  [3]=>
1050  string(5) "fruit"
1051  [4]=>
1052  string(3) "air"
1053}
1054int(18)
1055bool(false)
1056
1057-- Testing fgetcsv() with file opened using a+ mode --
1058array(5) {
1059  [0]=>
1060  string(0) ""
1061  [1]=>
1062  string(5) "water"
1063  [2]=>
1064  string(0) ""
1065  [3]=>
1066  string(5) "fruit"
1067  [4]=>
1068  string(3) "air"
1069}
1070int(18)
1071bool(false)
1072
1073-- Testing fgetcsv() with file opened using a+b mode --
1074array(5) {
1075  [0]=>
1076  string(0) ""
1077  [1]=>
1078  string(5) "water"
1079  [2]=>
1080  string(0) ""
1081  [3]=>
1082  string(5) "fruit"
1083  [4]=>
1084  string(3) "air"
1085}
1086int(18)
1087bool(false)
1088
1089-- Testing fgetcsv() with file opened using a+t mode --
1090array(5) {
1091  [0]=>
1092  string(0) ""
1093  [1]=>
1094  string(5) "water"
1095  [2]=>
1096  string(0) ""
1097  [3]=>
1098  string(5) "fruit"
1099  [4]=>
1100  string(3) "air"
1101}
1102int(18)
1103bool(false)
1104
1105-- Testing fgetcsv() with file opened using w+ mode --
1106array(5) {
1107  [0]=>
1108  string(0) ""
1109  [1]=>
1110  string(5) "water"
1111  [2]=>
1112  string(0) ""
1113  [3]=>
1114  string(5) "fruit"
1115  [4]=>
1116  string(3) "air"
1117}
1118int(18)
1119bool(false)
1120
1121-- Testing fgetcsv() with file opened using w+b mode --
1122array(5) {
1123  [0]=>
1124  string(0) ""
1125  [1]=>
1126  string(5) "water"
1127  [2]=>
1128  string(0) ""
1129  [3]=>
1130  string(5) "fruit"
1131  [4]=>
1132  string(3) "air"
1133}
1134int(18)
1135bool(false)
1136
1137-- Testing fgetcsv() with file opened using w+t mode --
1138array(5) {
1139  [0]=>
1140  string(0) ""
1141  [1]=>
1142  string(5) "water"
1143  [2]=>
1144  string(0) ""
1145  [3]=>
1146  string(5) "fruit"
1147  [4]=>
1148  string(3) "air"
1149}
1150int(18)
1151bool(false)
1152
1153-- Testing fgetcsv() with file opened using x+ mode --
1154array(5) {
1155  [0]=>
1156  string(0) ""
1157  [1]=>
1158  string(5) "water"
1159  [2]=>
1160  string(0) ""
1161  [3]=>
1162  string(5) "fruit"
1163  [4]=>
1164  string(3) "air"
1165}
1166int(18)
1167bool(false)
1168
1169-- Testing fgetcsv() with file opened using x+b mode --
1170array(5) {
1171  [0]=>
1172  string(0) ""
1173  [1]=>
1174  string(5) "water"
1175  [2]=>
1176  string(0) ""
1177  [3]=>
1178  string(5) "fruit"
1179  [4]=>
1180  string(3) "air"
1181}
1182int(18)
1183bool(false)
1184
1185-- Testing fgetcsv() with file opened using x+t mode --
1186array(5) {
1187  [0]=>
1188  string(0) ""
1189  [1]=>
1190  string(5) "water"
1191  [2]=>
1192  string(0) ""
1193  [3]=>
1194  string(5) "fruit"
1195  [4]=>
1196  string(3) "air"
1197}
1198int(18)
1199bool(false)
1200
1201-- Testing fgetcsv() with file opened using r mode --
1202array(9) {
1203  [0]=>
1204  string(0) ""
1205  [1]=>
1206  string(5) "water"
1207  [2]=>
1208  string(0) ""
1209  [3]=>
1210  string(0) ""
1211  [4]=>
1212  string(5) "fruit"
1213  [5]=>
1214  string(0) ""
1215  [6]=>
1216  string(0) ""
1217  [7]=>
1218  string(3) "air"
1219  [8]=>
1220  string(0) ""
1221}
1222int(22)
1223bool(false)
1224
1225-- Testing fgetcsv() with file opened using rb mode --
1226array(9) {
1227  [0]=>
1228  string(0) ""
1229  [1]=>
1230  string(5) "water"
1231  [2]=>
1232  string(0) ""
1233  [3]=>
1234  string(0) ""
1235  [4]=>
1236  string(5) "fruit"
1237  [5]=>
1238  string(0) ""
1239  [6]=>
1240  string(0) ""
1241  [7]=>
1242  string(3) "air"
1243  [8]=>
1244  string(0) ""
1245}
1246int(22)
1247bool(false)
1248
1249-- Testing fgetcsv() with file opened using rt mode --
1250array(9) {
1251  [0]=>
1252  string(0) ""
1253  [1]=>
1254  string(5) "water"
1255  [2]=>
1256  string(0) ""
1257  [3]=>
1258  string(0) ""
1259  [4]=>
1260  string(5) "fruit"
1261  [5]=>
1262  string(0) ""
1263  [6]=>
1264  string(0) ""
1265  [7]=>
1266  string(3) "air"
1267  [8]=>
1268  string(0) ""
1269}
1270int(22)
1271bool(false)
1272
1273-- Testing fgetcsv() with file opened using r+ mode --
1274array(9) {
1275  [0]=>
1276  string(0) ""
1277  [1]=>
1278  string(5) "water"
1279  [2]=>
1280  string(0) ""
1281  [3]=>
1282  string(0) ""
1283  [4]=>
1284  string(5) "fruit"
1285  [5]=>
1286  string(0) ""
1287  [6]=>
1288  string(0) ""
1289  [7]=>
1290  string(3) "air"
1291  [8]=>
1292  string(0) ""
1293}
1294int(22)
1295bool(false)
1296
1297-- Testing fgetcsv() with file opened using r+b mode --
1298array(9) {
1299  [0]=>
1300  string(0) ""
1301  [1]=>
1302  string(5) "water"
1303  [2]=>
1304  string(0) ""
1305  [3]=>
1306  string(0) ""
1307  [4]=>
1308  string(5) "fruit"
1309  [5]=>
1310  string(0) ""
1311  [6]=>
1312  string(0) ""
1313  [7]=>
1314  string(3) "air"
1315  [8]=>
1316  string(0) ""
1317}
1318int(22)
1319bool(false)
1320
1321-- Testing fgetcsv() with file opened using r+t mode --
1322array(9) {
1323  [0]=>
1324  string(0) ""
1325  [1]=>
1326  string(5) "water"
1327  [2]=>
1328  string(0) ""
1329  [3]=>
1330  string(0) ""
1331  [4]=>
1332  string(5) "fruit"
1333  [5]=>
1334  string(0) ""
1335  [6]=>
1336  string(0) ""
1337  [7]=>
1338  string(3) "air"
1339  [8]=>
1340  string(0) ""
1341}
1342int(22)
1343bool(false)
1344
1345-- Testing fgetcsv() with file opened using a+ mode --
1346array(9) {
1347  [0]=>
1348  string(0) ""
1349  [1]=>
1350  string(5) "water"
1351  [2]=>
1352  string(0) ""
1353  [3]=>
1354  string(0) ""
1355  [4]=>
1356  string(5) "fruit"
1357  [5]=>
1358  string(0) ""
1359  [6]=>
1360  string(0) ""
1361  [7]=>
1362  string(3) "air"
1363  [8]=>
1364  string(0) ""
1365}
1366int(22)
1367bool(false)
1368
1369-- Testing fgetcsv() with file opened using a+b mode --
1370array(9) {
1371  [0]=>
1372  string(0) ""
1373  [1]=>
1374  string(5) "water"
1375  [2]=>
1376  string(0) ""
1377  [3]=>
1378  string(0) ""
1379  [4]=>
1380  string(5) "fruit"
1381  [5]=>
1382  string(0) ""
1383  [6]=>
1384  string(0) ""
1385  [7]=>
1386  string(3) "air"
1387  [8]=>
1388  string(0) ""
1389}
1390int(22)
1391bool(false)
1392
1393-- Testing fgetcsv() with file opened using a+t mode --
1394array(9) {
1395  [0]=>
1396  string(0) ""
1397  [1]=>
1398  string(5) "water"
1399  [2]=>
1400  string(0) ""
1401  [3]=>
1402  string(0) ""
1403  [4]=>
1404  string(5) "fruit"
1405  [5]=>
1406  string(0) ""
1407  [6]=>
1408  string(0) ""
1409  [7]=>
1410  string(3) "air"
1411  [8]=>
1412  string(0) ""
1413}
1414int(22)
1415bool(false)
1416
1417-- Testing fgetcsv() with file opened using w+ mode --
1418array(9) {
1419  [0]=>
1420  string(0) ""
1421  [1]=>
1422  string(5) "water"
1423  [2]=>
1424  string(0) ""
1425  [3]=>
1426  string(0) ""
1427  [4]=>
1428  string(5) "fruit"
1429  [5]=>
1430  string(0) ""
1431  [6]=>
1432  string(0) ""
1433  [7]=>
1434  string(3) "air"
1435  [8]=>
1436  string(0) ""
1437}
1438int(22)
1439bool(false)
1440
1441-- Testing fgetcsv() with file opened using w+b mode --
1442array(9) {
1443  [0]=>
1444  string(0) ""
1445  [1]=>
1446  string(5) "water"
1447  [2]=>
1448  string(0) ""
1449  [3]=>
1450  string(0) ""
1451  [4]=>
1452  string(5) "fruit"
1453  [5]=>
1454  string(0) ""
1455  [6]=>
1456  string(0) ""
1457  [7]=>
1458  string(3) "air"
1459  [8]=>
1460  string(0) ""
1461}
1462int(22)
1463bool(false)
1464
1465-- Testing fgetcsv() with file opened using w+t mode --
1466array(9) {
1467  [0]=>
1468  string(0) ""
1469  [1]=>
1470  string(5) "water"
1471  [2]=>
1472  string(0) ""
1473  [3]=>
1474  string(0) ""
1475  [4]=>
1476  string(5) "fruit"
1477  [5]=>
1478  string(0) ""
1479  [6]=>
1480  string(0) ""
1481  [7]=>
1482  string(3) "air"
1483  [8]=>
1484  string(0) ""
1485}
1486int(22)
1487bool(false)
1488
1489-- Testing fgetcsv() with file opened using x+ mode --
1490array(9) {
1491  [0]=>
1492  string(0) ""
1493  [1]=>
1494  string(5) "water"
1495  [2]=>
1496  string(0) ""
1497  [3]=>
1498  string(0) ""
1499  [4]=>
1500  string(5) "fruit"
1501  [5]=>
1502  string(0) ""
1503  [6]=>
1504  string(0) ""
1505  [7]=>
1506  string(3) "air"
1507  [8]=>
1508  string(0) ""
1509}
1510int(22)
1511bool(false)
1512
1513-- Testing fgetcsv() with file opened using x+b mode --
1514array(9) {
1515  [0]=>
1516  string(0) ""
1517  [1]=>
1518  string(5) "water"
1519  [2]=>
1520  string(0) ""
1521  [3]=>
1522  string(0) ""
1523  [4]=>
1524  string(5) "fruit"
1525  [5]=>
1526  string(0) ""
1527  [6]=>
1528  string(0) ""
1529  [7]=>
1530  string(3) "air"
1531  [8]=>
1532  string(0) ""
1533}
1534int(22)
1535bool(false)
1536
1537-- Testing fgetcsv() with file opened using x+t mode --
1538array(9) {
1539  [0]=>
1540  string(0) ""
1541  [1]=>
1542  string(5) "water"
1543  [2]=>
1544  string(0) ""
1545  [3]=>
1546  string(0) ""
1547  [4]=>
1548  string(5) "fruit"
1549  [5]=>
1550  string(0) ""
1551  [6]=>
1552  string(0) ""
1553  [7]=>
1554  string(3) "air"
1555  [8]=>
1556  string(0) ""
1557}
1558int(22)
1559bool(false)
1560
1561-- Testing fgetcsv() with file opened using r mode --
1562array(6) {
1563  [0]=>
1564  string(6) "&""""&"
1565  [1]=>
1566  string(3) "&"&"
1567  [2]=>
1568  string(1) ","
1569  [3]=>
1570  string(1) """
1571  [4]=>
1572  string(3) "&,&"
1573  [5]=>
1574  string(4) ",,,,"
1575}
1576int(24)
1577bool(false)
1578
1579-- Testing fgetcsv() with file opened using rb mode --
1580array(6) {
1581  [0]=>
1582  string(6) "&""""&"
1583  [1]=>
1584  string(3) "&"&"
1585  [2]=>
1586  string(1) ","
1587  [3]=>
1588  string(1) """
1589  [4]=>
1590  string(3) "&,&"
1591  [5]=>
1592  string(4) ",,,,"
1593}
1594int(24)
1595bool(false)
1596
1597-- Testing fgetcsv() with file opened using rt mode --
1598array(6) {
1599  [0]=>
1600  string(6) "&""""&"
1601  [1]=>
1602  string(3) "&"&"
1603  [2]=>
1604  string(1) ","
1605  [3]=>
1606  string(1) """
1607  [4]=>
1608  string(3) "&,&"
1609  [5]=>
1610  string(4) ",,,,"
1611}
1612int(24)
1613bool(false)
1614
1615-- Testing fgetcsv() with file opened using r+ mode --
1616array(6) {
1617  [0]=>
1618  string(6) "&""""&"
1619  [1]=>
1620  string(3) "&"&"
1621  [2]=>
1622  string(1) ","
1623  [3]=>
1624  string(1) """
1625  [4]=>
1626  string(3) "&,&"
1627  [5]=>
1628  string(4) ",,,,"
1629}
1630int(24)
1631bool(false)
1632
1633-- Testing fgetcsv() with file opened using r+b mode --
1634array(6) {
1635  [0]=>
1636  string(6) "&""""&"
1637  [1]=>
1638  string(3) "&"&"
1639  [2]=>
1640  string(1) ","
1641  [3]=>
1642  string(1) """
1643  [4]=>
1644  string(3) "&,&"
1645  [5]=>
1646  string(4) ",,,,"
1647}
1648int(24)
1649bool(false)
1650
1651-- Testing fgetcsv() with file opened using r+t mode --
1652array(6) {
1653  [0]=>
1654  string(6) "&""""&"
1655  [1]=>
1656  string(3) "&"&"
1657  [2]=>
1658  string(1) ","
1659  [3]=>
1660  string(1) """
1661  [4]=>
1662  string(3) "&,&"
1663  [5]=>
1664  string(4) ",,,,"
1665}
1666int(24)
1667bool(false)
1668
1669-- Testing fgetcsv() with file opened using a+ mode --
1670array(6) {
1671  [0]=>
1672  string(6) "&""""&"
1673  [1]=>
1674  string(3) "&"&"
1675  [2]=>
1676  string(1) ","
1677  [3]=>
1678  string(1) """
1679  [4]=>
1680  string(3) "&,&"
1681  [5]=>
1682  string(4) ",,,,"
1683}
1684int(24)
1685bool(false)
1686
1687-- Testing fgetcsv() with file opened using a+b mode --
1688array(6) {
1689  [0]=>
1690  string(6) "&""""&"
1691  [1]=>
1692  string(3) "&"&"
1693  [2]=>
1694  string(1) ","
1695  [3]=>
1696  string(1) """
1697  [4]=>
1698  string(3) "&,&"
1699  [5]=>
1700  string(4) ",,,,"
1701}
1702int(24)
1703bool(false)
1704
1705-- Testing fgetcsv() with file opened using a+t mode --
1706array(6) {
1707  [0]=>
1708  string(6) "&""""&"
1709  [1]=>
1710  string(3) "&"&"
1711  [2]=>
1712  string(1) ","
1713  [3]=>
1714  string(1) """
1715  [4]=>
1716  string(3) "&,&"
1717  [5]=>
1718  string(4) ",,,,"
1719}
1720int(24)
1721bool(false)
1722
1723-- Testing fgetcsv() with file opened using w+ mode --
1724array(6) {
1725  [0]=>
1726  string(6) "&""""&"
1727  [1]=>
1728  string(3) "&"&"
1729  [2]=>
1730  string(1) ","
1731  [3]=>
1732  string(1) """
1733  [4]=>
1734  string(3) "&,&"
1735  [5]=>
1736  string(4) ",,,,"
1737}
1738int(24)
1739bool(false)
1740
1741-- Testing fgetcsv() with file opened using w+b mode --
1742array(6) {
1743  [0]=>
1744  string(6) "&""""&"
1745  [1]=>
1746  string(3) "&"&"
1747  [2]=>
1748  string(1) ","
1749  [3]=>
1750  string(1) """
1751  [4]=>
1752  string(3) "&,&"
1753  [5]=>
1754  string(4) ",,,,"
1755}
1756int(24)
1757bool(false)
1758
1759-- Testing fgetcsv() with file opened using w+t mode --
1760array(6) {
1761  [0]=>
1762  string(6) "&""""&"
1763  [1]=>
1764  string(3) "&"&"
1765  [2]=>
1766  string(1) ","
1767  [3]=>
1768  string(1) """
1769  [4]=>
1770  string(3) "&,&"
1771  [5]=>
1772  string(4) ",,,,"
1773}
1774int(24)
1775bool(false)
1776
1777-- Testing fgetcsv() with file opened using x+ mode --
1778array(6) {
1779  [0]=>
1780  string(6) "&""""&"
1781  [1]=>
1782  string(3) "&"&"
1783  [2]=>
1784  string(1) ","
1785  [3]=>
1786  string(1) """
1787  [4]=>
1788  string(3) "&,&"
1789  [5]=>
1790  string(4) ",,,,"
1791}
1792int(24)
1793bool(false)
1794
1795-- Testing fgetcsv() with file opened using x+b mode --
1796array(6) {
1797  [0]=>
1798  string(6) "&""""&"
1799  [1]=>
1800  string(3) "&"&"
1801  [2]=>
1802  string(1) ","
1803  [3]=>
1804  string(1) """
1805  [4]=>
1806  string(3) "&,&"
1807  [5]=>
1808  string(4) ",,,,"
1809}
1810int(24)
1811bool(false)
1812
1813-- Testing fgetcsv() with file opened using x+t mode --
1814array(6) {
1815  [0]=>
1816  string(6) "&""""&"
1817  [1]=>
1818  string(3) "&"&"
1819  [2]=>
1820  string(1) ","
1821  [3]=>
1822  string(1) """
1823  [4]=>
1824  string(3) "&,&"
1825  [5]=>
1826  string(4) ",,,,"
1827}
1828int(24)
1829bool(false)
1830Done
1831