MDL-76362 output: Preserve original behaviour for PHP 8.1

Whenever the page_requirements_manager::js_fix_url()
is called with null url, it must throw an exception and emit 0 warnings.

It's covered by an explicit test:

test_js_fix_url_coding_exception with data set "Provide a null argument"
This commit is contained in:
Eloy Lafuente (stronk7) 2023-01-21 13:24:00 +01:00 committed by Andrew Nicols
parent 7000a99de3
commit 4a76c772d7

View File

@ -722,7 +722,7 @@ class page_requirements_manager {
}
// The URL is not a Moodle resource.
return $url;
} else if (strpos($url, '/') === 0) {
} else if (null !== $url && strpos($url, '/') === 0) {
// Fix the admin links if needed.
if ($CFG->admin !== 'admin') {
if (strpos($url, "/admin/") === 0) {