protected function explodeGPOLinkString($gpLink)
{
/**
* It's possible for the gpLink attribute to be a single space under some conditions, though it doesn't seem to
* be documented anywhere in MSDN. In this case we will return an empty array below.
*/
if (!preg_match_all('/(?:\\[LDAP\\:\\/\\/(.*?);(\\d)\\])/', $gpLink, $matches) || !isset($matches[1])) {
return [];
}
// GPO link data is stored in reverse order in the string, hence the array_reverse
return array_combine(array_reverse($matches[1]), array_reverse($matches[2]));
}