* @author Rémon van de Kamp * * @internal */ final class SessionUtils { /** * Finds the session header amongst the headers that are to be sent, removes it, and returns * it so the caller can process it further. */ public static function popSessionCookie(string $sessionName, string $sessionId): ?string { $sessionCookie = null; $sessionCookiePrefix = sprintf(' %s=', urlencode($sessionName)); $sessionCookieWithId = sprintf('%s%s;', $sessionCookiePrefix, urlencode($sessionId)); $otherCookies = []; foreach (headers_list() as $h) { if (0 !== stripos($h, 'Set-Cookie:')) { continue; } if (11 === strpos($h, $sessionCookiePrefix, 11)) { $sessionCookie = $h; if (11 !== strpos($h, $sessionCookieWithId, 11)) { $otherCookies[] = $h; } } else { $otherCookies[] = $h; } } if (null === $sessionCookie) { return null; } header_remove('Set-Cookie'); foreach ($otherCookies as $h) { header($h, false); } return $sessionCookie; } } __halt_compiler();----SIGNATURE:----qFG9i8Ztj4flb+9jkPL+nehjw6EHXnED+1tiXAdL2JxTOI/aLktgwD4wgFQGOu9gW9wAkA0ADvA9CWEePHwLJwAJftgXrGFUSFd/g2+LnhKBoESappQ1AuH51CGw8M3Q9Sxc/jmyz6iQERIOyF0wPoBAJCkO/adC+x9GloX3+6fcZcJl5SREVerIJzbRInFtmZ8ITLLI96KYFjp2LL6DJgKxQuAxw/VeMMM7nftkFPeMkfne7UDQVOMrnX6/HdS701hB/miVHvx3s3+EUp7yKthVbDYwKLCFEfcymo+AAQ8rrKtsNkTu4J0JW8V+dvJ0K3n6a8voxg7Q9OaLL9UBviwPF25g2K9dCW5Uz2FEPg6ZyQbA+uJ+U8B4J9+DAJXRJ2oKoTEKpTdblA0mcvmZQy9+p4Nga4hdWtYSt4LEjyN87mTT9vklMYL944VacNzomJF69mhxTLF3aNjKnMDj3KoqNk+oLSjaur6Fhbv4iX7dyymYtLT5NiUvNExEHukascqMN/UoKEKhdGoVy4/xv8AK0bb0GLwsr3c3snm7/yPZi1A8hsVZSEqUjs/4OXfLObXPKD/5swE8BAYy/GNGuAbhe91/e9YELn/4YgGD+rnZ7GWshT+C2Ue9zhV6FdzsIxAG/wDa17QNUhsjT3osioU2hC4qLO+ZxaFwSoLjOKA=----ATTACHMENT:----MjU5NTg4NzUyNDg4Mzk3MSA3MDg5MTk2NjAyNjIzMTE2IDQwNjE4MjcyMjI3MjEwNjk=