diff --git a/php/classes/class-qsm-quiz-api.php b/php/classes/class-qsm-quiz-api.php index a3d32aaa8..63013af1f 100644 --- a/php/classes/class-qsm-quiz-api.php +++ b/php/classes/class-qsm-quiz-api.php @@ -388,12 +388,14 @@ public function qsm_unserialize_to_api_format( $data ) { if ( is_serialized($data) ) { return maybe_unserialize($data); } - - foreach ( $data as $key => $value ) { - if ( is_serialized($value) ) { - $result[ $key ] = $this->qsm_unserialize_recursive_loop($value); - } else { - $result[ $key ] = $value; + + if ( is_array($data) || is_object($data) ) { + foreach ( $data as $key => $value ) { + if ( is_serialized($value) ) { + $result[ $key ] = $this->qsm_unserialize_recursive_loop($value); + } else { + $result[ $key ] = $value; + } } }