Jump to content

"Error: Call to undefined method Session::addHookAfter()" after POST-REQUEST


flow84
 Share

Recommended Posts

Hi everyone,

I have a problem using the processwire api in my own system. I use it to configure some special pages (texts, images and so on). Everything is working fine so far. Except when I'm doing a POST-Request (a search for example). The request has nothing to do with processwire. 

As soon as I do a POST-Request I'm getting the following error-message:

Fatal error: Call to undefined method Session::addHookAfter() in MY_PROCESSWIRE_PATH\wire\modules\Session\SessionLoginThrottle\SessionLoginThrottle.module on line 50

Error: Call to undefined method Session::addHookAfter() (line 50 of MY_PROCESSWIRE_PATH\wire\modules\Session\SessionLoginThrottle\SessionLoginThrottle.module) 

This error message was shown because site is in debug mode ($config->debug = true; in /site/config.php). Error has been logged.

Here is my desperate attempt to workaround the problem ;)

//dirty workaround ahead

$postData = $_POST; //save post data

$_POST = array(); //clear $_POST

include("../../processwire/index.php"); //include doesn't throw error

$_POST = $postData; //write it back

So what's the reason for the problem? 

Thanks in advance!

Link to comment
Share on other sites

Which version of ProcessWire do you use? Do you use any modules or custom code, which could interfere there? Especially things that manipulate the session. Session extends Wire and Wire does have a public function addHookAfter(), so there's really not much to break on the way as long as $this->session is intact.

Link to comment
Share on other sites

Thanks for the quick reply!

I think I've found the problem. It's a simple namespace conflict :rolleyes:  The system already has a class named "Session".

So I've copied and renamed processwire's class "Session" to "PWSession". Now it works. Are there any objections?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...