1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

 // Need to parse name/value pairs, to get value for Drupal username
attribute

  $lines = explode("\n", $response->data);
  reset($lines);

  foreach ($lines as $line) {
    if ($line == ('userdetails.attribute.name=' .
OPENSSO_DRUPAL_USERNAME_ATTRIBUTE)) {

      // 'current' line holds attribute value
      // 28 points to character after 'userdetails.attribute.value='
      $name = substr(current($lines), 28);
      break;
    }
    next($lines);    // <--------- This was missing
  }

  return $name;
} // function _opensso_get_name
?>