-
Bug
-
Resolution: Fixed
-
Minor
-
3.11.4, 4.0
-
MOODLE_311_STABLE, MOODLE_400_STABLE
-
MOODLE_311_STABLE
-
From php80 upgrade notes:
assert() will no longer evaluate string arguments, instead they will be
treated like any other argument. assert($a == $b) should be used instead of
assert('$a == $b')
So this is about to verify all the current assert() uses and ensure that no string arguments are passed to it.
It seems that there are a few uses:
$ ag '[^>_]assert\(' --php
|
question/engine/tests/helpers.php
|
482: public function assert($expectation, $compare, $notused = '') {
|
|
lib/htmlpurifier/HTMLPurifier/Arborize.php
|
22: //assert($r->name === $token->name);
|
23: //assert(empty($token->attr));
|
35: //assert(count($stack) == 1);
|
|
lib/htmlpurifier/HTMLPurifier/Zipper.php
|
134: * assert($old1 === $old2);
|
135: * assert($arr1 === $arr2);
|
|
lib/htmlpurifier/HTMLPurifier/ChildDef/Table.php
|
206: //assert($node->is_whitespace);
|
|
mod/wiki/diff/diff_nwiki.php
|
164: USE_ASSERTS_IN_WIKI && assert($yi < $n_to || $this->xchanged[$xi]);
|
165: USE_ASSERTS_IN_WIKI && assert($xi < $n_from || $this->ychanged[$yi]);
|
253: USE_ASSERTS_IN_WIKI && assert($k > 0);
|
259: USE_ASSERTS_IN_WIKI && assert($y < $this->seq[$k]);
|
268: USE_ASSERTS_IN_WIKI && assert($k > 0);
|
304: USE_ASSERTS_IN_WIKI && assert($ypos != $this->seq[$end]);
|
384: USE_ASSERTS_IN_WIKI && assert('sizeof($lines) == sizeof($changed)');
|
404: USE_ASSERTS_IN_WIKI && assert('$j < $other_len && ! $other_changed[$j]');
|
436: USE_ASSERTS_IN_WIKI && assert('$j > 0');
|
439: USE_ASSERTS_IN_WIKI && assert('$j >= 0 && !$other_changed[$j]');
|
462: USE_ASSERTS_IN_WIKI && assert('$j < $other_len && ! $other_changed[$j]');
|
479: USE_ASSERTS_IN_WIKI && assert('$j > 0');
|
482: USE_ASSERTS_IN_WIKI && assert('$j >= 0 && !$other_changed[$j]');
|
666: assert(sizeof($from_lines) == sizeof($mapped_from_lines));
|
667: assert(sizeof($to_lines) == sizeof($mapped_to_lines));
|
888: assert(!strstr($word, "\n"));
|
So, in practice... from the list above, the only real cases to examine are the mod/wiki/diff/diff_nwiki.php ones. Everything else are "false positives" (comments and declarations).