@const is not a valid phpdoc tag and @var should be used to
document both classes properties and constants (no matter how
weird that may sound, heh).
Link to (draft right now) PHP-FIG:
https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc-tags.md#518-var
So, with this commit we are just replacing all uses by the correct
@var one. Note that the type is entirely optional, in fact I think
that there isn't much need of it for constants because it's obvious
for both humans and machines which the type is. But, as far as it's
also correct to specify it, we haven't modified that detail.
The only detail modified are the cases where the constant name was
specified in the phpdoc, that's not needed, hence, the names have
been removed from there when present (a couple of cases).
Default value of the $flag argument changed in PHP 8.1 from ENT_COMPAT to ENT_QUOTES | ENT_SUBSTITUTE
To ensure consistent behavior across different PHP version the second parameter is now required for the functions:
htmlspecialchars(), htmlentities(), htmlspecialchars_decode(), html_entity_decode() and get_html_translation_table()
This changes a couple of cases, in postgres and oracle where we
were trying to calculate strlen() on null values (that causes a
PHP 8.1 warning).
Also, at the same time, fixing another case in xmldb_field, it
was detected that it had a bug around precision (being set to the
value of type), being used as object property, when it's not, so
it was also fixed by moving the code logic a little bit.
Note that the bug has been there since inception because there
isn't any code in Moodle using that ->precision property. It
was just detected thanks to PHP 8.2, but that's another story. :-)
Verified that with the patch:
- All DBs can be installed (phpunit install)
- Both DDL and DML pass without any ddl/dml warning (in all DBs).
As discussed in MDLSITE-6397, all Moodle code files should end with
single Unix-style end of line character. Files created and edited
through the XMLDB editor should follow this rule, too.
Starting with Moodle 3.5 the XMLDB->PATH attribute is checked
to be correct and pointing to the correct plugin directory.
It only was used for writing PHP savepoints code, but better we
ask for strict correctness.
With this patch applied, neither the XMLDB Editor neither install
will be able to load a file with wrong PATH anymore.
The patch increases the maximum supported precision (total number of
digits) for numeric (decimal) fields to 38 digits (current limit on
Oracle and MSSQL).
Additionally, we add our own limit for the whole number part of numeric
fields so they are no longer than integer fields (20 digits). This is to
make it easier to eventually convert from one field type to another.
Note that PHP floats commonly support precision of roughly 15 digits
anyway.
We are going to unify the maximum supported precision of all numeric
fields to 38 digits (which are the current Oracle and MSSQL limits). Get
rid of hard-coded exceptions for longer fields.