diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fdcb1501..5c9088031 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ * Added support for `multipart/form-data` content type in PUT and PATCH requests * Added support for flex object relationships +# v1.7.34 +## mm/dd/2022 + +1. [](#bugfix) + * Regression: Fixed saving page with a new language causing cache corruption [getgrav/grav-plugin-admin#2282](https://github.com/getgrav/grav-plugin-admin/issues/2282) + * Fixed a potential fatal error when using watermark in images + # v1.7.33 ## 04/25/2022 diff --git a/system/src/Grav/Common/File/CompiledFile.php b/system/src/Grav/Common/File/CompiledFile.php index 9393ab70f..eaf46f702 100644 --- a/system/src/Grav/Common/File/CompiledFile.php +++ b/system/src/Grav/Common/File/CompiledFile.php @@ -138,6 +138,10 @@ trait CompiledFile $class = get_class($this); $size = filesize($filename); + // Reload data from the filesystem. This ensures that we always cache the correct data (see issue #2282). + $this->raw = $this->content = null; + $data = (array)$this->decode($this->raw()); + // Decode data into compiled array. $cache = [ '@class' => $class, diff --git a/system/src/Grav/Common/Page/Medium/ImageMedium.php b/system/src/Grav/Common/Page/Medium/ImageMedium.php index 42d8f0e75..ab6ba4a90 100644 --- a/system/src/Grav/Common/Page/Medium/ImageMedium.php +++ b/system/src/Grav/Common/Page/Medium/ImageMedium.php @@ -361,8 +361,8 @@ class ImageMedium extends Medium implements ImageMediaInterface, ImageManipulate // Scaling operations $scale = ($scale ?? $config->get('system.images.watermark.scale', 100)) / 100; - $wwidth = $this->get('width') * $scale; - $wheight = $this->get('height') * $scale; + $wwidth = (int)$this->get('width') * $scale; + $wheight = (int)$this->get('height') * $scale; $watermark->resize($wwidth, $wheight); // Position operations @@ -377,11 +377,11 @@ class ImageMedium extends Medium implements ImageMediaInterface, ImageManipulate break; case 'bottom': - $positionY = $this->get('height')-$wheight; + $positionY = (int)$this->get('height')-$wheight; break; case 'center': - $positionY = ($this->get('height')/2) - ($wheight/2); + $positionY = ((int)$this->get('height')/2) - ($wheight/2); break; } @@ -392,11 +392,11 @@ class ImageMedium extends Medium implements ImageMediaInterface, ImageManipulate break; case 'right': - $positionX = $this->get('width')-$wwidth; + $positionX = (int)$this->get('width')-$wwidth; break; case 'center': - $positionX = ($this->get('width')/2) - ($wwidth/2); + $positionX = ((int)$this->get('width')/2) - ($wwidth/2); break; }