Closed tim1mw closed 1 year ago
Good morning! Any chance this can be looked into please? The issue has been open for a while and is quite a nuisance as it breaks upgrades on PHP 8. Thank you in advance!
`Exception - array_key_exists(): Argument #2 ($array) must be of type array, string given
More information about this error Debug info: Error code: generalexceptionmessage Stack trace:
line 726 of /local/o365/db/upgrade.php: TypeError thrown
line 794 of /lib/upgradelib.php: call to xmldb_local_o365_upgrade()
line 1974 of /lib/upgradelib.php: call to upgrade_plugins()
line 726 of /admin/index.php: call to upgrade_noncore()`
Same error, breaks indeed the plugin upgrade and have to rollback the database to get it working again.
Hi @tim1mw @anton-catalyst-eu and @y00see
A fix to the issue has been provided in the latest release from today (4.0.5, 4.1.3 and 4.2.2). Please check it out.
Regards, Lai
I'm getting the following error installing release 2022112805 on Moodle 4.1.1/PHP 8.1:
Exception - array_key_exists(): Argument #2 ($array) must be of type array, string given
The problem is that this code:
Expects each element of $systemtokensconfig to always be an array, however when I dump this variable out on my Moodle I get:
Array ( [idtoken] =>
[https://graph.windows.net] => Array
(
[scope] => Calendars.ReadWrite Directory.AccessAsUser.All Directory.ReadWrite.All Files.ReadWrite Group.ReadWrite.All Notes.ReadWrite.All openid Sites.Read.All User.Read.All User.ReadWrite.All
[token] =>
[expiry] => 1677305777
[refreshtoken] =>
[resource] => https://graph.windows.net
)
)
So the first element of $systemtokensconfig is a string, not an array triggering the crash. I've fixed this on my Moodle by amending the code as shown below: