[pmwiki-users] New recipe: Fox

marc gmane at auxbuss.com
Tue Dec 19 13:20:17 CST 2006


Hans said...
> Tuesday, December 19, 2006, 6:24:18 PM, marc wrote:
> 
> > So, the question is - probably for Pm - in what circumstances can 
> > UpdatePage receive identical input, yet produce different results?
> 
> I take it that your problem with page save is only with fox.php, and
> you can save pages fine from the normal edit window.

Yes.
> 
> I don't know if calling the Lock function does make a difference,
> i.e. HandelEdit calls Lock before calling UpdatePage, in fox.php Lock
> is not called. When Pm wrote about how to use UpdatePage he did  not
> mention Lock. But it may be an idea to try and add Lock(2); at the
> beginning of FixHandlePost, and Lock(0); at the end of the function
> before Redirect, and see what happens? Just guessing, as I have no
> clue.

My method is always to isolate the problem, then start hacking :-) 
Hopefully, the issue will be obvious once isolated.

The problem occurs in PostPage(). Below are the debug results from the 
(now) usual identical runs, first logged out, second logged in.

All is identical until after calling PostPage(). At this point, in the 
failing case, $new has become truncated:

$new:Array\n(\n    [version] => pmwiki-2.2.0-beta17 ordered=1 
urlencoded=1\n    [agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; 
en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6\n    [author] => 
auxbuss\n    [csum] => \n    [ctime] => 1166370453\n    [host] => 
192.168.0.1\n    [name] => Testing.Comments\n    [rev] => 45\n    
[targets] => \n    [text] => \n    [time] => 1166553945\n)\n

Whereas the successful delete comment returns:

$new:Array\n(\n    [version] => pmwiki-2.2.0-beta17 ordered=1 
urlencoded=1\n    [agent] => Mozilla/5.0 (Windows; U; Windows NT 5.1; 
en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6\n    [author] => 
auxbuss\n    [csum] => \n    [ctime] => 1166370453\n    [host] => 
192.168.0.1\n    [name] => Testing.Comments\n    [rev] => 45\n    
[targets] => \n    [text] => \n    [time] => 1166553945\n    
[author:1166554002] => auxbuss\n    [host:1166554002] => 192.168.0.1\n    
[diff:1166554002:1166553945:] => 0a1,16\n> \n> #foxbegin 
1166553937a70703b0#[[#fox1]]\n> (:div1 class=messagehead:)\n> >>div2 
rfloat<< \n> (:if expr ( auth admin || author marc ):){[foxdelrange 
button 1166553937a70703b0 {$FullName} ]}(:if:)\n> >>div2end<<\n> >>div3 
rfloat<<  \n> [-19.12.2006 - 18:45-] &nbsp; \n> >>div3end<<\n> !!!!!marc
\n> (:div1end:) \n> >>messageitem<< \n> '''subject'''\n> >>messageitem
<<\n> message\n> >><<#foxend 1166553937a70703b0#\n\n)\n

Nice big clue!

Looking at PostPage(), it's clear that $EnablePost is not true in the 
failing case.

-- 
Best,
Marc

[1] Here is UpdatePage for reference:

function UpdatePage($pagename, &$page, &$new, $fnlist = NULL) {
  global $EditFunctions, $IsPagePosted;
  if (is_null($fnlist)) $fnlist = $EditFunctions;
  $IsPagePosted = false;
  error_log('Entering UpdatePage');
  foreach((array)$fnlist as $fn) {
	  error_log("************ Calling $fn ***************");
	  error_log('$pageame:'.$pagename);
	  error_log('$page:'.print_r($page,true));
	  error_log('$new:'.print_r($new,true));
	  $fn($pagename, $page, $new);
	  error_log("************ After calling $fn ***************");
	  error_log('$pageame:'.$pagename);
	  error_log('$page:'.print_r($page,true));
	  error_log('$new:'.print_r($new,true));
  	  if ($IsPagePosted) error_log('$IsPagePosted=true');
	  	  else error_log('$IsPagePosted=false');
  }
  error_log('Exiting UpdatePage');
  if ($IsPagePosted) error_log('$IsPagePosted=true');
  else error_log('$IsPagePosted=false');
  return $IsPagePosted;
}

Logged out:

[Tue Dec 19 18:46:19 2006] [error] [client 192.168.0.1] ************ 
Calling PostPage ***************, referer: http://niff/
~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:19 2006] [error] [client 192.168.0.1] 
$pageame:Testing.Comments, referer: http://niff/
~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:19 2006] [error] [client 192.168.0.1] $page:Array\n(\n    
[version] => pmwiki-2.2.0-beta17 ordered=1 urlencoded=1\n    [agent] => 
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) 
Gecko/20060728 Firefox/1.5.0.6\n    [author] => auxbuss\n    [csum] => 
\n    [ctime] => 1166370453\n    [host] => 192.168.0.1\n    [name] => 
Testing.Comments\n    [rev] => 45\n    [targets] => \n    [text] => 
\n#foxbegin 1166553937a70703b0#[[#fox1]]\n(:div1 class=messagehead:)\n>>
div2 rfloat<< \n(:if expr ( auth admin || author marc ):){[foxdelrange 
button 1166553937a70703b0 {$FullName} ]}(:if:)\n>>div2end<<\n>>div3 
rfloat<<  \n[-19.12.2006 - 18:45-] &nbsp; \n>>div3end<<\n!!!!!marc\n
(:div1end:) \n>>messageitem<< \n'''subject'''\n>>messageitem<<\nmessage
\n>><<#foxend 1166553937a70703b0#\n\n    [time] => 1166553945\n)\n, 
referer: http://niff/~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:19 2006] [error] [client 192.168.0.1] $new:Array\n(\n    
[version] => pmwiki-2.2.0-beta17 ordered=1 urlencoded=1\n    [agent] => 
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) 
Gecko/20060728 Firefox/1.5.0.6\n    [author] => auxbuss\n    [csum] => 
\n    [ctime] => 1166370453\n    [host] => 192.168.0.1\n    [name] => 
Testing.Comments\n    [rev] => 45\n    [targets] => \n    [text] => \n    
[time] => 1166553945\n)\n, referer: http://niff/
~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:19 2006] [error] [client 192.168.0.1] ************ 
After calling PostPage ***************, referer: http://niff/
~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:19 2006] [error] [client 192.168.0.1] 
$pageame:Testing.Comments, referer: http://niff/
~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:19 2006] [error] [client 192.168.0.1] $page:Array\n(\n    
[version] => pmwiki-2.2.0-beta17 ordered=1 urlencoded=1\n    [agent] => 
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) 
Gecko/20060728 Firefox/1.5.0.6\n    [author] => auxbuss\n    [csum] => 
\n    [ctime] => 1166370453\n    [host] => 192.168.0.1\n    [name] => 
Testing.Comments\n    [rev] => 45\n    [targets] => \n    [text] => 
\n#foxbegin 1166553937a70703b0#[[#fox1]]\n(:div1 class=messagehead:)\n>>
div2 rfloat<< \n(:if expr ( auth admin || author marc ):){[foxdelrange 
button 1166553937a70703b0 {$FullName} ]}(:if:)\n>>div2end<<\n>>div3 
rfloat<<  \n[-19.12.2006 - 18:45-] &nbsp; \n>>div3end<<\n!!!!!marc\n
(:div1end:) \n>>messageitem<< \n'''subject'''\n>>messageitem<<\nmessage
\n>><<#foxend 1166553937a70703b0#\n\n    [time] => 1166553945\n)\n, 
referer: http://niff/~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:19 2006] [error] [client 192.168.0.1] $new:Array\n(\n    
[version] => pmwiki-2.2.0-beta17 ordered=1 urlencoded=1\n    [agent] => 
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) 
Gecko/20060728 Firefox/1.5.0.6\n    [author] => auxbuss\n    [csum] => 
\n    [ctime] => 1166370453\n    [host] => 192.168.0.1\n    [name] => 
Testing.Comments\n    [rev] => 45\n    [targets] => \n    [text] => \n    
[time] => 1166553945\n)\n, referer: http://niff/
~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:19 2006] [error] [client 192.168.0.1] 
$IsPagePosted=false, referer: http://niff/~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:19 2006] [error] [client 192.168.0.1] ************ 
Calling PostRecentChanges ***************

Logged in:

[Tue Dec 19 18:46:42 2006] [error] [client 192.168.0.1] ************ 
Calling PostPage ***************, referer: http://niff/
~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:42 2006] [error] [client 192.168.0.1] 
$pageame:Testing.Comments, referer: http://niff/
~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:42 2006] [error] [client 192.168.0.1] $page:Array\n(\n    
[version] => pmwiki-2.2.0-beta17 ordered=1 urlencoded=1\n    [agent] => 
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) 
Gecko/20060728 Firefox/1.5.0.6\n    [author] => auxbuss\n    [csum] => 
\n    [ctime] => 1166370453\n    [host] => 192.168.0.1\n    [name] => 
Testing.Comments\n    [rev] => 45\n    [targets] => \n    [text] => 
\n#foxbegin 1166553937a70703b0#[[#fox1]]\n(:div1 class=messagehead:)\n>>
div2 rfloat<< \n(:if expr ( auth admin || author marc ):){[foxdelrange 
button 1166553937a70703b0 {$FullName} ]}(:if:)\n>>div2end<<\n>>div3 
rfloat<<  \n[-19.12.2006 - 18:45-] &nbsp; \n>>div3end<<\n!!!!!marc\n
(:div1end:) \n>>messageitem<< \n'''subject'''\n>>messageitem<<\nmessage
\n>><<#foxend 1166553937a70703b0#\n\n    [time] => 1166553945\n)\n, 
referer: http://niff/~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:42 2006] [error] [client 192.168.0.1] $new:Array\n(\n    
[version] => pmwiki-2.2.0-beta17 ordered=1 urlencoded=1\n    [agent] => 
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) 
Gecko/20060728 Firefox/1.5.0.6\n    [author] => auxbuss\n    [csum] => 
\n    [ctime] => 1166370453\n    [host] => 192.168.0.1\n    [name] => 
Testing.Comments\n    [rev] => 45\n    [targets] => \n    [text] => \n    
[time] => 1166553945\n)\n, referer: http://niff/
~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:42 2006] [error] [client 192.168.0.1] ************ 
After calling PostPage ***************, referer: http://niff/
~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:42 2006] [error] [client 192.168.0.1] 
$pageame:Testing.Comments, referer: http://niff/
~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:42 2006] [error] [client 192.168.0.1] $page:Array\n(\n    
[version] => pmwiki-2.2.0-beta17 ordered=1 urlencoded=1\n    [agent] => 
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) 
Gecko/20060728 Firefox/1.5.0.6\n    [author] => auxbuss\n    [csum] => 
\n    [ctime] => 1166370453\n    [host] => 192.168.0.1\n    [name] => 
Testing.Comments\n    [rev] => 45\n    [targets] => \n    [text] => 
\n#foxbegin 1166553937a70703b0#[[#fox1]]\n(:div1 class=messagehead:)\n>>
div2 rfloat<< \n(:if expr ( auth admin || author marc ):){[foxdelrange 
button 1166553937a70703b0 {$FullName} ]}(:if:)\n>>div2end<<\n>>div3 
rfloat<<  \n[-19.12.2006 - 18:45-] &nbsp; \n>>div3end<<\n!!!!!marc\n
(:div1end:) \n>>messageitem<< \n'''subject'''\n>>messageitem<<\nmessage
\n>><<#foxend 1166553937a70703b0#\n\n    [time] => 1166553945\n)\n, 
referer: http://niff/~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:42 2006] [error] [client 192.168.0.1] $new:Array\n(\n    
[version] => pmwiki-2.2.0-beta17 ordered=1 urlencoded=1\n    [agent] => 
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) 
Gecko/20060728 Firefox/1.5.0.6\n    [author] => auxbuss\n    [csum] => 
\n    [ctime] => 1166370453\n    [host] => 192.168.0.1\n    [name] => 
Testing.Comments\n    [rev] => 45\n    [targets] => \n    [text] => \n    
[time] => 1166553945\n    [author:1166554002] => auxbuss\n    
[host:1166554002] => 192.168.0.1\n    [diff:1166554002:1166553945:] => 
0a1,16\n> \n> #foxbegin 1166553937a70703b0#[[#fox1]]\n> (:div1 
class=messagehead:)\n> >>div2 rfloat<< \n> (:if expr ( auth admin || 
author marc ):){[foxdelrange button 1166553937a70703b0 {$FullName} ]}
(:if:)\n> >>div2end<<\n> >>div3 rfloat<<  \n> [-19.12.2006 - 18:45-] 
&nbsp; \n> >>div3end<<\n> !!!!!marc\n> (:div1end:) \n> >>messageitem<< 
\n> '''subject'''\n> >>messageitem<<\n> message\n> >><<#foxend 
1166553937a70703b0#\n\n)\n, referer: http://niff/
~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:42 2006] [error] [client 192.168.0.1] 
$IsPagePosted=true, referer: http://niff/~marc/Marc/Testing/CommentBox
[Tue Dec 19 18:46:42 2006] [error] [client 192.168.0.1] ************ 
Calling PostRecentChanges ***************









More information about the pmwiki-users mailing list