diff --git a/4dev/tests/Logging/CoreLibsLoggingErrorMessagesTest.php b/4dev/tests/Logging/CoreLibsLoggingErrorMessagesTest.php
index 7e1729cc..a92b4445 100644
--- a/4dev/tests/Logging/CoreLibsLoggingErrorMessagesTest.php
+++ b/4dev/tests/Logging/CoreLibsLoggingErrorMessagesTest.php
@@ -39,6 +39,11 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
'str' => 'OK',
'expected' => 'ok',
],
+ 'success' => [
+ 'level' => 'success',
+ 'str' => 'SUCCESS',
+ 'expected' => 'success',
+ ],
'info' => [
'level' => 'info',
'str' => 'INFO',
diff --git a/www/admin/class_test.html.php b/www/admin/class_test.html.php
index 824d662a..b02241b2 100644
--- a/www/admin/class_test.html.php
+++ b/www/admin/class_test.html.php
@@ -42,6 +42,7 @@ print '
' . $PAGE_NAME . '
';
$string = "Something < = > Other
Next line and Quotes '\"";
echo "String: $string
";
+$log->debug('HTMLENT', Html::htmlent($string));
print "HTMLENT: " . Html::htmlent($string) . ": " . $_html->htmlent($string) . " (" . htmlentities($string) . ")
";
print "REMOVELB: " . Html::htmlent($string) . ": " . $_html->removeLB($string) . "
";
$date_str = [2021, 5, 1, 11, 10];
diff --git a/www/admin/class_test.php b/www/admin/class_test.php
index 9dfa7b98..315effd3 100644
--- a/www/admin/class_test.php
+++ b/www/admin/class_test.php
@@ -178,7 +178,7 @@ $log->debug('SOME MARK', 'Some error output');
print "EDIT ACCESS ID: " . $backend->edit_access_id . "
";
if (is_object($login)) {
// print "ACL:
".$backend->print_ar($login->loginGetAcl())."
";
- $log->debug('ACL', "ACL: " . \CoreLibs\Debug\Support::dumpVar($login->loginGetAcl()));
+ // $log->debug('ACL', "ACL: " . \CoreLibs\Debug\Support::dumpVar($login->loginGetAcl()));
// print "DEFAULT ACL:
".$backend->print_ar($login->default_acl_list)."
";
// print "DEFAULT ACL:
".$backend->print_ar($login->default_acl_list)."
";
// $result = array_flip(
diff --git a/www/admin/layout/javascript/edit.jq.js b/www/admin/layout/javascript/edit.jq.js
index 2ca9bbd8..52da0f1c 100644
--- a/www/admin/layout/javascript/edit.jq.js
+++ b/www/admin/layout/javascript/edit.jq.js
@@ -931,7 +931,7 @@ function rel(base) // eslint-disable-line no-unused-vars
/**
* searches and removes style from css array
* @param {Object} _element element to work one
- * @param {String css style sheet to remove (name)
+ * @param {String} css style sheet to remove (name)
* @return {Object} returns full element
*/
function rcssel(_element, css)
diff --git a/www/lib/CoreLibs/Admin/Backend.php b/www/lib/CoreLibs/Admin/Backend.php
index f06b7860..44b771d2 100644
--- a/www/lib/CoreLibs/Admin/Backend.php
+++ b/www/lib/CoreLibs/Admin/Backend.php
@@ -504,9 +504,9 @@ class Backend
string $data,
string $key_name,
string $key_value,
- string $associate = null,
- string $file = null,
- string $db_schema = null,
+ ?string $associate = null,
+ ?string $file = null,
+ ?string $db_schema = null,
): void {
/** @var string $DB_SCHEMA check schema */
$DB_SCHEMA = 'public';
diff --git a/www/lib/CoreLibs/Basic.php b/www/lib/CoreLibs/Basic.php
index d0694868..065ec63e 100644
--- a/www/lib/CoreLibs/Basic.php
+++ b/www/lib/CoreLibs/Basic.php
@@ -90,7 +90,7 @@ class Basic
* @deprecated DO NOT USE Class\Basic anymore. Use dedicated logger and sub classes
*/
public function __construct(
- \CoreLibs\Logging\Logging $log = null,
+ ?\CoreLibs\Logging\Logging $log = null,
?string $session_name = null
) {
trigger_error('Class \CoreLibs\Basic is deprected', E_USER_DEPRECATED);
diff --git a/www/lib/CoreLibs/Convert/Extends/SetVarTypeMain.php b/www/lib/CoreLibs/Convert/Extends/SetVarTypeMain.php
index d32e416e..7d4601c6 100644
--- a/www/lib/CoreLibs/Convert/Extends/SetVarTypeMain.php
+++ b/www/lib/CoreLibs/Convert/Extends/SetVarTypeMain.php
@@ -52,7 +52,7 @@ class SetVarTypeMain
*/
protected static function makeStrMain(
mixed $val,
- string $default = null,
+ ?string $default = null,
bool $to_null = false
): ?string {
// int/float/string/bool/null, everything else is ignored
@@ -113,7 +113,7 @@ class SetVarTypeMain
*/
protected static function makeIntMain(
mixed $val,
- int $default = null,
+ ?int $default = null,
bool $to_null = false
): ?int {
// if we can filter it to a valid int, we can convert it
@@ -167,7 +167,7 @@ class SetVarTypeMain
*/
protected static function makeFloatMain(
mixed $val,
- float $default = null,
+ ?float $default = null,
bool $to_null = false
): ?float {
if (
diff --git a/www/lib/CoreLibs/Convert/SetVarTypeNull.php b/www/lib/CoreLibs/Convert/SetVarTypeNull.php
index 6d2c1618..12d22e47 100644
--- a/www/lib/CoreLibs/Convert/SetVarTypeNull.php
+++ b/www/lib/CoreLibs/Convert/SetVarTypeNull.php
@@ -35,7 +35,7 @@ class SetVarTypeNull extends Extends\SetVarTypeMain
* @param string|null $default Default override value
* @return string|null Input value as string or default as string/null
*/
- public static function makeStr(mixed $val, string $default = null): ?string
+ public static function makeStr(mixed $val, ?string $default = null): ?string
{
return SetVarTypeMain::makeStrMain($val, $default, true);
}
@@ -60,7 +60,7 @@ class SetVarTypeNull extends Extends\SetVarTypeMain
* @param int|null $default Default override value
* @return int|null Input value as int or default as int/null
*/
- public static function makeInt(mixed $val, int $default = null): ?int
+ public static function makeInt(mixed $val, ?int $default = null): ?int
{
return SetVarTypeMain::makeIntMain($val, $default, true);
}
@@ -84,7 +84,7 @@ class SetVarTypeNull extends Extends\SetVarTypeMain
* @param float|null $default Default override value
* @return float|null Input value as float or default as float/null
*/
- public static function makeFloat(mixed $val, float $default = null): ?float
+ public static function makeFloat(mixed $val, ?float $default = null): ?float
{
return SetVarTypeMain::makeFloatMain($val, $default, true);
}
diff --git a/www/lib/CoreLibs/DB/IO.php b/www/lib/CoreLibs/DB/IO.php
index c28471ee..a006b1a6 100644
--- a/www/lib/CoreLibs/DB/IO.php
+++ b/www/lib/CoreLibs/DB/IO.php
@@ -1896,7 +1896,12 @@ class IO
$matches = [];
// compare has =, >, < prefix, and gets stripped
// if the rest is not X.Y format then error
- preg_match("/^([<>=]{1,})(\d{1,})\.(\d{1,})/", $compare, $matches);
+ if (!preg_match("/^([<>=]{1,})(\d{1,})\.(\d{1,})/", $compare, $matches)) {
+ $this->log->error('Could not regex match compare version string', [
+ "compare" => $compare
+ ]);
+ return false;
+ }
$compare = $matches[1];
$to_master = $matches[2];
$to_minor = $matches[3];
@@ -1908,11 +1913,18 @@ class IO
}
// db_version can return X.Y.Z
// we only compare the first two
- preg_match(
- "/^(\d{1,})\.(\d{1,})\.?(\d{1,})?/",
- $this->dbVersion(),
- $matches
- );
+ if (
+ !preg_match(
+ "/^(\d{1,})\.(\d{1,})\.?(\d{1,})?/",
+ $this->dbVersion(),
+ $matches
+ )
+ ) {
+ $this->log->error('Could not regex match dbVersion string', [
+ "dbVersion" => $this->dbVersion()
+ ]);
+ return false;
+ }
$master = $matches[1];
$minor = $matches[2];
$version = $master . ($minor < 10 ? '0' : '') . $minor;
diff --git a/www/lib/CoreLibs/Language/GetLocale.php b/www/lib/CoreLibs/Language/GetLocale.php
index 1f7842fc..d0e6f9e1 100644
--- a/www/lib/CoreLibs/Language/GetLocale.php
+++ b/www/lib/CoreLibs/Language/GetLocale.php
@@ -128,7 +128,7 @@ class GetLocale
$matches
)
) {
- $lang = ($matches['lang'] ?? 'en')
+ $lang = $matches['lang']
// add country only if set
. (!empty($matches['country']) ? '_' . $matches['country'] : '');
} else {
@@ -235,7 +235,7 @@ class GetLocale
$matches
)
) {
- $lang = ($matches['lang'] ?? 'en')
+ $lang = $matches['lang']
// add country only if set
. (!empty($matches['country']) ? '_' . $matches['country'] : '');
} else {
diff --git a/www/lib/CoreLibs/Logging/Logger/MessageLevel.php b/www/lib/CoreLibs/Logging/Logger/MessageLevel.php
index 8efc8bca..c03033e1 100644
--- a/www/lib/CoreLibs/Logging/Logger/MessageLevel.php
+++ b/www/lib/CoreLibs/Logging/Logger/MessageLevel.php
@@ -14,6 +14,7 @@ namespace CoreLibs\Logging\Logger;
enum MessageLevel: int
{
case ok = 100;
+ case success = 110; // special for file uploads
case info = 200;
case notice = 250;
case warn = 300;
@@ -30,6 +31,7 @@ enum MessageLevel: int
{
return match (strtolower($name)) {
'ok' => self::ok,
+ 'success' => self::success,
'info' => self::info,
'notice' => self::notice,
'warn', 'warning' => self::warn,
diff --git a/www/lib/CoreLibs/Output/Form/Elements.php b/www/lib/CoreLibs/Output/Form/Elements.php
index b6ee9d8b..6fbd38ed 100644
--- a/www/lib/CoreLibs/Output/Form/Elements.php
+++ b/www/lib/CoreLibs/Output/Form/Elements.php
@@ -194,13 +194,13 @@ class Elements
"/(mailto:)?(\>)?\b([\w\.-]+)@([\w\.\-]+)\.([a-zA-Z]{2,4})\b(\|([^\||^#]+)(#([^\|]+))?\|)?/",
function ($matches) {
return self::createEmail(
- $matches[1] ?? '',
- $matches[2] ?? '',
- $matches[3] ?? '',
- $matches[4] ?? '',
- $matches[5] ?? '',
+ $matches[1],
+ $matches[2],
+ $matches[3],
+ $matches[4],
+ $matches[5],
$matches[7] ?? '',
- $matches[9] ?? ''
+ $matches[9] ?? '',
);
},
$output
diff --git a/www/lib/CoreLibs/Template/HtmlBuilder/Element.php b/www/lib/CoreLibs/Template/HtmlBuilder/Element.php
index 85d58745..d9c2cc1c 100644
--- a/www/lib/CoreLibs/Template/HtmlBuilder/Element.php
+++ b/www/lib/CoreLibs/Template/HtmlBuilder/Element.php
@@ -401,7 +401,7 @@ class Element
* @param bool $add_nl [default=false] Optional output string line breaks
* @return string HTML as string
*/
- public function buildHtml(Element $tree = null, bool $add_nl = false): string
+ public function buildHtml(?Element $tree = null, bool $add_nl = false): string
{
// print "D01: " . microtime(true) . "
";
if ($tree === null) {
@@ -533,7 +533,7 @@ class Element
* @return string build html as string
* @deprecated Do not use, use Element->buildHtml() instead
*/
- public static function printHtmlFromObject(Element $tree = null, bool $add_nl = false): string
+ public static function printHtmlFromObject(?Element $tree = null, bool $add_nl = false): string
{
// nothing ->bad
if ($tree === null) {