Skip to content

Commit e5ead3c

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 0f8e328 commit e5ead3c

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
@@ -1287,7 +1287,9 @@ function external_update_descriptions($component) {
12871287

12881288
if ($dbfunction->services != $functionservices) {
12891289
// Now, we need to check if services were removed, in that case we need to remove the function from them.
1290-
$servicesremoved = array_diff(explode(",", $dbfunction->services), explode(",", $functionservices));
1290+
$oldservices = $dbfunction->services ? explode(',', $dbfunction->services) : [];
1291+
$newservices = $functionservices ? explode(',', $functionservices) : [];
1292+
$servicesremoved = array_diff($oldservices, $newservices);
12911293
foreach ($servicesremoved as $removedshortname) {
12921294
if ($externalserviceid = $DB->get_field('external_services', 'id', array("shortname" => $removedshortname))) {
12931295
$DB->delete_records('external_services_functions', array('functionname' => $dbfunction->name,

0 commit comments

Comments
 (0)