[pmwiki-devel] Pmwiki bug with ZAP chat...

The Editor editor at fast.st
Thu Nov 16 13:51:19 CST 2006


On 11/12/06, The Editor <editor at fast.st> wrote:
> On 11/11/06, Crisses <crisses at kinhost.org> wrote:
> > Could it be that you're starting a session when PmWiki has already
> > started a session?
>
> Yes, I thought about that, though the error message says the problem
> is with output...  Also, the session_start functon according to the
> php docs seems to be fine with resuming a session once started...
>
> "session_start() creates a session or resumes the current one based on
> the current session id that's being passed via a request, such as GET,
> POST, or a cookie."
>
> The part of the warning about session not being able to send the cache
> limiter caught my eye, along with these lines also from the php docs:
>
> " The cache limiter is reset to the default value stored in
> session.cache_limiter  at request startup time. Thus, you need to call
> session_cache_limiter() for every request (and before session_start()
> is called)."
>
> Still, the overall gist of the error message seems to be that PmWiki
> is producing output before the markup is all processed (namely the zap
> forms markup which should assign its session variables).  Help?
>
> Cheers,
> Caveman


Could this be caused by having two calls to session_start in one page?
 It seems the problem occurred when I had two zap forms on the same
page.  When I moved them around to sidebar, groupfooter, main page,
etc., one each the problem cleared up.

If so I wonder if I should have added some kind of session_close or
something to the end.  The following lines are called for each
instance of (:zapform:)...  So two forms would call this function
twice.

Cheers,
Caveman



function ZAPform($d) {
	global $pagename;
	if (strpos($d, "`")) $l = substr($d, strpos($d, ' `') + 2, strpos($d,
'` ') - 2);
	else $l = "nolock";
	$u = "";
	if (strpos($d, "upload")) $u = " method=post enctype=multipart/form-data";
	$o = "";
	if (strpos($d, "orderform")) $o .= " name=orderform";
	$unique = false;
	session_start();
	while (!$unique) {
		$x = rand(100000,999999);
		if (! isset($_SESSION[ZAPlock]["$pagename-$GLOBALS[AuthId]-$x"]))
$unique = true;
		}
	$_SESSION[ZAPlock]["$pagename-$GLOBALS[AuthId]-$x"] = $l;
	return "(:input form$u$o:)\n(:input hidden action zap:)\n(:input
hidden ZAPkey $x:)\n";
	}



More information about the pmwiki-devel mailing list