Summary:
Deprecated: Return type of Captcha\config
Detailed Description:
Under PHP 8.4.6
Deprecated: Return type of Captcha\config::offsetExists($key) should either be
compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the
#[\ReturnTypeWillChange] attribute should be used to temporarily suppress the
notice in modules\Captcha\lib\class.config.php on line 130
This warning occurs because PHP 8.1 and later now enforce strict return types
for internal interfaces like ArrayAccess. Your implementation of offsetExists,
offsetGet, offsetSet, and offsetUnset does not specify the return types required
by the PHP engine.
To fix this and future-proof your code, you should add the : bool (or void)
return types to these methods.
The Fix :
Open modules\Captcha\lib\class.config.php and update the methods as follows:
public function offsetExists($key): bool
{
return ( isset(self::$_data[$key]) ||
self::$_CMSMS_CFG->offsetExists($key) );
}
public function offsetGet($key): mixed
{
if(self::$_CMSMS_CFG->offsetExists($key)) return self::$_CMSMS_CFG[$key];
if(isset(self::$_data[$key]))
{
return self::$_data[$key];
}
return null;
}
public function offsetSet($key, $value): void
{
trigger_error( 'Read Only', E_USER_ERROR );
}
public function offsetUnset($key): void
{
trigger_error( 'Read Only', E_USER_ERROR );
}
Why this is necessary:
offsetExists: Must return a bool (true/false).
offsetGet: Returns mixed (the value stored at that key).
offsetSet and offsetUnset: Do not return values, so they must be typed as :
void.