From 9cf73d00b3a3afde9f78d3c74cd3f990696d14f1 Mon Sep 17 00:00:00 2001 From: Pavel Dohnal Date: Wed, 22 Apr 2020 10:45:47 +0200 Subject: [PATCH] Make sure the types are correct [MAILPOET-2716] --- lib/Segments/WooCommerce.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Segments/WooCommerce.php b/lib/Segments/WooCommerce.php index 1119fa52ea..0ff18d41ff 100644 --- a/lib/Segments/WooCommerce.php +++ b/lib/Segments/WooCommerce.php @@ -139,8 +139,11 @@ class WooCommerce { if ($collation1 === $collation2) { return false; } - $charset1 = substr($collation1, 0, strpos($collation1, '_')); - $charset2 = substr($collation2, 0, strpos($collation2, '_')); + $collation1UnderscorePos = strpos($collation1, '_'); + $collation2UnderscorePos = strpos($collation2, '_'); + + $charset1 = substr($collation1, 0, $collation1UnderscorePos === false ? strlen($collation1) : $collation1UnderscorePos); + $charset2 = substr($collation2, 0, $collation2UnderscorePos === false ? strlen($collation2) : $collation2UnderscorePos); return $charset1 === $charset2; }