[pmwiki-devel] Pmwiki bug in SideBars (Pm?)
The Editor
editor at fast.st
Wed Nov 22 14:26:47 CST 2006
On 11/22/06, marc <gmane at auxbuss.com> wrote:
> > 3) The reason I thought it might be in PmWiki is I only get that
> > problem when the form is in the Sidebar. Everywhere else, it always
> > works right. Seemed logical to conclude the Sidebars must process
> > code differently than the main text.
>
> I use a lot of scripts in sidebars - an awful lot - and, as a form of
> caching, I also use session variables a lot too. As such, I sometimes
> run into session-type problems with recipes, but PmWiki hasn't tripped
> me up in this area yet, so it's not a conclusion I'd jump to.
But still, it is only in the sidebars that I have any problems. So
there must be something different there than the rest of the page...
Could it have something to do with caching?
> As I'm sure you know, you need to isolate the piece of code that is
> causing the problem. The likelihood is that something - even a single
> space character - is being sent before session_start() (or
> session_register(), if you are using it) in one of your scripts
> (probably zap.php).
Here's the markup and function (in full). As best I can tell, it
happens with this markup, and not without it.
Cheers,
Caveman
Markup('zapform', '>{$var}', '/\(:zapform(.*?):\)/ei', "ZAPform('$1')");
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-$x"])) $unique = true;
}
$_SESSION[ZAPlock]["$pagename-$x"] = $l;
session_write_close();
return "(:input form$u$o:)\n(:input hidden action zap:)\n(:input
hidden ZAPkey $x:)\n";
}
More information about the pmwiki-devel
mailing list