Prevent duplicate no fills (#1086)

* Merge branch 'master' of C:\Projects\PHPOffice\PHPSpreadsheet\develop with conflicts.

* Ignore colours for hash generation when fill style in NONE

* Update changelog
This commit is contained in:
Mark Baker 2019-07-16 11:00:00 +02:00 committed by GitHub
parent 987147e916
commit 5f7ed98aa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
### Fixed ### Fixed
- Eliminate duplicate fill none style entries [Issue #1066](https://github.com/PHPOffice/PhpSpreadsheet/issues/1066)
- Fix number format masks containing literal (non-decimal point) dots [Issue #1079](https://github.com/PHPOffice/PhpSpreadsheet/issues/1079) - Fix number format masks containing literal (non-decimal point) dots [Issue #1079](https://github.com/PHPOffice/PhpSpreadsheet/issues/1079)
- Fix number format masks containing named colours that were being misinterpreted as date formats; and add support for masks that fully replace the value with a full text string [Issue #1009](https://github.com/PHPOffice/PhpSpreadsheet/issues/1009) - Fix number format masks containing named colours that were being misinterpreted as date formats; and add support for masks that fully replace the value with a full text string [Issue #1009](https://github.com/PHPOffice/PhpSpreadsheet/issues/1009)
- Stricter-typed comparison testing in COUNTIF() and COUNTIFS() evaluation [Issue #1046](https://github.com/PHPOffice/PhpSpreadsheet/issues/1046) - Stricter-typed comparison testing in COUNTIF() and COUNTIFS() evaluation [Issue #1046](https://github.com/PHPOffice/PhpSpreadsheet/issues/1046)

View File

@ -313,12 +313,13 @@ class Fill extends Supervisor
if ($this->isSupervisor) { if ($this->isSupervisor) {
return $this->getSharedComponent()->getHashCode(); return $this->getSharedComponent()->getHashCode();
} }
// Note that we don't care about colours for fill type NONE, but could have duplicate NONEs with
// different hashes if we don't explicitly prevent this
return md5( return md5(
$this->getFillType() . $this->getFillType() .
$this->getRotation() . $this->getRotation() .
$this->getStartColor()->getHashCode() . ($this->getFillType() !== self::FILL_NONE ? $this->getStartColor()->getHashCode() : '') .
$this->getEndColor()->getHashCode() . ($this->getFillType() !== self::FILL_NONE ? $this->getEndColor()->getHashCode() : '') .
__CLASS__ __CLASS__
); );
} }