Error style of data validation was incorrectly written to Xls

We use to write the wrong property to file, leading to a warning
in PHP 7.1 since the `switch` never matched anything and the variable
was left as a string instead of as an int.

Closes https://github.com/PHPOffice/PHPExcel/issues/1110
This commit is contained in:
Adrien Crivelli 2017-04-12 12:40:28 +09:00
parent 714dc29890
commit c2b38b0ee0
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
2 changed files with 2 additions and 5 deletions

View File

@ -84,7 +84,7 @@ class DataValidation
* *
* @var string * @var string
*/ */
private $operator = ''; private $operator = self::OPERATOR_BETWEEN;
/** /**
* Allow Blank. * Allow Blank.

View File

@ -2838,11 +2838,10 @@ class Worksheet extends BIFFwriter
break; break;
} }
$type = (int) $type;
$options |= $type << 0; $options |= $type << 0;
// error style // error style
$errorStyle = $dataValidation->getType(); $errorStyle = $dataValidation->getErrorStyle();
switch ($errorStyle) { switch ($errorStyle) {
case \PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_STOP: case \PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_STOP:
$errorStyle = 0x00; $errorStyle = 0x00;
@ -2855,7 +2854,6 @@ class Worksheet extends BIFFwriter
break; break;
} }
$errorStyle = (int) $errorStyle;
$options |= $errorStyle << 4; $options |= $errorStyle << 4;
// explicit formula? // explicit formula?
@ -2904,7 +2902,6 @@ class Worksheet extends BIFFwriter
break; break;
} }
$operator = (int) $operator;
$options |= $operator << 20; $options |= $operator << 20;
$data = pack('V', $options); $data = pack('V', $options);