moodle_page::set_state : Invalid state error.

moodle_page::set_state : Invalid state error.

by Bhargava S -
Number of replies: 2

Hi,

In a page in a local plugin, I get error for $OUTPUT->header(); :

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.

I have checked at this earlier thread :

https://moodle.org/mod/forum/discuss.php?d=197321

that the cause could be a second call to $OUTPUT->header();

But there is no second call.

Also, what is puzzling and surprising is that there is error in all other pages, including, similar other local plugins, error is only for this local plugin page.

Also, I tried $OUTPUT->has_started() , it returns false.

Also, $PAGE->state is 0 , just before call to header.

Moodle version 2.8

Please help and guide.





Average of ratings: -
In reply to Bhargava S

Re: moodle_page::set_state : Invalid state error.

by Bhargava S -

Hi All,

I meant "No" error in all other pages, including, similar other local plugins, error is only for this local plugin page.

Please help.

Regards.


In reply to Bhargava S

Re: moodle_page::set_state : Invalid state error.

by Bhargava S -
Hi All,

Got fixed; actually that particular local plugin page was getting called twice...
because, I had included the same file elsewhere in the project flow, as part
of earlier efforts on that page.

So, the answer from the thread I  referred  in the question,that $OUTPUT->header();
was getting called twice, is correct.

Regards.