From be70870b726a7e1eb9569e98bd8153046903357c Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Sun, 3 Dec 2023 22:09:56 +0100 Subject: [PATCH] Split PHP polyfills from include.php --- snappymail/v/0.0.0/include.php | 20 ++------------------ snappymail/v/0.0.0/php8.php | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 18 deletions(-) create mode 100644 snappymail/v/0.0.0/php8.php diff --git a/snappymail/v/0.0.0/include.php b/snappymail/v/0.0.0/include.php index 48aff66ad..661635d40 100644 --- a/snappymail/v/0.0.0/include.php +++ b/snappymail/v/0.0.0/include.php @@ -4,24 +4,8 @@ if (defined('APP_VERSION_ROOT_PATH')) { } // PHP 8 -if (!function_exists('str_contains')) { - function str_contains(string $haystack, string $needle) : bool - { - return false !== strpos($haystack, $needle); - } -} -if (!function_exists('str_starts_with')) { - function str_starts_with(string $haystack, string $needle) : bool - { - return 0 === strncmp($haystack, $needle, strlen($needle)); - } -} -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; - } +if (\PHP_VERSION_ID < 80000) { + require __DIR__ . '/php8.php'; } if (!defined('APP_VERSION')) { diff --git a/snappymail/v/0.0.0/php8.php b/snappymail/v/0.0.0/php8.php new file mode 100644 index 000000000..82187567c --- /dev/null +++ b/snappymail/v/0.0.0/php8.php @@ -0,0 +1,29 @@ +