mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-08 22:18:28 +03:00
Polyfill ctype #1250
This commit is contained in:
parent
34106c937e
commit
382ccdb499
3 changed files with 22 additions and 2 deletions
17
snappymail/v/0.0.0/app/libraries/polyfill/ctype.php
Normal file
17
snappymail/v/0.0.0/app/libraries/polyfill/ctype.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
if (!function_exists('ctype_digit')) {
|
||||
function ctype_digit(string $text): bool
|
||||
{
|
||||
$l = \strlen($text);
|
||||
return $l && $l === \strspn($text, '0123456789');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('ctype_alpha')) {
|
||||
function ctype_alpha(string $text): bool
|
||||
{
|
||||
$l = \strlen($text);
|
||||
return $l && $l === \strspn($text, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz');
|
||||
}
|
||||
}
|
||||
|
|
@ -101,7 +101,6 @@ abstract class Integrity
|
|||
'mbstring' => extension_loaded('mbstring'),
|
||||
'Zlib' => extension_loaded('zlib'),
|
||||
// enabled by default:
|
||||
'ctype' => extension_loaded('ctype'),
|
||||
'json' => function_exists('json_decode'),
|
||||
'libxml' => function_exists('libxml_use_internal_errors'),
|
||||
'dom' => class_exists('DOMDocument'),
|
||||
|
|
|
|||
|
|
@ -4,10 +4,14 @@ if (defined('APP_VERSION_ROOT_PATH')) {
|
|||
}
|
||||
|
||||
// PHP 8
|
||||
if (\PHP_VERSION_ID < 80000) {
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
require __DIR__ . '/app/libraries/polyfill/php8.php';
|
||||
}
|
||||
|
||||
if (!extension_loaded('ctype')) {
|
||||
require __DIR__ . '/app/libraries/polyfill/ctype.php';
|
||||
}
|
||||
|
||||
if (!defined('APP_VERSION')) {
|
||||
define('APP_VERSION', basename(__DIR__));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue