1--TEST-- 2Test fgetcsv() : usage variations - empty file 3--FILE-- 4<?php 5/* Testing fgetcsv() to read from an empty file */ 6 7echo "*** Testing fgetcsv() : reading from file which is having zero content ***\n"; 8 9// try reading from file which is having zero content 10// create the file and then open in read mode and try reading 11$filename = __DIR__ . '/fgetcsv_variation23.tmp'; 12$fp = fopen ($filename, "w"); 13fclose($fp); 14$fp = fopen ($filename, "r"); 15if (!$fp) { 16 echo "Error: failed to create file $filename!\n"; 17 exit(); 18} 19var_dump( fgetcsv($fp, escape: "\\") ); 20var_dump( ftell($fp) ); 21var_dump( fgetcsv($fp, 1024, escape: "\\") ); 22var_dump( ftell($fp) ); 23var_dump( fgetcsv($fp, 1024, "+", escape: "\\" ) ); 24var_dump( ftell($fp) ); 25var_dump( fgetcsv($fp, 1024, "+", "%", escape: "\\") ); 26var_dump( ftell($fp) ); 27 28// close and delete the file 29fclose($fp); 30unlink($filename); 31echo "Done\n"; 32?> 33--EXPECT-- 34*** Testing fgetcsv() : reading from file which is having zero content *** 35bool(false) 36int(0) 37bool(false) 38int(0) 39bool(false) 40int(0) 41bool(false) 42int(0) 43Done 44