Skip to content

Error when creating Save point #71

@robertscally

Description

@robertscally

There is an error when creating a Save Point:

Exception - Cannot use object of type stdClass as array

More information about this error
Debug info:
Error code: generalexceptionmessage
Stack trace:

	line 128 of /admin/tool/coursearchiver/step2.php: Error thrown

Potential fix for the issue on line 128 of /admin/tool/coursearchiver/step2.php

-    $data = json_decode($formdata);
-    if (!empty($resume)) { // Resume from save point.
-        $searches = $data;
-        $searches["resume"] = true;
-    } else {
-        $searches = [];
-        foreach ($data as $key => $value) {
-            $searches["$key"] = $value;
-        }
-    }
+    $data = json_decode($formdata, true);
+    $searches = is_array($data) ? $data : []; // guard against null/bad JSON
 
+    if (!empty($resume)) {
+        $searches['resume'] = true;
+    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions