diff --git a/4dev/tests/Check/CoreLibsCheckEmailTest.php b/4dev/tests/Check/CoreLibsCheckEmailTest.php index 81aeceb7..eaebfa0d 100644 --- a/4dev/tests/Check/CoreLibsCheckEmailTest.php +++ b/4dev/tests/Check/CoreLibsCheckEmailTest.php @@ -24,12 +24,12 @@ final class CoreLibsCheckEmailTest extends TestCase 'get email regex invalid -1, will be 0' => [ -1, "^[A-Za-z0-9!#$%&'*+\-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+\-\/=?^_`{|}~\.]{0,63}@" - . "[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*\.([a-zA-Z]{2,}){1}$" + . "(?!-)[A-Za-z0-9-]{1,63}(? [ 10, "^[A-Za-z0-9!#$%&'*+\-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+\-\/=?^_`{|}~\.]{0,63}@" - . "[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*\.([a-zA-Z]{2,}){1}$" + . "(?!-)[A-Za-z0-9-]{1,63}(? [ 1, @@ -157,7 +157,7 @@ final class CoreLibsCheckEmailTest extends TestCase 'error' => 0, 'message' => 'Invalid email address', 'regex' => "^[A-Za-z0-9!#$%&'*+\-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+\-\/=?^_`{|}~\.]{0,63}@" - . "[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*\.([a-zA-Z]{2,}){1}$" + . "(?!-)[A-Za-z0-9-]{1,63}(? [ @@ -181,7 +181,7 @@ final class CoreLibsCheckEmailTest extends TestCase [ 'error' => 3, 'message' => 'Invalid domain part after @ sign', - 'regex' => "@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,}){1}$" + 'regex' => "@(?!-)[A-Za-z0-9-]{1,63}(? [ @@ -189,7 +189,7 @@ final class CoreLibsCheckEmailTest extends TestCase [ 'error' => 4, 'message' => 'Invalid domain name part', - 'regex' => "@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\." + 'regex' => "@(?!-)[A-Za-z0-9-]{1,63}(? [ @@ -197,7 +197,7 @@ final class CoreLibsCheckEmailTest extends TestCase [ 'error' => 5, 'message' => 'Wrong domain top level part', - 'regex' => "\.([a-zA-Z]{2,6}){1}$" + 'regex' => "\.[a-zA-Z]{2,6}$" ] ], 'error 6 will be domain double dot' => [ diff --git a/4dev/tests/Logging/CoreLibsLoggingLoggingTest.php b/4dev/tests/Logging/CoreLibsLoggingLoggingTest.php index 13b888fe..d1792d6d 100644 --- a/4dev/tests/Logging/CoreLibsLoggingLoggingTest.php +++ b/4dev/tests/Logging/CoreLibsLoggingLoggingTest.php @@ -18,7 +18,7 @@ use CoreLibs\Logging\Logger\Flag; final class CoreLibsLoggingLoggingTest extends TestCase { private const LOG_FOLDER = __DIR__ . DIRECTORY_SEPARATOR . 'log' . DIRECTORY_SEPARATOR; - private const REGEX_BASE = "\[[\d\-\s\.:]+\]\s{1}" // date + private const REGEX_BASE = "\[[\d\-\s\.:+T]+\]\s{1}" // date, just basic checks . "\[[\w\.]+(:\d+)?\]\s{1}" // host:port . "\[(phar:\/\/)?[\w\-\.\/]+:\d+\]\s{1}" // folder/file [note phar:// is for phpunit] . "\[\w+\]\s{1}" // run id diff --git a/www/admin/class_test.array.php b/www/admin/class_test.array.php index 439252f3..9424889b 100644 --- a/www/admin/class_test.array.php +++ b/www/admin/class_test.array.php @@ -332,7 +332,7 @@ print "(kosrt, lower case, reverse): " print "
"; $nested = [ - 'B' => 'foo', 'a', '0', 9, + 'B' => 'foo', 'a', '0', 9, /** @phpstan-ignore-line This is a test for wrong index */ '1' => ['z', 'b', 'a'], 'd' => ['zaip', 'bar', 'baz'] ]; diff --git a/www/lib/CoreLibs/Check/Email.php b/www/lib/CoreLibs/Check/Email.php index 78938e92..34b18ef5 100644 --- a/www/lib/CoreLibs/Check/Email.php +++ b/www/lib/CoreLibs/Check/Email.php @@ -18,7 +18,7 @@ class Email // 3 => "@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,}){1}$", // wrong part after @ 3 => "@(?!-)[A-Za-z0-9-]{1,63}(? "@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.", // wrong domain name part - 4 => "@@(?!-)[A-Za-z0-9-]{1,63}(? "@(?!-)[A-Za-z0-9-]{1,63}(? "\.[a-zA-Z]{2,6}$", // wrong top level part 6 => "@(.*)\.{2,}", // double .. in domain name part 7 => "@.*\.$" // ends with a dot, top level, domain missing diff --git a/www/lib/CoreLibs/Convert/Math.php b/www/lib/CoreLibs/Convert/Math.php index daf4bf07..368c4854 100644 --- a/www/lib/CoreLibs/Convert/Math.php +++ b/www/lib/CoreLibs/Convert/Math.php @@ -199,15 +199,17 @@ class Math callback: fn ($col) => is_array($row) ? array_reduce( array: $row, - callback: fn ($a, $v, $i = null) => $a + $v * ( + // TODO check that v is not an array + callback: fn ($a, $v, $i = null) => $a + $v * ( /** @phpstan-ignore-line Possible array + int */ // if last entry missing for full copy add a 0 to it - $col[$i ?? array_search($v, $row, true)] ?? 0 /** @phpstan-ignore-line */ + $col[$i ?? array_search($v, $row, true)] ?? 0 ), initial: 0, ) : array_reduce( array: $col, - callback: fn ($a, $v) => $a + $v * $row, + // TODO check that v is not an array + callback: fn ($a, $v) => $a + $v * $row, /** @phpstan-ignore-line Possible array + int */ initial: 0, ), array: $bCols, diff --git a/www/lib/CoreLibs/DB/Support/ConvertPlaceholder.php b/www/lib/CoreLibs/DB/Support/ConvertPlaceholder.php index 9fbbf876..9640a5be 100644 --- a/www/lib/CoreLibs/DB/Support/ConvertPlaceholder.php +++ b/www/lib/CoreLibs/DB/Support/ConvertPlaceholder.php @@ -263,11 +263,11 @@ class ConvertPlaceholder } } // add the connectors back (1), and the data sets only if no replacement will be done - return $params_lookup[$match] ?? + return $params_lookup[$match]/* ?? throw new \RuntimeException( 'Cannot lookup ' . $match . ' in params lookup list', 211 - ); + )*/; }, $converted_placeholders['original']['query'] ); @@ -327,11 +327,11 @@ class ConvertPlaceholder } } // add the connectors back (1), and the data sets only if no replacement will be done - return $params_lookup[$match] ?? + return $params_lookup[$match]/* ?? throw new \RuntimeException( 'Cannot lookup ' . $match . ' in params lookup list', 231 - ); + )*/; }, $converted_placeholders['original']['query'] ); diff --git a/www/lib/CoreLibs/Logging/Logging.php b/www/lib/CoreLibs/Logging/Logging.php index 82719b02..1320212b 100644 --- a/www/lib/CoreLibs/Logging/Logging.php +++ b/www/lib/CoreLibs/Logging/Logging.php @@ -99,7 +99,7 @@ class Logging // if turned off uses old time format without time zone 'log_time_format_iso' => [ 'type' => 'bool', 'mandatory' => false, - 'default' => true + 'default' => true, 'deprecated' => false ] ];