Fix support of phpCAS >= 1.6

This commit is contained in:
Benjamin Renard 2024-07-30 13:44:21 +02:00
parent d16e6064c9
commit ec756111c6
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -254,7 +254,26 @@ if (is_writable($phpCAS_logfile) || (!is_file($phpCAS_logfile) && is_writable(di
phpCAS::setDebug($phpCAS_logfile);
}
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_servers[$cas_host]['port'], $cas_servers[$cas_host]['context']);
// phpCAS client initialization
$init_args = [
CAS_VERSION_2_0,
$cas_host,
$cas_servers[$cas_host]['port'],
$cas_servers[$cas_host]['context'],
];
// Note: Determine phpCAS version to correctly handle the $service_base_url parameter added in 1.6.0.
// Note: this parameter is also required for Debian Buster 1.3.6-1+deb10u1 package, because
// to fix CVE-2022-39369, this version was patched and this parameter have been added. Use Reflection
// to correctly handle this case.
$init_method = new ReflectionMethod("phpCAS", "client");
if (
intval(str_replace('.', '000', phpCAS::getVersion()).'000') >= 100060000000
|| $init_method->getNumberOfRequiredParameters() > 4
)
$init_args[] = $service_url;
call_user_func_array(["phpCAS", "client"], $init_args);
phpCAS::setFixedServiceURL($service_url);
// Set extra CURL options