Skip to content

[EDIT] Fixing empty result from answerzipper

Christian SGPN requested to merge patrick-skripsi into master

Data returned from these lines of code

$submission = new Submission();
$submission->has("answer_slot", ["deleted_on = ?", null]);
$submission->has("participant.exam", ["id=?", $exam->_id]);
$submissions = $submission->find();

is an object and somehow not counted as an associative array.

When the code reaches this line:

 if (!is_array($submissions)) {
            $submissions = [];
        }

submission is being set to an empty array because the statement !is_array($submissions) is fulfilled.

By changing !is_array($submissions) to !is_iterable($submissions), the $submission won't be set to an empty array because the object/associate array is iterable.

Edited by Christian SGPN

Merge request reports