File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -104,13 +104,24 @@ protected function addContext(array $context = [])
104
104
if (isset ($ context ['person ' ]) and is_array ($ context ['person ' ])) {
105
105
$ person = $ context ['person ' ];
106
106
unset($ context ['person ' ]);
107
- } else {
108
- if (isset ($ config ['person_fn ' ]) && is_callable ($ config ['person_fn ' ])) {
109
- $ data = @call_user_func ($ config ['person_fn ' ]);
110
- if (isset ($ data ['id ' ])) {
111
- $ person = call_user_func ($ config ['person_fn ' ]);
107
+ } elseif (isset ($ config ['person_fn ' ]) && is_callable ($ config ['person_fn ' ])) {
108
+ $ data = @call_user_func ($ config ['person_fn ' ]);
109
+ if (! empty ($ data )) {
110
+ if (is_object ($ data )) {
111
+ if (isset ($ data ->id )) {
112
+ $ person ['id ' ] = $ data ->id ;
113
+ if (isset ($ data ->username )) {
114
+ $ person ['username ' ] = $ data ->username ;
115
+ }
116
+ if (isset ($ data ->email )) {
117
+ $ person ['email ' ] = $ data ->email ;
118
+ }
119
+ }
120
+ } elseif (is_array ($ data ) && isset ($ data ['id ' ])) {
121
+ $ person = $ data ;
112
122
}
113
123
}
124
+ unset($ data );
114
125
}
115
126
116
127
// Add user session information.
You can’t perform that action at this time.
0 commit comments