Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit 0cd9281

Browse files
committed
Fixed the problem with generating error, when some of attributes is null
* Fixed the problem with generating error, when some of attributes 'eduPersonUniqueId', 'sourceIdPEppn', 'sourceIdPEntityId' is null
1 parent 6900db6 commit 0cd9281

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
55
[Added]
66
- Added file phpcs.xml
77

8+
[Fixed]
9+
- Fixed the problem with generating error, when some of attributes 'eduPersonUniqueId', 'sourceIdPEppn', 'sourceIdPEntityId' is null
10+
811
[Changed]
912
- Changed code style to PSR-2
1013
- Module uses namespaces

lib/Auth/Process/statistics.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace SimpleSAML\Module\proxystatistics\Auth\Process;
44

5+
use DateTime;
56
use SimpleSAML\Error\Exception;
67
use SimpleSAML\Logger;
78

@@ -27,13 +28,23 @@ public function __construct($config, $reserved)
2728

2829
public function process(&$request)
2930
{
30-
$dateTime = new \DateTime();
31+
$dateTime = new DateTime();
3132
DatabaseCommand::insertLogin($request, $dateTime);
32-
33-
$eduPersonUniqueId = $request['Attributes']['eduPersonUniqueId'][0];
3433
$spEntityId = $request['SPMetadata']['entityid'];
35-
$sourceIdPEppn = $request['Attributes']['sourceIdPEppn'][0];
36-
$sourceIdPEntityId = $request['Attributes']['sourceIdPEntityID'][0];
34+
35+
$eduPersonUniqueId = '';
36+
$sourceIdPEppn = '';
37+
$sourceIdPEntityId = '';
38+
39+
if (isset($request['Attributes']['eduPersonUniqueId'][0])) {
40+
$eduPersonUniqueId = $request['Attributes']['eduPersonUniqueId'][0];
41+
}
42+
if (isset($request['Attributes']['sourceIdPEppn'][0])) {
43+
$sourceIdPEppn = $request['Attributes']['sourceIdPEppn'][0];
44+
}
45+
if (isset($request['Attributes']['sourceIdPEntityID'][0])) {
46+
$sourceIdPEntityId = $request['Attributes']['sourceIdPEntityID'][0];
47+
}
3748

3849
if (isset($request['perun']['user'])) {
3950
$user = $request['perun']['user'];

0 commit comments

Comments
 (0)