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
*/
private $operator = '';
private $operator = self::OPERATOR_BETWEEN;
/**
* Allow Blank.

View File

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