From 47d1b81b0ebaed92ee4e794e528eb7df12179d1e Mon Sep 17 00:00:00 2001 From: gggeek Date: Sat, 15 Dec 2018 15:26:00 +0100 Subject: [PATCH] Fix: creating migrations for Content creation or update with contents which have empty Image/File/Media fields would crash; proper fix for warnings introduced with 5.7 --- Core/FieldHandler/EzImage.php | 4 ++++ Core/FieldHandler/EzMedia.php | 4 ++++ Core/Matcher/AbstractMatcher.php | 2 +- WHATSNEW.md | 16 +++++++++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Core/FieldHandler/EzImage.php b/Core/FieldHandler/EzImage.php index 2224b4aa..f72d5e01 100644 --- a/Core/FieldHandler/EzImage.php +++ b/Core/FieldHandler/EzImage.php @@ -60,6 +60,10 @@ public function hashToFieldValue($fieldValue, array $context = array()) */ public function fieldValueToHash($fieldValue, array $context = array()) { + if ($fieldValue->uri == null) { + return null; + } + return array( 'path' => realpath($this->ioRootDir) . '/' . ($this->ioDecorator ? $this->ioDecorator->undecorate($fieldValue->uri) : $fieldValue->uri), 'filename'=> $fieldValue->fileName, diff --git a/Core/FieldHandler/EzMedia.php b/Core/FieldHandler/EzMedia.php index 2ae2281c..1b582e3a 100644 --- a/Core/FieldHandler/EzMedia.php +++ b/Core/FieldHandler/EzMedia.php @@ -100,6 +100,10 @@ public function hashToFieldValue($fieldValue, array $context = array()) */ public function fieldValueToHash($fieldValue, array $context = array()) { + if ($fieldValue->uri == null) { + return null; + } + return array( 'path' => realpath($this->ioRootDir) . '/' . ($this->ioDecorator ? $this->ioDecorator->undecorate($fieldValue->uri) : $fieldValue->uri), 'filename'=> $fieldValue->fileName, diff --git a/Core/Matcher/AbstractMatcher.php b/Core/Matcher/AbstractMatcher.php index 6e2dc641..c3fc4ab5 100644 --- a/Core/Matcher/AbstractMatcher.php +++ b/Core/Matcher/AbstractMatcher.php @@ -61,7 +61,7 @@ protected function matchAnd($conditionsArray) return $results; } - protected function matchOr(array $conditionsArray) + protected function matchOr($conditionsArray) { /// @todo introduce proper re-validation of all child conditions if (!is_array($conditionsArray) || !count($conditionsArray)) { diff --git a/WHATSNEW.md b/WHATSNEW.md index 9c73dd99..d9281b62 100644 --- a/WHATSNEW.md +++ b/WHATSNEW.md @@ -1,8 +1,22 @@ -Version 5.7.2 +Version 5.7.3 ============= * Fix: warnings due to ContentVersionMatcher methods signatures +* Fix: creating migrations for Content creation or update with contents which have empty Image/File/Media fields would + crash + +Version 5.7.2 +============= + +* An attempt at fixing php warnings that turned out to be wrong + + +Version 5.7.1 +============= + +* An attempt at fixing php warnings that turned out to be wrong + Version 5.7.0 =============