Do not access $cookie outside of $cookies loop

Created on 4 September 2019, over 5 years ago
Updated 26 March 2025, 29 days ago

Problem/Motivation

There is a clear bug in proxyAuthenticate() where loop variable $cookie is accessed outside of $cookies loop.

Proposed resolution

The simplest fix to make a working code is moving $cookie['Domain'] into the loop.

In src/Service/CasProxyHelper.php:proxyAuthenticate(),

    foreach ($cas_proxy_helper[$target_service] as $cookie) {
      $cookies[$cookie['Name']] = $cookie['Value'];
+     $domain = $cookie['Domain'];
    }
-   $domain = $cookie['Domain'];

Remaining tasks

You might also want to initialize $domain before the loop, or do isset($domain) check after the loop.

πŸ› Bug report
Status

Active

Version

3.0

Component

CAS

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024