0

My moodle gave 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 0 and state 3 was requested."

I googled for a bit, but couldn't find an exact solution for this error. I have never encountered it myself before. If you need any extra information on the code or file, be sure to tell me.

1 Answer 1

3

This can happen if $OUTPUT->footer() is called but $OUTPUT->header() hasn't. The page should be in one of these states:

/** The state of the page before it has printed the header **/
const STATE_BEFORE_HEADER = 0;

/** The state the page is in temporarily while the header is being printed **/
const STATE_PRINTING_HEADER = 1;

/** The state the page is in while content is presumably being printed **/
const STATE_IN_BODY = 2;

/**
 * The state the page is when the footer has been printed and its function is
 * complete.
 */
const STATE_DONE = 3;

Probably some custom code. Switch on debugging to developer level to find out where. In your config.php add

$CFG->debug = E_ALL | E_STRICT;
$CFG->debugdisplay = true;
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! I didn't notice that my $OUTPUT->header() was actually just plainly missing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.