Robert
Robert

Reputation: 812

Warning: Division by zero in PHP on line 162

I have this error on my site:

ERR (3): Warning: Division by zero in public_html/app/code/community/VES/PdfProProcessor/Pdf/include/table_frame_reflower.cls.php on line 162

at that line I have the following code:

  $increment = 0;

  // Case 1:
  if ( $absolute_used == 0 && $percent_used == 0 ) {
    $increment = $width - $min_width;

    foreach (array_keys($columns) as $i) {
      $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment * ($columns[$i]["max-width"] / $max_width));
    }
    return;
  }

how I can solve this error?

Upvotes: 0

Views: 900

Answers (2)

doriclazar
doriclazar

Reputation: 97

Your $max_width variable is either not assigned, or holds the value of zero. If that does not appear to be the case, try echoing this variable's value inside your if statement.

Upvotes: 1

Jacky Supit
Jacky Supit

Reputation: 567

try this

  $increment = 0;
  $max_width or $max_width=1;

  // Case 1:
  if ( $absolute_used == 0 && $percent_used == 0 ) {
    $increment = $width - $min_width;

    foreach (array_keys($columns) as $i) {
      $cellmap->set_column_width($i, $columns[$i]["min-width"] + $increment * ($columns[$i]["max-width"] / $max_width));
    }
    return;
  }

Upvotes: 1

Related Questions