diff --git a/CHANGELOG.md b/CHANGELOG.md index 11533e00..12732fa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Can read very small HTML files - [#194](https://github.com/PHPOffice/PhpSpreadsheet/issues/194) +- Written DataValidation was corrupted - [#290](https://github.com/PHPOffice/PhpSpreadsheet/issues/290) ### BREAKING CHANGE diff --git a/src/PhpSpreadsheet/Cell/DataValidation.php b/src/PhpSpreadsheet/Cell/DataValidation.php index 216383a4..a041ea0e 100644 --- a/src/PhpSpreadsheet/Cell/DataValidation.php +++ b/src/PhpSpreadsheet/Cell/DataValidation.php @@ -449,8 +449,8 @@ class DataValidation return md5( $this->formula1 . $this->formula2 . - $this->type = self::TYPE_NONE . - $this->errorStyle = self::STYLE_STOP . + $this->type . + $this->errorStyle . $this->operator . ($this->allowBlank ? 't' : 'f') . ($this->showDropDown ? 't' : 'f') . diff --git a/tests/PhpSpreadsheetTests/Cell/DataValidationTest.php b/tests/PhpSpreadsheetTests/Cell/DataValidationTest.php new file mode 100644 index 00000000..c41c0335 --- /dev/null +++ b/tests/PhpSpreadsheetTests/Cell/DataValidationTest.php @@ -0,0 +1,19 @@ +getHashCode()); + $dataValidation->setType(DataValidation::TYPE_CUSTOM); + + self::assertSame('778f6c9e0ffcd5eaa7d8e1432d67f919', $dataValidation->getHashCode()); + self::assertSame('778f6c9e0ffcd5eaa7d8e1432d67f919', $dataValidation->getHashCode(), 'getHashCode() should not have side effect'); + } +}