annoying log message in 1.14.14

9 views
Skip to first unread message

Emmanuel Dreyfus

unread,
Jul 21, 2017, 10:06:18 PM7/21/17
to simple...@googlegroups.com
Hi

My logs are filed with this annoying message:

PHP Notice: Undefined index: Attributes in
/usr/local/simplesamlphp-1.14.14/lib/SimpleSAML/Session.php on line 600
PHP Warning: Invalid argument supplied for foreach() in
/usr/local/simplesamlphp-1.14.14/lib/SimpleSAML/Session.php on line 600

I suggest this fix:
--- /usr/local/simplesamlphp-1.14.14/lib/SimpleSAML/Session.php.orig
+++ /usr/local/simplesamlphp-1.14.14/lib/SimpleSAML/Session.php
@@ -595,8 +595,12 @@
// unset, or beyond our session lifetime. Clamp it to our
maximum session lifetime
$data['Expire'] = $maxSessionExpire;
}

+ if ($data['Attributes'] === null) {
+ $data['Attributes'] = array();
+ }
+
// check if we have non-serializable attribute values
foreach ($data['Attributes'] as $attribute => $values) {
foreach ($values as $idx => $value) {
if (is_string($value) || is_int($value)) {



--
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
ma...@netbsd.org

Emmanuel Dreyfus

unread,
Jul 21, 2017, 11:01:35 PM7/21/17
to simple...@googlegroups.com
Emmanuel Dreyfus <ma...@netbsd.org> wrote:

> + if ($data['Attributes'] === null) {
> + $data['Attributes'] = array();
> + }

Or even better if (!isset($data['Attributes'])) { ...

Jaime Perez Crespo

unread,
Jul 22, 2017, 6:03:11 AM7/22/17
to simple...@googlegroups.com
Hi Emmanuel,

Just curious, what authentication source are you using? I’d say the Attributes array is always initialized…

In any case, it’s always better to be on the safe side. Do you mind sending us a pull request with the suggested modification (better with isset()) so that we can just merge it?

Thanks!

On 22 Jul 2017, at 05:01 AM, Emmanuel Dreyfus <ma...@netbsd.org> wrote:
>
>> + if ($data['Attributes'] === null) {
>> + $data['Attributes'] = array();
>> + }
>
> Or even better if (!isset($data['Attributes'])) { ...

--
Jaime Pérez
UNINETT / Feide

jaime...@uninett.no
jaime...@protonmail.com
9A08 EA20 E062 70B4 616B 43E3 562A FE3A 6293 62C2

"Two roads diverged in a wood, and I, I took the one less traveled by, and that has made all the difference."
- Robert Frost

Reply all
Reply to author
Forward
0 new messages