From 2548f30a2accf9074d564a2b5785a7cc5971f3bf Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 4 Dec 2023 02:30:39 +0100 Subject: [PATCH] SnappyMail failed due to Nextcloud Symfony polyfill --- snappymail/v/0.0.0/php8.php | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/snappymail/v/0.0.0/php8.php b/snappymail/v/0.0.0/php8.php index 82187567c..806afbce7 100644 --- a/snappymail/v/0.0.0/php8.php +++ b/snappymail/v/0.0.0/php8.php @@ -7,23 +7,31 @@ if (\PHP_VERSION_ID < 80000) public function __toString() : string; } - class ValueError extends Error - { + if (!class_exists('ValueError')) { + class ValueError extends Error + { + } } - function str_contains(string $haystack, string $needle) : bool - { - return false !== strpos($haystack, $needle); + if (!function_exists('str_contains')) { + function str_contains(string $haystack, string $needle) : bool + { + return false !== strpos($haystack, $needle); + } } - function str_starts_with(string $haystack, string $needle) : bool - { - return 0 === strncmp($haystack, $needle, strlen($needle)); + if (!function_exists('str_starts_with')) { + function str_starts_with(string $haystack, string $needle) : bool + { + return 0 === strncmp($haystack, $needle, strlen($needle)); + } } - function str_ends_with(string $haystack, string $needle) : bool - { - $length = strlen($needle); - return $length ? substr($haystack, -$length) === $needle : true; + if (!function_exists('str_ends_with')) { + function str_ends_with(string $haystack, string $needle) : bool + { + $length = strlen($needle); + return $length ? substr($haystack, -$length) === $needle : true; + } } }