set state error

set state error

by Nicholas Tsi -
Number of replies: 4

"Coding error detected, it must be fixed by a programmer: Invalid state passed to moodle_page::set_state. We are in state 2 and state 1 was requested."


Have anyone met such error before? And any tips how to fix it? Thanks.

Average of ratings: Useful (1)
In reply to Nicholas Tsi

Re: set state error

by Sam Hemelryk -

Hi Nicholas,

Its likely you are getting that error because some code somewhere is trying to print the page header for a second time. (A second $OUTPUT->header() call) .

If you've made code changes that would be the first thing I would look for, if you haven't changed code then it may be a bug.
To be sure you could turn on debugging:

  1. Browse to Site administration > Development
  2. Set debug messages to DEVELOPER
  3. Turn display debug messages on

If you do that and then replicate the problem you will hopefully get an error message with more information.
Also if you do think it is a bug and create a tracker issue for it itd help if you could provide instructions about how to replicate it.

Cheers
Sam 

Average of ratings: Useful (1)
In reply to Sam Hemelryk

Re: set state error

by Nicholas Tsi -

Hi Sam,

Thanks for your answer.

Currently, I would like to display login and signup in one page: index.php.

Then if I either click "Login" or "Create my new account" will call the $OUTPUT->header(), which induce my current problem.

The easiest way I found is to hide the $OUTPUT->header in line 100 of auth/email/auth.php, then the signup process will continue on the right area of "signuppanel".

 

However, is there anyway I can do to allow user click the "login" in loginpanel without affect signuppanel, and click "creat my new account" without affect loginpanel?

Please let me know if I've made you confused when I was describing..tongueout

Attachment Login Page - clean.PNG
In reply to Nicholas Tsi

Re: set state error

by Keith Spiteri -

Hi,

When I am trying to go to some of the pages (like for example Browse List of Users) it is giving me this error:

Coding error detected, it must be fixed by a programmer: Invalid state passed to moodle_page::set_state. We are in state 1 and state 1 was requested.

Can you help we, cause I'm stuck.

Thanks

Attachment Error.png
In reply to Sam Hemelryk

Re: set state error

by abhishek bhattacharjee -

thanks nicholas

 for the reply u were right about $OUTPUT->header() call) ...after removing that call it fixed my issue....