Jump to content

Fatal Error


Dean
 Share

Recommended Posts

I'm not sure what I've done, but I'm getting a fatal error on every page now. I've tried reverting back to an older copy of the site but there's no change. Can anybody help please?

Catchable fatal error: Argument 1 passed to ProcessWire\Users::setCurrentUser() must be an instance of ProcessWire\User, instance of ProcessWire\Page given, called in /var/www/web/wire/core/Session.php on line 188 and defined in /var/www/web/wire/core/Users.php on line 68

 

Link to comment
Share on other sites

Hi @psy, all I have in the log is

2020-06-01 10:28:59	?	http://[url].com/register/	Recoverable Fatal Error: 	Argument 1 passed to ProcessWire\Users::setCurrentUser() must be an instance of ProcessWire\User, instance of ProcessWire\Page given, called in /var/www/web/wire/core/Session.php on line 188 and defined (line 68 of /var/www/web/wire/core/Users.php)

I thought that I was maybe overwriting $user somewhere, but I've searched for $user and there are none.

Link to comment
Share on other sites

Hey @Dean,

A few more questions — it's still pretty hard to say what's going on there, except that for some reason "something" is trying to set current user as something other than User object.

  • Is this the only page on your site (/register/) that generates this error? If so, what's happening on that page?
  • Any modules involved? ?
  • Have you updated ProcessWire or your modules recently?
  • Like 1
Link to comment
Share on other sites

Hi @teppo,

  • Every single page is triggering the error, so I can't even get into PW admin
  • I've not changed/updated any modules. The only one I had installed was form builder with stripe
  • I've not update ProcessWire

It was all working fine yesterday. Then I came to look at it this morning and I'm getting this. And I was already on I tight schedule to get it done. ?

Link to comment
Share on other sites

Possibly @kongondo. But that was working apart from the name it used. So this morning I duplicated the user template again following the instructions here: https://processwire.com/blog/posts/processwire-core-updates-2.5.14/#multiple-templates-or-parents-for-users

Could a crazy user template be causing it? Can I remove it without access to admin?

Link to comment
Share on other sites

20 minutes ago, Dean said:

Can I remove it without access to admin?

Yes. Via the database.

20 minutes ago, Dean said:

So this morning I duplicated the user template again

Was site working before this change?

Link to comment
Share on other sites

2 minutes ago, kongondo said:

Was site working before this change?

Yes, it was fine last night and that's the only change I've done this morning I think.

Link to comment
Share on other sites

6 minutes ago, Dean said:

I've deleted the template from the 'templates' table but no difference.

I'm not sure how this multiple users template works but there's possibly other references to the template you deleted. I can't set up a test site now to check. Are you able to set up a duplicate remote test site (or send me a db dump of such a site) that we can have a look at? Backup your db before making any changes.

Link to comment
Share on other sites

OK, I got in (admin) with a bit of a hack ?. Would you like me to show you how so you can go make changes yourself? i.e., undo the last 'user template' thingy. Or would you like to outline what you did so I can try undo?

  • Like 1
Link to comment
Share on other sites

I think the last thing I did was to duplicate the user-hunt template and call it user-hunt2. If you think you can undo what's causing the issue then super! ?

Link to comment
Share on other sites

3 minutes ago, Dean said:

I think the last thing I did was to duplicate the user-hunt template and call it user-hunt2.

Um, nope. There is no user-hunt2 template ? Just hunts (modified 5 hours ago) and user-hunt (modified 2 days ago).

6 minutes ago, Dean said:

If you think you can undo what's causing the issue then super! ?

I had a look and nothing obvious jumps at me. All I can see via debugging (and the error), that somewhere, a user instance (ProcessWire\User) is being converted to a page (ProcessWire\Page). I am pretty sure it has to do with a change made to the settings rather than a change at a template file level (since I don't have your template files and I see the error). 

I'll have one last look and if I can't get it to work, I'll pass it to you with the details on how you can get in and undo your previous changes.

Link to comment
Share on other sites

The reason I was creating another user template was because I think there is no name field on the user-hunt template which I think is what was causing the issue with the weird name that was being added when a new user registered. Can you add the name field for me?

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...