Undefined global variable $_SESSION

Using RW Classic 9.1.0 and Foundry 3 v3.2023.03.06 I added a F3 contact form in a global footer partial that is present on every page and another in dedicated “Contact” page. Although sending emails through the F3 Form stack works perfectly a Warning message is displayed on the page complaining about the $_SESSION being undefined.
Here is the affected part of the php code:

if (($_POST['csrfToken'] == $_SESSION['fdyFormToken']) && ($_POST['hc__value'] == '')) {

I remember testing this feature some days before without facing this issue. Could it be that I activated a debug feature somewhere in RW that triggers the warning?
Thanks

Do you by chance have your PHP install set to display errors and warnings? If so toggle that off in your PHP settings.

Hi Adam, thanks for your help, you helped me figure it out although I don’t remember fiddling with the php settings.
In the php.ini file I had :

error_reporting = E_ALL

which I now replace with:

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

same for:

display_errors = On

now replaced with:

display_errors = Off

No more warning message displayed and working perfectly.
Thanks

1 Like