Merge pull request #8391 from appwrite/lohanidamodar-patch-3

Fix: throwing exception when optional array attribute does not exist
This commit is contained in:
Damodar Lohani
2024-09-29 07:28:21 +05:45
committed by GitHub
3 changed files with 30 additions and 0 deletions
+5
View File
@@ -625,6 +625,11 @@ class Response extends SwooleResponse
}
}
if (!$data->isSet($key) && !$rule['required']) { // set output key null if data key is not set and required is false
$output[$key] = null;
continue;
}
if ($rule['array']) {
if (!is_array($data[$key])) {
throw new Exception($key . ' must be an array of type ' . $rule['type']);