From 38ff5a49f86f0b523e10f7499f7d3245590f48c6 Mon Sep 17 00:00:00 2001 From: matteofilippetto Date: Tue, 22 Jul 2014 17:40:31 +0200 Subject: [PATCH] again division by zero $this->_width and $this->_height are defined as float so !== will return TRUE also if the value is 0 ( as !== use OR ) --- Classes/PHPExcel/Worksheet/BaseDrawing.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Classes/PHPExcel/Worksheet/BaseDrawing.php b/Classes/PHPExcel/Worksheet/BaseDrawing.php index 77b0b39..5a760fc 100644 --- a/Classes/PHPExcel/Worksheet/BaseDrawing.php +++ b/Classes/PHPExcel/Worksheet/BaseDrawing.php @@ -321,7 +321,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable public function setWidth($pValue = 0) { // Resize proportional? if ($this->_resizeProportional && $pValue != 0) { - $ratio = $this->_height / ($this->_width !== 0 ? $this->_width : 1); + $ratio = $this->_height / ($this->_width != 0 ? $this->_width : 1); $this->_height = round($ratio * $pValue); } @@ -349,7 +349,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable public function setHeight($pValue = 0) { // Resize proportional? if ($this->_resizeProportional && $pValue != 0) { - $ratio = $this->_width / ($this->_height !== 0 ? $this->_height : 1); + $ratio = $this->_width / ($this->_height != 0 ? $this->_height : 1); $this->_width = round($ratio * $pValue); } @@ -373,8 +373,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable * @return PHPExcel_Worksheet_BaseDrawing */ public function setWidthAndHeight($width = 0, $height = 0) { - $xratio = $width / ($this->_width !== 0 ? $this->_width : 1); - $yratio = $height / ($this->_height !== 0 ? $this->_height : 1); + $xratio = $width / ($this->_width != 0 ? $this->_width : 1); + $yratio = $height / ($this->_height != 0 ? $this->_height : 1); if ($this->_resizeProportional && !($width == 0 || $height == 0)) { if (($xratio * $this->_height) < $height) { $this->_height = ceil($xratio * $this->_height);