fix while loop

This commit is contained in:
Mike Jolley 2018-01-10 17:28:26 +00:00
parent fd2b830a9f
commit 4ffff150b5
1 changed files with 9 additions and 5 deletions

View File

@ -69,13 +69,17 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
fseek( $handle, (int) $this->params['start_pos'] );
}
$row = fgetcsv( $handle, 0, $this->params['delimiter'], $this->params['enclosure'] );
while ( 1 ) {
$row = fgetcsv( $handle, 0, $this->params['delimiter'], $this->params['enclosure'] );
while ( false !== $row ) {
$this->raw_data[] = $row;
$this->file_positions[ count( $this->raw_data ) ] = ftell( $handle );
if ( false !== $row ) {
$this->raw_data[] = $row;
$this->file_positions[ count( $this->raw_data ) ] = ftell( $handle );
if ( ( $this->params['end_pos'] > 0 && ftell( $handle ) >= $this->params['end_pos'] ) || 0 === --$this->params['lines'] ) {
if ( ( $this->params['end_pos'] > 0 && ftell( $handle ) >= $this->params['end_pos'] ) || 0 === --$this->params['lines'] ) {
break;
}
} else {
break;
}
}