Compare commits

..

8 Commits

Author SHA1 Message Date
Clemens Schwaighofer
dfdfcf87f2 Merge branch 'development' 2023-10-02 12:26:14 +09:00
Clemens Schwaighofer
6218e0a6a8 Output\Form\Generate fix for phan check 2023-10-02 12:25:07 +09:00
Clemens Schwaighofer
a84a745be2 Logging\ErrorMsg class update to log error level automatically for debug
if log level is debug, automatically log the error messages.
We still skip warn and info levels from logging.

The rest is based on the logging level (notice eg only gets logged if
log level is at least notice)
2023-10-02 12:23:44 +09:00
Clemens Schwaighofer
312762e92e Composer update 2023-10-02 12:23:15 +09:00
Clemens Schwaighofer
fa4c1f0597 Form\Generate and DB\Extend\ArrayIO split
Move DB\Extend\ArrayIO to internal class in variable and do not extend
Form\Generate from it (as we do not have a base class anymore, this is
no longer neded)

Update all calls in connected classes.

Add interface methods for DB\Extend\ArrayIO to interface with all class
vars that are now all private
2023-09-29 19:05:58 +09:00
Clemens Schwaighofer
438a75af23 Merge branch 'development' 2023-09-27 11:42:32 +09:00
Clemens Schwaighofer
afd8ff3e31 Composer updates 2023-09-27 11:42:07 +09:00
Clemens Schwaighofer
4343af7937 Composer core updates 2023-09-27 11:41:41 +09:00
20 changed files with 711 additions and 577 deletions

View File

@@ -96,9 +96,9 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
public function testErrorMessageLevelOk(string $level, string $str, string $expected): void public function testErrorMessageLevelOk(string $level, string $str, string $expected): void
{ {
$log = new \CoreLibs\Logging\Logging([ $log = new \CoreLibs\Logging\Logging([
'log_file_id' => 'testErrorMessages', 'log_file_id' => 'testErrorMessagesLevelOk',
'log_folder' => self::LOG_FOLDER, 'log_folder' => self::LOG_FOLDER,
'log_level' => Level::Debug, 'log_level' => Level::Error,
]); ]);
$em = new \CoreLibs\Logging\ErrorMessage($log); $em = new \CoreLibs\Logging\ErrorMessage($log);
$em->setMessage( $em->setMessage(
@@ -128,9 +128,9 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
public function testErrorMessageOk(): void public function testErrorMessageOk(): void
{ {
$log = new \CoreLibs\Logging\Logging([ $log = new \CoreLibs\Logging\Logging([
'log_file_id' => 'testErrorMessages', 'log_file_id' => 'testErrorMessagesOk',
'log_folder' => self::LOG_FOLDER, 'log_folder' => self::LOG_FOLDER,
'log_level' => Level::Debug 'log_level' => Level::Error
]); ]);
$em = new \CoreLibs\Logging\ErrorMessage($log); $em = new \CoreLibs\Logging\ErrorMessage($log);
$em->setErrorMsg( $em->setErrorMsg(
@@ -314,7 +314,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
* Undocumented function * Undocumented function
* *
* @dataProvider providerErrorMessageLog * @dataProvider providerErrorMessageLog
* @testdox Test Log writing [$_dataName] * @testdox Test Log writing with log level Error [$_dataName]
* *
* @param string $id * @param string $id
* @param string $level * @param string $level
@@ -324,7 +324,7 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
* @param string $expected * @param string $expected
* @return void * @return void
*/ */
public function testErrorMessageLog( public function testErrorMessageLogErrorLevel(
string $id, string $id,
string $level, string $level,
string $str, string $str,
@@ -333,7 +333,63 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
string $expected string $expected
): void { ): void {
$log = new \CoreLibs\Logging\Logging([ $log = new \CoreLibs\Logging\Logging([
'log_file_id' => 'testErrorMessages', 'log_file_id' => 'testErrorMessagesLogError',
'log_folder' => self::LOG_FOLDER,
'log_level' => Level::Notice,
'log_per_run' => true
]);
$em = new \CoreLibs\Logging\ErrorMessage($log);
$em->setErrorMsg(
$id,
$level,
$str,
message: $message,
log_error: $log_error
);
$file_content = '';
if (is_file($log->getLogFolder() . $log->getLogFile())) {
$file_content = file_get_contents(
$log->getLogFolder() . $log->getLogFile()
) ?: '';
}
// if error, if null or false, it will not be logged
if ($level == 'error' && ($log_error === null || $log_error === false)) {
$this->assertStringNotContainsString(
$expected,
$file_content
);
} else {
$this->assertStringContainsString(
$expected,
$file_content
);
}
}
/**
* Undocumented function
*
* @dataProvider providerErrorMessageLog
* @testdox Test Log writing with log Level Debug [$_dataName]
*
* @param string $id
* @param string $level
* @param string $str
* @param string|null $message
* @param bool|null $log_error
* @param string $expected
* @return void
*/
public function testErrorMessageLogErrorDebug(
string $id,
string $level,
string $str,
?string $message,
?bool $log_error,
string $expected
): void {
$log = new \CoreLibs\Logging\Logging([
'log_file_id' => 'testErrorMessagesLogDebug',
'log_folder' => self::LOG_FOLDER, 'log_folder' => self::LOG_FOLDER,
'log_level' => Level::Debug, 'log_level' => Level::Debug,
'log_per_run' => true 'log_per_run' => true
@@ -352,8 +408,8 @@ final class CoreLibsLoggingErrorMessagesTest extends TestCase
$log->getLogFolder() . $log->getLogFile() $log->getLogFolder() . $log->getLogFile()
) ?: ''; ) ?: '';
} }
// if n // if error, and log is debug level, only explicit false are not logged
if ($level == 'error' && ($log_error === null || $log_error === false)) { if ($level == 'error' && $log_error === false) {
$this->assertStringNotContainsString( $this->assertStringNotContainsString(
$expected, $expected,
$file_content $file_content

46
composer.lock generated
View File

@@ -481,16 +481,16 @@
}, },
{ {
"name": "doctrine/deprecations", "name": "doctrine/deprecations",
"version": "v1.1.1", "version": "1.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/deprecations.git", "url": "https://github.com/doctrine/deprecations.git",
"reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3" "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", "url": "https://api.github.com/repos/doctrine/deprecations/zipball/4f2d4f2836e7ec4e7a8625e75c6aa916004db931",
"reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -522,9 +522,9 @@
"homepage": "https://www.doctrine-project.org/", "homepage": "https://www.doctrine-project.org/",
"support": { "support": {
"issues": "https://github.com/doctrine/deprecations/issues", "issues": "https://github.com/doctrine/deprecations/issues",
"source": "https://github.com/doctrine/deprecations/tree/v1.1.1" "source": "https://github.com/doctrine/deprecations/tree/1.1.2"
}, },
"time": "2023-06-03T09:27:29+00:00" "time": "2023-09-27T20:04:15+00:00"
}, },
{ {
"name": "felixfbecker/advanced-json-rpc", "name": "felixfbecker/advanced-json-rpc",
@@ -1133,16 +1133,16 @@
}, },
{ {
"name": "phpstan/phpdoc-parser", "name": "phpstan/phpdoc-parser",
"version": "1.24.0", "version": "1.24.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git", "url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "3510b0a6274cc42f7219367cb3abfc123ffa09d6" "reference": "bcad8d995980440892759db0c32acae7c8e79442"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/3510b0a6274cc42f7219367cb3abfc123ffa09d6", "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bcad8d995980440892759db0c32acae7c8e79442",
"reference": "3510b0a6274cc42f7219367cb3abfc123ffa09d6", "reference": "bcad8d995980440892759db0c32acae7c8e79442",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1174,22 +1174,22 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types", "description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": { "support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues", "issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.0" "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.2"
}, },
"time": "2023-09-07T20:46:32+00:00" "time": "2023-09-26T12:28:12+00:00"
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.10.34", "version": "1.10.36",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "7f806b6f1403e6914c778140e2ba07c293cb4901" "reference": "ffa3089511121a672e62969404e4fddc753f9b15"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/7f806b6f1403e6914c778140e2ba07c293cb4901", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa3089511121a672e62969404e4fddc753f9b15",
"reference": "7f806b6f1403e6914c778140e2ba07c293cb4901", "reference": "ffa3089511121a672e62969404e4fddc753f9b15",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1238,7 +1238,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-09-13T09:49:47+00:00" "time": "2023-09-29T14:07:45+00:00"
}, },
{ {
"name": "phpstan/phpstan-deprecation-rules", "name": "phpstan/phpstan-deprecation-rules",
@@ -2254,16 +2254,16 @@
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v6.3.2", "version": "v6.3.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "53d1a83225002635bca3482fcbf963001313fb68" "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68", "url": "https://api.github.com/repos/symfony/string/zipball/13d76d0fb049051ed12a04bef4f9de8715bea339",
"reference": "53d1a83225002635bca3482fcbf963001313fb68", "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2320,7 +2320,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v6.3.2" "source": "https://github.com/symfony/string/tree/v6.3.5"
}, },
"funding": [ "funding": [
{ {
@@ -2336,7 +2336,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-07-05T08:41:27+00:00" "time": "2023-09-18T10:38:32+00:00"
}, },
{ {
"name": "tysonandre/var_representation_polyfill", "name": "tysonandre/var_representation_polyfill",

View File

@@ -441,17 +441,17 @@
}, },
{ {
"name": "doctrine/deprecations", "name": "doctrine/deprecations",
"version": "v1.1.1", "version": "1.1.2",
"version_normalized": "1.1.1.0", "version_normalized": "1.1.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/deprecations.git", "url": "https://github.com/doctrine/deprecations.git",
"reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3" "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", "url": "https://api.github.com/repos/doctrine/deprecations/zipball/4f2d4f2836e7ec4e7a8625e75c6aa916004db931",
"reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -469,7 +469,7 @@
"suggest": { "suggest": {
"psr/log": "Allows logging deprecations via PSR-3 logger implementation" "psr/log": "Allows logging deprecations via PSR-3 logger implementation"
}, },
"time": "2023-06-03T09:27:29+00:00", "time": "2023-09-27T20:04:15+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@@ -485,7 +485,7 @@
"homepage": "https://www.doctrine-project.org/", "homepage": "https://www.doctrine-project.org/",
"support": { "support": {
"issues": "https://github.com/doctrine/deprecations/issues", "issues": "https://github.com/doctrine/deprecations/issues",
"source": "https://github.com/doctrine/deprecations/tree/v1.1.1" "source": "https://github.com/doctrine/deprecations/tree/1.1.2"
}, },
"install-path": "../doctrine/deprecations" "install-path": "../doctrine/deprecations"
}, },
@@ -1129,17 +1129,17 @@
}, },
{ {
"name": "phpstan/phpdoc-parser", "name": "phpstan/phpdoc-parser",
"version": "1.24.0", "version": "1.24.2",
"version_normalized": "1.24.0.0", "version_normalized": "1.24.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git", "url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "3510b0a6274cc42f7219367cb3abfc123ffa09d6" "reference": "bcad8d995980440892759db0c32acae7c8e79442"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/3510b0a6274cc42f7219367cb3abfc123ffa09d6", "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bcad8d995980440892759db0c32acae7c8e79442",
"reference": "3510b0a6274cc42f7219367cb3abfc123ffa09d6", "reference": "bcad8d995980440892759db0c32acae7c8e79442",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1156,7 +1156,7 @@
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "^9.5",
"symfony/process": "^5.2" "symfony/process": "^5.2"
}, },
"time": "2023-09-07T20:46:32+00:00", "time": "2023-09-26T12:28:12+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@@ -1173,23 +1173,23 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types", "description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": { "support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues", "issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.0" "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.2"
}, },
"install-path": "../phpstan/phpdoc-parser" "install-path": "../phpstan/phpdoc-parser"
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.10.34", "version": "1.10.36",
"version_normalized": "1.10.34.0", "version_normalized": "1.10.36.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "7f806b6f1403e6914c778140e2ba07c293cb4901" "reference": "ffa3089511121a672e62969404e4fddc753f9b15"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/7f806b6f1403e6914c778140e2ba07c293cb4901", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa3089511121a672e62969404e4fddc753f9b15",
"reference": "7f806b6f1403e6914c778140e2ba07c293cb4901", "reference": "ffa3089511121a672e62969404e4fddc753f9b15",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1198,7 +1198,7 @@
"conflict": { "conflict": {
"phpstan/phpstan-shim": "*" "phpstan/phpstan-shim": "*"
}, },
"time": "2023-09-13T09:49:47+00:00", "time": "2023-09-29T14:07:45+00:00",
"bin": [ "bin": [
"phpstan", "phpstan",
"phpstan.phar" "phpstan.phar"
@@ -2351,17 +2351,17 @@
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v6.3.2", "version": "v6.3.5",
"version_normalized": "6.3.2.0", "version_normalized": "6.3.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "53d1a83225002635bca3482fcbf963001313fb68" "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68", "url": "https://api.github.com/repos/symfony/string/zipball/13d76d0fb049051ed12a04bef4f9de8715bea339",
"reference": "53d1a83225002635bca3482fcbf963001313fb68", "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2381,7 +2381,7 @@
"symfony/translation-contracts": "^2.5|^3.0", "symfony/translation-contracts": "^2.5|^3.0",
"symfony/var-exporter": "^5.4|^6.0" "symfony/var-exporter": "^5.4|^6.0"
}, },
"time": "2023-07-05T08:41:27+00:00", "time": "2023-09-18T10:38:32+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@@ -2420,7 +2420,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v6.3.2" "source": "https://github.com/symfony/string/tree/v6.3.5"
}, },
"funding": [ "funding": [
{ {

View File

@@ -65,9 +65,9 @@
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'doctrine/deprecations' => array( 'doctrine/deprecations' => array(
'pretty_version' => 'v1.1.1', 'pretty_version' => '1.1.2',
'version' => '1.1.1.0', 'version' => '1.1.2.0',
'reference' => '612a3ee5ab0d5dd97b7cf3874a6efe24325efac3', 'reference' => '4f2d4f2836e7ec4e7a8625e75c6aa916004db931',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/deprecations', 'install_path' => __DIR__ . '/../doctrine/deprecations',
'aliases' => array(), 'aliases' => array(),
@@ -182,18 +182,18 @@
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'phpstan/phpdoc-parser' => array( 'phpstan/phpdoc-parser' => array(
'pretty_version' => '1.24.0', 'pretty_version' => '1.24.2',
'version' => '1.24.0.0', 'version' => '1.24.2.0',
'reference' => '3510b0a6274cc42f7219367cb3abfc123ffa09d6', 'reference' => 'bcad8d995980440892759db0c32acae7c8e79442',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../phpstan/phpdoc-parser', 'install_path' => __DIR__ . '/../phpstan/phpdoc-parser',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'phpstan/phpstan' => array( 'phpstan/phpstan' => array(
'pretty_version' => '1.10.34', 'pretty_version' => '1.10.36',
'version' => '1.10.34.0', 'version' => '1.10.36.0',
'reference' => '7f806b6f1403e6914c778140e2ba07c293cb4901', 'reference' => 'ffa3089511121a672e62969404e4fddc753f9b15',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../phpstan/phpstan', 'install_path' => __DIR__ . '/../phpstan/phpstan',
'aliases' => array(), 'aliases' => array(),
@@ -347,9 +347,9 @@
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'symfony/string' => array( 'symfony/string' => array(
'pretty_version' => 'v6.3.2', 'pretty_version' => 'v6.3.5',
'version' => '6.3.2.0', 'version' => '6.3.5.0',
'reference' => '53d1a83225002635bca3482fcbf963001313fb68', 'reference' => '13d76d0fb049051ed12a04bef4f9de8715bea339',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/string', 'install_path' => __DIR__ . '/../symfony/string',
'aliases' => array(), 'aliases' => array(),

View File

@@ -11,6 +11,7 @@ use function array_reduce;
use function assert; use function assert;
use function debug_backtrace; use function debug_backtrace;
use function sprintf; use function sprintf;
use function str_replace;
use function strpos; use function strpos;
use function strrpos; use function strrpos;
use function substr; use function substr;
@@ -138,7 +139,7 @@ class Deprecation
// first check that the caller is not from a tests folder, in which case we always let deprecations pass // first check that the caller is not from a tests folder, in which case we always let deprecations pass
if (isset($backtrace[1]['file'], $backtrace[0]['file']) && strpos($backtrace[1]['file'], DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR) === false) { if (isset($backtrace[1]['file'], $backtrace[0]['file']) && strpos($backtrace[1]['file'], DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR) === false) {
$path = DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR; $path = DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $package) . DIRECTORY_SEPARATOR;
if (strpos($backtrace[0]['file'], $path) === false) { if (strpos($backtrace[0]['file'], $path) === false) {
return; return;

View File

@@ -1,22 +0,0 @@
<?xml version="1.0"?>
<ruleset>
<arg name="basepath" value="."/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="80"/>
<arg name="cache" value=".phpcs-cache"/>
<arg name="colors"/>
<!-- Ignore warnings, show progress of the run and show sniff names -->
<arg value="nps"/>
<config name="php_version" value="70100"/>
<!-- Directories to be checked -->
<file>lib</file>
<file>tests</file>
<!-- Include full Doctrine Coding Standard -->
<rule ref="Doctrine">
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint" />
</rule>
</ruleset>

View File

@@ -1,9 +0,0 @@
parameters:
level: 6
paths:
- lib
- tests
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon

View File

@@ -1,30 +0,0 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="lib/Doctrine/Deprecations" />
<directory name="tests/Doctrine/Deprecations" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<plugins>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
</plugins>
<issueHandlers>
<DeprecatedMethod>
<errorLevel type="suppress">
<!-- Remove when dropping support for PHPUnit 9.6 -->
<referencedMethod name="PHPUnit\Framework\TestCase::expectDeprecation"/>
<referencedMethod name="PHPUnit\Framework\TestCase::expectDeprecationMessage"/>
</errorLevel>
</DeprecatedMethod>
</issueHandlers>
</psalm>

View File

@@ -10,11 +10,6 @@ parameters:
count: 1 count: 1
path: src/Ast/NodeTraverser.php path: src/Ast/NodeTraverser.php
-
message: "#^Strict comparison using \\=\\=\\= between 2 and 2 will always evaluate to true\\.$#"
count: 2
path: src/Ast/NodeTraverser.php
- -
message: "#^Variable property access on PHPStan\\\\PhpDocParser\\\\Ast\\\\Node\\.$#" message: "#^Variable property access on PHPStan\\\\PhpDocParser\\\\Ast\\\\Node\\.$#"
count: 1 count: 1

View File

@@ -398,42 +398,33 @@ class TypeParser
public function parseGeneric(TokenIterator $tokens, Ast\Type\IdentifierTypeNode $baseType): Ast\Type\GenericTypeNode public function parseGeneric(TokenIterator $tokens, Ast\Type\IdentifierTypeNode $baseType): Ast\Type\GenericTypeNode
{ {
$tokens->consumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET); $tokens->consumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET);
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
$startLine = $baseType->getAttribute(Ast\Attribute::START_LINE);
$startIndex = $baseType->getAttribute(Ast\Attribute::START_INDEX);
$genericTypes = []; $genericTypes = [];
$variances = []; $variances = [];
[$genericTypes[], $variances[]] = $this->parseGenericTypeArgument($tokens); $isFirst = true;
while ($isFirst || $tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)) {
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)) {
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET)) {
// trailing comma case
$type = new Ast\Type\GenericTypeNode($baseType, $genericTypes, $variances);
$startLine = $baseType->getAttribute(Ast\Attribute::START_LINE);
$startIndex = $baseType->getAttribute(Ast\Attribute::START_INDEX);
if ($startLine !== null && $startIndex !== null) {
$type = $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex);
}
return $type; // trailing comma case
if (!$isFirst && $tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET)) {
break;
} }
$isFirst = false;
[$genericTypes[], $variances[]] = $this->parseGenericTypeArgument($tokens); [$genericTypes[], $variances[]] = $this->parseGenericTypeArgument($tokens);
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL); $tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
} }
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
$tokens->consumeTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET);
$type = new Ast\Type\GenericTypeNode($baseType, $genericTypes, $variances); $type = new Ast\Type\GenericTypeNode($baseType, $genericTypes, $variances);
$startLine = $baseType->getAttribute(Ast\Attribute::START_LINE);
$startIndex = $baseType->getAttribute(Ast\Attribute::START_INDEX);
if ($startLine !== null && $startIndex !== null) { if ($startLine !== null && $startIndex !== null) {
$type = $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex); $type = $this->enrichWithAttributes($tokens, $type, $startLine, $startIndex);
} }
$tokens->consumeTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET);
return $type; return $type;
} }
@@ -533,7 +524,7 @@ class TypeParser
return $this->parseNullable($tokens); return $this->parseNullable($tokens);
} elseif ($tokens->tryConsumeTokenType(Lexer::TOKEN_OPEN_PARENTHESES)) { } elseif ($tokens->tryConsumeTokenType(Lexer::TOKEN_OPEN_PARENTHESES)) {
$type = $this->parse($tokens); $type = $this->subParse($tokens);
$tokens->consumeTokenType(Lexer::TOKEN_CLOSE_PARENTHESES); $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_PARENTHESES);
if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) {
$type = $this->tryParseArrayOrOffsetAccess($tokens, $type); $type = $this->tryParseArrayOrOffsetAccess($tokens, $type);

Binary file not shown.

View File

@@ -1,16 +1,16 @@
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmUBhZwACgkQUcZzBf/C iQIzBAABCgAdFiEEynwsejDI6OEnSoR2UcZzBf/C5cAFAmUW2hQACgkQUcZzBf/C
5cDAIA/+JOxOdWCg6b1+/Bs4Opm7cmILJzh3Rw1366MzXFHJhe2n7exemzTE3X2E 5cAX+g/8DLEpwgjbRjXNPaPoL9y2lbhYuOAkFuTLElmFTNRvmUgOrqI3pGdfWves
0HTjVVWoE0MpTt6knBgb+dulXTGm+yzJNIRLnCJFhsSdwUcxNAZMPozliZszGMcC tFCRVdzefPnbi8PX7Y0u14bKY/YieSgeXEwqaZfllPdan7TJ7gdu8ZvOxZeiOvT5
HhGC1Ya7RU5d9WEg/lCAKRjNgSeY8VTRRfa49m6TQPQwGinXBNpH6q665feziUX5 Ns7Bnn7F+TyK7Z9gFn9pSt4bopLXgoGM3Xw4yg//HWQIb2gYzP/OEUwzF6vj1N88
NB+rBMaWUDKp6GelPVrezEfME+SMfT66hW31n5m5paTwT+khk2Cenub5xXBUyXtz x7GyXKhuNClh8DOYLPdw/Mp5C+Z4wEqUpxFFZ6nMZN239gOC4kxz2IfbMj1Lb1jR
saxSayOShlUPN8kZKOjS/L/FPnOApGwcKxkX2kMK0qDs8YQFYHibNgnyhrEOBRD1 5diFq+lAB9IfmqlRqJnlkRDmM3jt6G6+i4YNIdk8iRN3ppMJWT0Ck9cSiRSPhImB
UV9kBiU1+LUuxDcya8f0qo/gk6QN7Y/ywnIY3kTkqTYchCAAO+osu1amLYlInBSu n/fo4AA+fhomI6aXBECmYRud78ul0nm411KVM+a/cCnVD9nYrab6eC3K6KBeuWOw
r0LtQQ8+/llQ/bP0XS6cC6247J1fxO9xYMMmKVBfJrul3Wi6ETRI5WIdEQTSc2Z+ 2SNTdKSY+Al5y6mwjwzLCwrOLR7WxCTMkdO8pcbCj62IuKKyxWtS4xI/oxZE+z1S
rE00JY2X/vxJijUyGZ88+QDX3z7vGyaQJZiXq1XyjmBYw6w8UlxhGZcGGDIbTsb7 2o4arkHhv103JQiF9NkbRWnUQakt2IhjWDjZmz051jMjijHfSW3j4WpZ8sjwk5mY
lACLR/t4hgtE69QXW+L4P2ngU0agk5XXojg/+r+CnCWD/TdKcvs1WTn4TyuMZOLa GKO/jQMgJ0M/4h46q+pFawMljBgK+7ECHF1nEAuoF2e+5v8VJ+XRJ+VC6rdvjQWC
2XF3h9/H0XMfE5LPlNJmb4YRjYjcNvPQwmGI4dmUMCJuTpjHUnpFXfswu4xgsaYV StcsiFDznyRJgosaOePn39mLt6E0wOBc6Ko8OIoBrSDP7l5Wh+H6yIzpCiPLCm9C
xq756DVfrRyG9PyXFfJZ66P7jt5+wisrVsWh/X3nX69P0ruwwss= 8sx9U+LB0Jt+BHpWYReQcHrdbek5H7Iu4h8s/F8YYZFEeI0O9tc=
=aOCq =Y8DE
-----END PGP SIGNATURE----- -----END PGP SIGNATURE-----

View File

@@ -3,8 +3,8 @@
/* /*
* This file has been auto-generated by the Symfony String Component for internal use. * This file has been auto-generated by the Symfony String Component for internal use.
* *
* Unicode version: 15.0.0 * Unicode version: 15.1.0
* Date: 2022-10-05T17:16:36+02:00 * Date: 2023-09-13T11:47:12+00:00
*/ */
return [ return [
@@ -166,7 +166,7 @@ return [
], ],
[ [
12272, 12272,
12283, 12287,
], ],
[ [
12288, 12288,
@@ -396,6 +396,10 @@ return [
12736, 12736,
12771, 12771,
], ],
[
12783,
12783,
],
[ [
12784, 12784,
12799, 12799,
@@ -1110,6 +1114,14 @@ return [
], ],
[ [
191457, 191457,
191471,
],
[
191472,
192093,
],
[
192094,
194559, 194559,
], ],
[ [

View File

@@ -3,8 +3,8 @@
/* /*
* This file has been auto-generated by the Symfony String Component for internal use. * This file has been auto-generated by the Symfony String Component for internal use.
* *
* Unicode version: 15.0.0 * Unicode version: 15.1.0
* Date: 2022-10-05T17:16:37+02:00 * Date: 2023-09-13T11:47:13+00:00
*/ */
return [ return [

View File

@@ -35,13 +35,16 @@ print '<div><h1>' . $PAGE_NAME . '</h1></div>';
$em = new \CoreLibs\Logging\ErrorMessage($log); $em = new \CoreLibs\Logging\ErrorMessage($log);
print "Log ERROR: " . $log->prAr($em->getFlagLogError()) . "<br>";
print "FN: " . ml::fromName('Affe')->name . "<br>"; print "FN: " . ml::fromName('Affe')->name . "<br>";
print "NU: " . ml::fromValue(100)->name . "<br>"; print "NU: " . ml::fromValue(100)->name . "<br>";
print "NU: " . ml::fromValue(1000)->name . "<br>"; print "NU: " . ml::fromValue(1000)->name . "<br>";
$em->setErrorMsg('123', 'error', 'msg this is bad, not logged'); $em->setErrorMsg('123', 'error', 'msg this is bad, auto logged if debug');
$em->setErrorMsg('123', 'error', 'msg this is bad, not logged', 'target-id', 'other-style'); $em->setErrorMsg('123', 'error', 'msg this is bad, auto logged if debug', 'target-id', 'other-style');
$em->setErrorMsg('123', 'error', 'msg this is bad, logged', log_error:true); $em->setErrorMsg('123', 'error', 'msg this is bad, logged always', log_error:true);
$em->setErrorMsg('123', 'error', 'msg this is bad, never logged', log_error:false);
$em->setErrorMsg('1000', 'info', 'This is good'); $em->setErrorMsg('1000', 'info', 'This is good');
$em->setErrorMsg('9999', 'abort', 'BAD: This is critical (abort)'); $em->setErrorMsg('9999', 'abort', 'BAD: This is critical (abort)');
$em->setErrorMsg('10-1000', 'wrong', 'Wrong level: This is emergency'); $em->setErrorMsg('10-1000', 'wrong', 'Wrong level: This is emergency');
@@ -51,4 +54,6 @@ print "Errors: <pre>" . $log->prAr($em->getErrorMsg()) . "</pre>";
print "</body></html>"; print "</body></html>";
$log->debug('[END]', '==========================================>');
// __END__ // __END__

View File

@@ -42,6 +42,7 @@
<textarea name="{$element.data.name}"{if $element.data.rows} rows="{$element.data.rows}"{/if}{if $element.data.cols} cols="{$element.data.cols}"{/if}>{$element.data.value}</textarea> <textarea name="{$element.data.name}"{if $element.data.rows} rows="{$element.data.rows}"{/if}{if $element.data.cols} cols="{$element.data.cols}"{/if}>{$element.data.value}</textarea>
{/if} {/if}
{if $element.type == 'drop_down'} {if $element.type == 'drop_down'}
{* {$element.data.selected} *}
{html_options name=$element.data.name values=$element.data.value output=$element.data.output selected=$element.data.selected} {html_options name=$element.data.name values=$element.data.value output=$element.data.output selected=$element.data.selected}
{if $drop_down_input} {if $drop_down_input}
&nbsp;&nbsp;&nbsp;<input type="text" name="{$element.data.input_name}" value="{$element.data.input_value}"{if $element.data.input_size} size="{$element.data.input_size}"{/if}{if $element.data.input_length} maxlength="{$element.data.input_length}"{/if}> &nbsp;&nbsp;&nbsp;<input type="text" name="{$element.data.input_name}" value="{$element.data.input_value}"{if $element.data.input_size} size="{$element.data.input_size}"{/if}{if $element.data.input_length} maxlength="{$element.data.input_length}"{/if}>

View File

@@ -154,7 +154,7 @@ class EditBase
$q = "UPDATE " . $table_name $q = "UPDATE " . $table_name
. " SET order_number = " . $row_data_order[$i] . " SET order_number = " . $row_data_order[$i]
. " WHERE " . $table_name . "_id = " . $row_data_id[$i]; . " WHERE " . $table_name . "_id = " . $row_data_id[$i];
$q = $this->form->dbExec($q); $q = $this->form->dba->dbExec($q);
} }
} // for all article ids ... } // for all article ids ...
} // if write } // if write
@@ -173,7 +173,7 @@ class EditBase
$options_name = []; $options_name = [];
$options_selected = []; $options_selected = [];
// DB read data for menu // DB read data for menu
while (is_array($res = $this->form->dbReturn($q))) { while (is_array($res = $this->form->dba->dbReturn($q))) {
$row_data[] = [ $row_data[] = [
"id" => $res[$table_name . "_id"], "id" => $res[$table_name . "_id"],
"name" => $res["name"], "name" => $res["name"],
@@ -431,9 +431,9 @@ class EditBase
$elements[] = $this->form->formCreateElement('template'); $elements[] = $this->form->formCreateElement('template');
break; break;
case 'edit_pages': case 'edit_pages':
if (!isset($this->form->table_array['edit_page_id']['value'])) { if (!isset($this->form->dba->getTableArray()['edit_page_id']['value'])) {
$q = "DELETE FROM temp_files"; $q = "DELETE FROM temp_files";
$this->form->dbExec($q); $this->form->dba->dbExec($q);
// gets all files in the current dir and dirs given ending with .php // gets all files in the current dir and dirs given ending with .php
$folders = ['../admin/', '../frontend/']; $folders = ['../admin/', '../frontend/'];
$files = ['*.php']; $files = ['*.php'];
@@ -461,16 +461,16 @@ class EditBase
if ($t_q) { if ($t_q) {
$t_q .= ', '; $t_q .= ', ';
} }
$t_q .= "('" . $this->form->dbEscapeString($pathinfo['dirname']) . "', '" $t_q .= "('" . $this->form->dba->dbEscapeString($pathinfo['dirname']) . "', '"
. $this->form->dbEscapeString($pathinfo['basename']) . "')"; . $this->form->dba->dbEscapeString($pathinfo['basename']) . "')";
} }
$this->form->dbExec($q . $t_q, 'NULL'); $this->form->dba->dbExec($q . $t_q, 'NULL');
$elements[] = $this->form->formCreateElement('filename'); $elements[] = $this->form->formCreateElement('filename');
} else { } else {
// show file menu // show file menu
// just show name of file ... // just show name of file ...
$this->DATA['filename_exist'] = 1; $this->DATA['filename_exist'] = 1;
$this->DATA['filename'] = $this->form->table_array['filename']['value']; $this->DATA['filename'] = $this->form->dba->getTableArray()['filename']['value'];
} // File Name View IF } // File Name View IF
$elements[] = $this->form->formCreateElement('hostname'); $elements[] = $this->form->formCreateElement('hostname');
$elements[] = $this->form->formCreateElement('name'); $elements[] = $this->form->formCreateElement('name');

View File

@@ -39,13 +39,13 @@ class ArrayIO extends \CoreLibs\DB\IO
{ {
// main calss variables // main calss variables
/** @var array<mixed> */ /** @var array<mixed> */
public array $table_array; // the array from the table to work on private array $table_array; // the array from the table to work on
/** @var string */ /** @var string */
public string $table_name; // the table_name private string $table_name; // the table_name
/** @var string */ /** @var string */
public string $pk_name = ''; // the primary key from this table private string $pk_name = ''; // the primary key from this table
/** @var int|string|null */ /** @var int|string|null */
public int|string|null $pk_id; // the PK id private int|string|null $pk_id; // the PK id
// security values // security values
/** @var int base acl for current page */ /** @var int base acl for current page */
private int $base_acl_level = 0; private int $base_acl_level = 0;
@@ -74,24 +74,21 @@ class ArrayIO extends \CoreLibs\DB\IO
// instance db_io class // instance db_io class
parent::__construct($db_config, $log); parent::__construct($db_config, $log);
// more error vars for this class // more error vars for this class
$this->error_string['1999'] = 'No table array or table name set'; $this->error_string['1998'] = 'No table name set';
$this->error_string['1999'] = 'No table array set';
$this->error_string['1021'] = 'No Primary Key given'; $this->error_string['1021'] = 'No Primary Key given';
$this->error_string['1022'] = 'Could not run Array Query'; $this->error_string['1022'] = 'Could not run Array Query';
$this->table_array = $table_array; $this->setTableArray($table_array);
$this->table_name = $table_name; $this->setTableName($table_name);
// error abort if no table array or no table name
if (empty($table_array) || empty($table_name)) {
$this->__dbError(1999, false, 'MAJOR ERROR: Core settings missing');
throw new \RuntimeException('MAJOR ERROR: Core settings missing', 1999);
}
// set primary key for given table_array // set primary key for given table_array
foreach ($this->table_array as $key => $value) { foreach ($this->table_array as $key => $value) {
if (!empty($value['pk'])) { if (empty($value['pk'])) {
$this->pk_name = $key; continue;
} }
$this->setPkName($key);
break;
} }
$this->dbArrayIOSetAcl($base_acl_level, $acl_admin); $this->dbArrayIOSetAcl($base_acl_level, $acl_admin);
} }
@@ -104,6 +101,144 @@ class ArrayIO extends \CoreLibs\DB\IO
parent::__destruct(); parent::__destruct();
} }
/**
* Set the overall table array
*
* @param array<mixed> $table_array
* @return void
* @throws \RuntimeException 1999 for empty table array
*/
public function setTableArray(array $table_array): void
{
$this->table_array = $table_array;
if (empty($this->table_array)) {
$this->__dbError(1999, false, 'MAJOR ERROR: Core settings missing: table_arrry');
throw new \RuntimeException('MAJOR ERROR: Core settings missing: table_array', 1999);
}
}
/**
* return full table array, or [] if empty
* of reset is set to true, will reset array first
*
* @param bool $reset [=false] run a reset before returning
* @return array<mixed>
*/
public function getTableArray(bool $reset = false): array
{
if (!$reset) {
return $this->table_array ?? [];
}
$table_array = $this->table_array ?? [];
reset($table_array);
return $table_array;
}
/**
* get a table array entry under the key with element pos
*
* @param string $key
* @param string $pos
* @return mixed
*/
public function getTableArrayEntry(string $key, string $pos): mixed
{
return $this->table_array[$key][$pos] ?? null;
}
/**
* set a new value at key with pos
*
* @param mixed $value
* @param string $key
* @param string $pos
* @return void
*/
public function setTableArrayEntry(mixed $value, string $key, string $pos): void
{
$this->table_array[$key][$pos] = $value;
}
/**
* unset entry at key with pos
*
* @param string $key
* @param string $pos
* @return void
*/
public function unsetTableArrayEntry(string $key, string $pos): void
{
unset($this->table_array[$key][$pos]);
}
/**
* Set table name
*
* @param string $table_name
* @return void
* @throws \RuntimeException 1998 for empty table name
*/
public function setTableName(string $table_name): void
{
$this->table_name = $table_name;
if (empty($this->table_name)) {
$this->__dbError(1998, false, 'MAJOR ERROR: Core settings missing: table_name');
throw new \RuntimeException('MAJOR ERROR: Core settings missing: table_name', 1998);
}
}
/**
* Return table name or empty string if not net
*
* @return string
*/
public function getTableName(): string
{
return $this->table_name ?? '';
}
/**
* Set primary key name
*
* @param string $pk_name
* @return void
*/
public function setPkName(string $pk_name): void
{
$this->pk_name = $pk_name;
}
/**
* get primary key name
*
* @return string
*/
public function getPkName(): string
{
return $this->pk_name;
}
/**
* set primary key id, can be null for not yet set
*
* @param int|string|null $pk_id
* @return void
*/
public function setPkId(int|string|null $pk_id): void
{
$this->pk_id = $pk_id;
}
/**
* return primary key id, or null if not set
*
* @return int|string|null
*/
public function getPkId(): int|string|null
{
return $this->pk_id;
}
/** /**
* set the base acl level and admin acl flag * set the base acl level and admin acl flag
* This is needed for table array ACL checks * This is needed for table array ACL checks
@@ -198,8 +333,8 @@ class ArrayIO extends \CoreLibs\DB\IO
public function dbCheckPkSet(): bool public function dbCheckPkSet(): bool
{ {
// if pk_id is set, overrule ... // if pk_id is set, overrule ...
if (!empty($this->pk_id)) { if (!empty($this->getPkId())) {
$this->table_array[$this->pk_name]['value'] = $this->pk_id; $this->table_array[$this->pk_name]['value'] = $this->getPkId();
} }
// if not set ... produce error // if not set ... produce error
if (!$this->table_array[$this->pk_name]['value']) { if (!$this->table_array[$this->pk_name]['value']) {
@@ -287,7 +422,7 @@ class ArrayIO extends \CoreLibs\DB\IO
$q .= ' AND ' . $q_where; $q .= ' AND ' . $q_where;
} }
// if 0, error // if 0, error
$this->pk_id = null; $this->setPkId(null);
if (!$this->dbExec($q)) { if (!$this->dbExec($q)) {
$this->__dbError(1022); $this->__dbError(1022);
} }
@@ -374,7 +509,7 @@ class ArrayIO extends \CoreLibs\DB\IO
} }
} }
// possible dbFetchArray errors ... // possible dbFetchArray errors ...
$this->pk_id = $this->table_array[$this->pk_name]['value']; $this->setPkId($this->table_array[$this->pk_name]['value']);
} else { } else {
$this->__dbError(1022); $this->__dbError(1022);
} }
@@ -397,10 +532,6 @@ class ArrayIO extends \CoreLibs\DB\IO
if (count($table_array)) { if (count($table_array)) {
$this->table_array = $table_array; $this->table_array = $table_array;
} }
// PK ID check
// if ($this->pk_id && !$this->table_array[$this->pk_name]["value"]) {
// $this->table_array[$this->pk_name]["value"]=$this->pk_id;
// }
// checken ob PKs gesetzt, wenn alle -> update, wenn keiner -> insert, wenn ein paar -> ERROR! // checken ob PKs gesetzt, wenn alle -> update, wenn keiner -> insert, wenn ein paar -> ERROR!
if (!$this->table_array[$this->pk_name]['value']) { if (!$this->table_array[$this->pk_name]['value']) {
$insert = 1; $insert = 1;
@@ -624,16 +755,11 @@ class ArrayIO extends \CoreLibs\DB\IO
$q .= ' AND ' . $q_where; $q .= ' AND ' . $q_where;
} }
// set pk_id ... if it has changed or so // set pk_id ... if it has changed or so
$this->pk_id = $this->table_array[$this->pk_name]['value']; $this->setPkId($this->table_array[$this->pk_name]['value']);
} else { } else {
$q = 'INSERT INTO ' . $this->table_name . ' '; $q = 'INSERT INTO ' . $this->table_name . ' ';
$q .= '(' . $q_vars . ') '; $q .= '(' . $q_vars . ') ';
$q .= 'VALUES (' . $q_data . ')'; $q .= 'VALUES (' . $q_data . ')';
// write primary key too
// if ($q_data)
// $q .= ", ";
// $q .= $this->pk_name." = ".$this->table_array[$this->pk_name]['value']." ";
// $this->pk_id = $this->table_array[$this->pk_name]['value'];
} }
// return success or not // return success or not
if (!$this->dbExec($q)) { if (!$this->dbExec($q)) {
@@ -646,7 +772,7 @@ class ArrayIO extends \CoreLibs\DB\IO
$insert_id = 0; $insert_id = 0;
} }
$this->table_array[$this->pk_name]['value'] = $insert_id; $this->table_array[$this->pk_name]['value'] = $insert_id;
$this->pk_id = $insert_id; $this->setPkId($insert_id);
} }
// return the table if needed // return the table if needed
return $this->table_array; return $this->table_array;

View File

@@ -27,13 +27,19 @@ class ErrorMessage
* init ErrorMessage * init ErrorMessage
* *
* @param \CoreLibs\Logging\Logging $log * @param \CoreLibs\Logging\Logging $log
* @param bool $log_error [=false] * @param null|bool $log_error [=null], defaults to false if log is not level debug
*/ */
public function __construct( public function __construct(
\CoreLibs\Logging\Logging $log, \CoreLibs\Logging\Logging $log,
bool $log_error = false ?bool $log_error = null
) { ) {
$this->log = $log; $this->log = $log;
// if log default logging is debug then log_error is default set to true
if ($this->log->loggingLevelIsDebug() && $log_error === null) {
$log_error = true;
} else {
$log_error = $log_error ?? false;
}
$this->log_error = $log_error; $this->log_error = $log_error;
} }

File diff suppressed because it is too large Load Diff