Skip to content

Commit 63d96ee

Browse files
committed
MDL-80950 external: Fix PHP deprecated error for explode()
This patch fixes the following error: PHP Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in lib/upgradelib.php on line 1299
1 parent e4bbd79 commit 63d96ee

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/upgradelib.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,9 @@ function external_update_descriptions($component) {
12961296

12971297
if ($dbfunction->services != $functionservices) {
12981298
// Now, we need to check if services were removed, in that case we need to remove the function from them.
1299-
$servicesremoved = array_diff(explode(",", $dbfunction->services), explode(",", $functionservices));
1299+
$oldservices = $dbfunction->services ? explode(',', $dbfunction->services) : [];
1300+
$newservices = $functionservices ? explode(',', $functionservices) : [];
1301+
$servicesremoved = array_diff($oldservices, $newservices);
13001302
foreach ($servicesremoved as $removedshortname) {
13011303
if ($externalserviceid = $DB->get_field('external_services', 'id', array("shortname" => $removedshortname))) {
13021304
$DB->delete_records('external_services_functions', array('functionname' => $dbfunction->name,

0 commit comments

Comments
 (0)