Undefined variable $hook

My modx error log is filling up with the following:

[2023-11-07 10:50:02] (ERROR @ /www/core/cache/includes/elements/modx/revolution/modsnippet/102.include.cache.php : 48) PHP warning: Undefined variable $hook

Snippet 102 is “recaptchav2_render”

The line that is erroring is:
if ($hook) {

But I am not sure why this has started? Any ideas that can help get me back on track?

Thanks!

Probably because you updated PHP to version 8.

Apply this pull request to get rid of the warning:

1 Like

Thank you very much! This solved it. I had tried google, but had no luck.

I believe I am now experiencing the same issue with my FormIt / RecaptchaV2. Tried to implement the pull request, but still having the problem. Wondering if there is any other feedback you might have discovered. I entered if (isset($hook) && $hook instanceof fiHooks) { and then placed a closing bracket at the end,

NVM. Got it working… failed to remove the if ($hook) {
Thank you.