--TEST-- Various fgetcsv() error conditions --FILE-- getMessage() . \PHP_EOL; } try { var_dump( fgetcsv($file_handle, -10, $delimiter) ); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } try { var_dump( fgetcsv($file_handle, -10, $delimiter, $enclosure) ); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } echo 'fgetcsv() with delimiter as empty string' . \PHP_EOL; try { var_dump( fgetcsv($file_handle, $length, '', $enclosure) ); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } echo 'fgetcsv() with enclosure as empty string' . \PHP_EOL; try { var_dump( fgetcsv($file_handle, $length, $delimiter, '') ); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } echo 'fgetcsv() with delimiter & enclosure as empty string' . \PHP_EOL; try { var_dump( fgetcsv($file_handle, $length, '', '') ); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } ?> --EXPECTF-- fgetcsv() with negative length fgetcsv(): Argument #2 ($length) must be between 0 and %d fgetcsv(): Argument #2 ($length) must be between 0 and %d fgetcsv(): Argument #2 ($length) must be between 0 and %d fgetcsv() with delimiter as empty string fgetcsv(): Argument #3 ($separator) must be a single character fgetcsv() with enclosure as empty string fgetcsv(): Argument #4 ($enclosure) must be a single character fgetcsv() with delimiter & enclosure as empty string fgetcsv(): Argument #3 ($separator) must be a single character