Skip to content

Commit

Permalink
fix while loop
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Jan 10, 2018
1 parent fd2b830 commit 4ffff15
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions includes/import/class-wc-product-csv-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,17 @@ protected function read_file() {
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;
}
}
Expand Down

0 comments on commit 4ffff15

Please sign in to comment.