Skip to content

Commit

Permalink
Merge pull request #13 from emirajbbd/master
Browse files Browse the repository at this point in the history
Fixed PHP Error: A non-numeric value encountered Issue
  • Loading branch information
mdeboer authored Sep 19, 2019
2 parents c3b9e20 + a2f7fac commit 41f9d0f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Packer.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,9 @@ public function _get_volume($box)
throw new \InvalidArgumentException("_get_volume function only accepts arrays with 3 values (length, width, height)");
}

$box = array_values($box);

return $box[0] * $box[1] * $box[2];
$box = array_filter($box, 'strlen');
return (isset($box['length'])?$box['length']:$box[0]) * (isset($box['width'])?$box['width']:$box[1]) * (isset($box['height'])?$box['height']:$box[2]);;
}

/**
Expand Down Expand Up @@ -554,4 +554,4 @@ private function _fill_space($space)
}
}
}
}
}

0 comments on commit 41f9d0f

Please sign in to comment.