mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Fix warning when optional attribute doesn't exist
When an attribute required is set to `false` and the attribute doesn't exist in the response, we get warning `undefined array key "attribute"` in the console, this update prevents that error
This commit is contained in:
1 parent
ae87033974
commit
c0efc232ad
1 file changed
+4
@@ -590,6 +590,10 @@ class Response extends SwooleResponse
|
||||
}
|
||||
}
|
||||
|
||||
if(!$data->isSet($key) && !$rule['required']) { // skip attribute in response if not required and values does not exist
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($rule['array']) {
|
||||
if (!is_array($data[$key])) {
|
||||
throw new Exception($key . ' must be an array of type ' . $rule['type']);
|
||||
|
||||
Reference in new issue
Block a user