public function handle_invalid_state($r)
{
JAXLLogger::error(sprintf("got invalid return value from state handler '%s', sending end stream...", $this->state));
$this->send_end_stream();
$this->state = "logged_out";
JAXLLogger::notice(sprintf("state handler '%s' returned %s, kindly report this to developers", $this->state, serialize($r)));
}