diff --git a/system/src/Grav/Common/Page/Medium/ImageMedium.php b/system/src/Grav/Common/Page/Medium/ImageMedium.php index d215465ad..95e6a7813 100644 --- a/system/src/Grav/Common/Page/Medium/ImageMedium.php +++ b/system/src/Grav/Common/Page/Medium/ImageMedium.php @@ -62,8 +62,8 @@ class ImageMedium extends Medium implements ImageMediaInterface, ImageManipulate if (!($this->offsetExists('width') && $this->offsetExists('height') && $this->offsetExists('mime'))) { $image_info = getimagesize($path); if ($image_info) { - $this->def('width', $image_info[0]); - $this->def('height', $image_info[1]); + $this->def('width', (int) $image_info[0]); + $this->def('height', (int) $image_info[1]); $this->def('mime', $image_info['mime']); } } @@ -299,7 +299,7 @@ class ImageMedium extends Medium implements ImageMediaInterface, ImageManipulate } if ($width && $height) { - $this->__call('cropResize', [$width, $height]); + $this->__call('cropResize', [(int) $width, (int) $height]); } return parent::lightbox($width, $height, $reset); @@ -361,8 +361,8 @@ class ImageMedium extends Medium implements ImageMediaInterface, ImageManipulate // Scaling operations $scale = ($scale ?? $config->get('system.images.watermark.scale', 100)) / 100; - $wwidth = (int)$this->get('width') * $scale; - $wheight = (int)$this->get('height') * $scale; + $wwidth = (int) ($this->get('width') * $scale); + $wheight = (int) ($this->get('height') * $scale); $watermark->resize($wwidth, $wheight); // Position operations @@ -392,11 +392,11 @@ class ImageMedium extends Medium implements ImageMediaInterface, ImageManipulate break; case 'right': - $positionX = (int)$this->get('width')-$wwidth; + $positionX = (int) ($this->get('width')-$wwidth); break; case 'center': - $positionX = ((int)$this->get('width')/2) - ($wwidth/2); + $positionX = (int) (($this->get('width')/2) - ($wwidth/2)); break; } @@ -431,8 +431,8 @@ class ImageMedium extends Medium implements ImageMediaInterface, ImageManipulate return $this; } - $dst_width = $image->width()+2*$border; - $dst_height = $image->height()+2*$border; + $dst_width = (int) ($image->width()+2*$border); + $dst_height = (int) ($image->height()+2*$border); $frame = ImageFile::create($dst_width, $dst_height); diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 14e7a12a4..595b7870a 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -1802,7 +1802,7 @@ class Page implements PageInterface } if (empty($this->slug)) { - $this->slug = $this->adjustRouteCase(preg_replace(PAGE_ORDER_PREFIX_REGEX, '', $this->folder)) ?: null; + $this->slug = $this->adjustRouteCase(preg_replace(PAGE_ORDER_PREFIX_REGEX, '', (string) $this->folder)) ?: null; } return $this->slug; diff --git a/system/src/Grav/Common/Twig/Extension/GravExtension.php b/system/src/Grav/Common/Twig/Extension/GravExtension.php index 68bea6035..dc530c686 100644 --- a/system/src/Grav/Common/Twig/Extension/GravExtension.php +++ b/system/src/Grav/Common/Twig/Extension/GravExtension.php @@ -949,7 +949,7 @@ class GravExtension extends AbstractExtension implements GlobalsInterface */ public function repeatFunc($input, $multiplier) { - return str_repeat($input, $multiplier); + return str_repeat($input, (int) $multiplier); } /** diff --git a/system/src/Grav/Common/Utils.php b/system/src/Grav/Common/Utils.php index 0b6309c34..c5c727090 100644 --- a/system/src/Grav/Common/Utils.php +++ b/system/src/Grav/Common/Utils.php @@ -201,7 +201,7 @@ abstract class Utils $compare_func = $case_sensitive ? 'mb_strpos' : 'mb_stripos'; foreach ((array)$needle as $each_needle) { - $status = $each_needle === '' || $compare_func($haystack, $each_needle) === 0; + $status = $each_needle === '' || $compare_func((string) $haystack, $each_needle) === 0; if ($status) { break; } diff --git a/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php b/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php index 87737dcc8..757452c35 100644 --- a/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php @@ -42,7 +42,7 @@ trait NestedPropertyTrait public function getNestedProperty($property, $default = null, $separator = null) { $separator = $separator ?: '.'; - $path = explode($separator, $property); + $path = explode($separator, (string) $property); $offset = array_shift($path); if (!$this->hasProperty($offset)) {