yoastcs icon indicating copy to clipboard operation
yoastcs copied to clipboard

Forbid the usage of session functions.

Open herregroen opened this issue 2 years ago • 2 comments

In PHP the session functions by default store session date in files.

On many WordPress hosts creating files in this manner can lead to errors, either due to the amount of files being created or due the directory these files are written in not being writable to the user the PHP process is running as.

As such we should never use these functions in our plugin, other mechanisms such as options, usermeta or custom cookies should be used instead when required.

There is also a WordPress health check that detects if PHP sessions are used and throws a performance warning if this is the case, so even on hosts that do not have technical problems users will still see a failing health check due to us.

herregroen avatar Mar 22 '22 10:03 herregroen