From c8e8ad7e5b9f8db2d27eac8ac98313af99a2713b Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Fri, 29 Mar 2024 11:20:47 +0100 Subject: [PATCH] Use `function` instead of `fn` and restore PHP 7.0 - 7.3 compatibility --- src/main/php/web/auth/cas/CasFlow.class.php | 26 +++++++++++++-------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/main/php/web/auth/cas/CasFlow.class.php b/src/main/php/web/auth/cas/CasFlow.class.php index 2d8c379..b226a84 100755 --- a/src/main/php/web/auth/cas/CasFlow.class.php +++ b/src/main/php/web/auth/cas/CasFlow.class.php @@ -80,17 +80,23 @@ public function authenticate($request, $response, $session) { try { $stream= new XmlStreaming($validate->in()); $result= $stream->next(new ValueOf([], [ - 'cas:authenticationFailure' => fn(&$self) => $self['failure']= yield new ValueOf([], [ - '@code' => fn(&$self) => $self['code']= yield, - '.' => fn(&$self) => $self['message']= trim(yield), - ]), - 'cas:authenticationSuccess' => fn(&$self) => $self['user']= yield new ValueOf([], [ - 'cas:user' => fn(&$self) => $self['username']= yield, - 'cas:attributes' => fn(&$self) => $self+= yield new ValueOf([], [ - '*' => fn(&$self, $name) => $self[str_replace('cas:', '', $name)]= yield, + 'cas:authenticationFailure' => function(&$self) { + $self['failure']= yield new ValueOf([], [ + '@code' => function(&$self) { $self['code']= yield; }, + '.' => function(&$self) { $self['message']= trim(yield); }, + ]); + }, + 'cas:authenticationSuccess' => function(&$self) { + $self['user']= yield new ValueOf([], [ + 'cas:user' => function(&$self) { $self['username']= yield; }, + 'cas:attributes' => function(&$self) { + $self+= yield new ValueOf([], ['*' => function(&$self, $name) { + $self[str_replace('cas:', '', $name)]= yield; + }]); + } ]) - ]), - '*' => fn(&$self, $name) => $self[$name]= yield, + }, + '*' => function(&$self, $name) { $self[$name]= yield; } ])); } catch (Throwable $e) { throw new Error(500, 'UNEXPECTED: Streaming error', $e);