string: if it is stringable in anyway, set string (it converts)
this is not check IF it is a string value as it was before
int/float: same, if it is numerc it will be convert to int or float
All other stay the same
Note "set ..." imply to set, and not to convert to 0 if it is int
string that can be covnerted to int
DB Class throws Exception if on init it fails to connect to the DB,
will not throw Exception if failed connection during execution but
will do the normal retry and soft failure run
DB\ArrayIO will throw Exception on missing table array and table name
All Exceptions have a code set
All Color methods will throw Exceptions:
LengthException,
InvalidArgumentException,
UnexpectedValueException
instead of returning bool: false
All methods will return valid color data as expected only
exit will add message as first parameter (string) next to code (int)
Log this to info or critical.
3000 -> 100: info
rest >=1000: critical
previous 4000 = 3000 (options not set)
update unit tests for this
Possible change idea: critical abort throw error?
Debug Support:
getCallerClass now returns level 1 class from the trace like the
getCallerMethod. There is also a new getCallerClassMethod that returns
namespace\class->method (or :: for static).
getCallerTopLevelClass works like getCallerClass did before and returns
the TOP level (first entry on the call stack that has a set class name)
Logging:
Do not use the Support getCallerClass/Method/File but call it inside
and use level 2 in trace to get the data we need For the last call
before debug call
Also update the strack trace for the debug call to use ->/:: for method
type
We do not return old style bool on error, we throw Exceptions: HtmlBuilderExcpetion
Element has more classes to set tag, id, etc with basic checks for valid data
String Replace to set strings is one array with key -> value entries
Errors thrown on index for element/replace blocks
Object build is a replicata from the JS one
Array is similar but build on pure Array elements
String replace is just a simple string replacer for now
General\Error for overall error handling
General\Settings for Object/Array based checks and settings
set via db options "db_convert_type" as array with "on", "json", "numeric",
"bytea"
"on" only converts know good types: "bool", "int"
"json" will convert json/jsonb to array
"bytea" will decode escaped bytea to string (note: this might change to resource)
"numeric" will convert to float.
NOTE: if a numeric number is too large a covnersion might drop data.
Use with care.
Convert flags can be chagned with dbSetConvertFlag and dbUnsetConvertFlag
All convert flags are in "DB\Options\Convert" as enum.
the params order is the actual correct one:
log level, message, context, group_id, prefix
not that group_id and prefix are only used if log level is debug
Switched debug params order for context and prefix so prefix is last
- Removed echo from Support Debug dumpVar call
- deprecated DB\IO toggle dbDebug and changed set/get to be like normal
ones where set just sets and doesn't return anything
- Renamed the logJsDebug to loggingLevelIsDebug
(other levels can be checked with ->getLoggingLevel()->includes(Level::...))
Adjusted tests for all changes
All variable declarations in all classes have a strict type set
Exception: constants (will be setable from PHP 8.3 on), resources (no type)
Debug\LoggingLegacy is kept as is, will be deprecated
old Debug\Logging is in Debug\LoggingLegacy and Debug\Logging extends
Logging\Logging
Logging\Logging is a new class with most of the functionality except
there is no more print/outout to screen, but we use the default log
levels (RFC5424)
The plan is to be a frontend between the old type class and
Monolog\Monolog
Updated all other classes to use new class interface
Move Passwords from Check to Security and deprecate old
Add new SymmetricEncryption and CreateKey
CreateKey class just creates keys for the SymmetricEncryption
SymmetricEncryption uses the hex2bin calls to convert the hex key to the
internal binary key
Example:
$key = CreateKey::generateRandomKey();
$encrypted = SymmetricEncryption::encrypt($string, $key);
$decrypted = SymmetricEncryption::decrypt($encrypted, $key);
Above $key must be stored in some secure location (.env file)
On error with query with params the query was sent to the server and
if ther query itself is ok but there is a problem with the parameters
a wrong error message ($1 not found) will be returned
Add pg_last_error reporting to catch this too.
Update both error reporting to return not string and prefix combined
but prefix + error string in array
In error return check that both strings are not equal, so we do not
return the same error string twice.
Also default set dbh variable in the PgSQL class to false so it will
skip last error report if there is no dbh set yet.
Bug fix for db query with params debug output. if there are more than 9
entries the $1 of eg $10 is replaced with $1 entry again. Changed to
'#' instead '$' to avoid this.
Other:
ACL\Login: replace EOM with HTML
config.master: replace list() with []
Add single DB tester where we can test single db calls without adding
more to the general test run
search in an array in any format and returns value of key if found.
Either as set with path to key, or as flat with only values.
Optional possible to prefix with the search keys to group found entries
If ACL\Login is used, the loginGetLocale() call should be used to fetch
the locale data set during login
Language\L10n now has new encoding/charset optional parameter 4
If the locale does not have a charset set the defautl charset is UTF-8
unless set via the new parameter or setOverrideEncoding()
Because of the deprecation of the getLocales call the following methods
do no longer need $locales
- Admin\Backend
- Admin\EditBase
- Output\Form\Generate
- Template\SmartyExtend
They all use the new l10n->getLocaleAsArray() call to set all the local
variables
* Admin\EditBase has new parameter "options" to set
- cache_id
- compile_id
which must be passed on the SmartyExtend class init
Remove unused code and classes.
Clean up code to remove all named constant from them and throw
deprecation alerts if used.
Add basic psalm setup in root folder and remove from www folder
Convert\VarSetType for always return type expected (eg string will be string)
or Convert\VarSetTypeNull to return string or null on failure
The return value for failure if not matching type can be set for both, but
only for Convert\VarSetTypeNull the return value can be set to null.