SessionCSRF::validate() method

Throws an exception if the token is invalid

Usage

// basic usage
$bool = $sessionCSRF->validate();

// usage with all arguments
$bool = $sessionCSRF->validate($id = '');

Arguments

NameType(s)Description
id (optional)int, string, null

Optional unique ID for this token

Return value

bool

Always returns true or throws exception

Exceptions

Method can throw exceptions on error:

  • WireCSRFException - if token not valid


SessionCSRF methods and properties

API reference based on ProcessWire core version 3.0.244

“To Drupal, or to ProcessWire? The million dollar choice. We decided to make an early switch to PW. And in retrospect, ProcessWire was probably the best decision we made. Thanks are due to ProcessWire and the amazing system and set of modules that are in place.” —Unni Krishnan, Founder of PigtailPundits