Not logged in. · Lost password · Register
Forum: General Help and Support Features and Functionality RSS
Bureaucracy and debugging
Avatar
MartinR #1
Member since Jul 2015 · 190 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Subject: Bureaucracy and debugging
I'm trying to get an action script to run in bureaucracy and am having problems with both bureaucracy and debugging.

I copied the example from https://www.dokuwiki.org/plugin:bureaucracy#script_mode and put it in /var/www/html/dokuwiki/conf/plugin/bureaucracy/example.php.  Mode is 750, owner apache:apache, SELinux is Permissive.

I then added the example lines into my playground.  I see the box containing the textbox and the submission button.  When I write something and press the button I get a partial screen (Welcome notice and "you are here" line) but nothing else.

I have tried the following:
  • Adding ~~NOCACHE~~ to the page
  • Turned on ALLOWDEBUG in the configuration manager
  • Tried &do=debug and &httpdebug on the URL

I see nothing in the cache directory (or indeed anywhere else in the DW tree) resembling a debug log.  In the third case above I see lots of debugging information (but no error statement) displayed on the screen, not what I was expecting but probably correct.

I then turned to DW's accounting/audit log, but there was nothing of relevance.  Going to /var/log/httpd the access log has:
::1 - - [15/Mar/2020:15:09:00 +0000] "POST /dokuwiki/doku.php?id=playground:playground HTTP/1.1" 200 4273 "http://localhost/dokuwiki/doku.php?id=playground:playground" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
and the error log has:
[Sun Mar 15 15:09:00.592196 2020] [:error] [pid 31360] [client ::1:60242] PHP Parse error:  syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/html/dokuwiki/lib/plugins/bureaucracy/helper/actionscript.php on line 45, referer: http://localhost/dokuwiki/doku.php?id=playground:playground

I looked at line 45 of /var/www/html/dokuwiki/lib/plugins/bureaucracy/helper/actionscript.php and it contains
if (!is_a($handler, dokuwiki\plugin\bureaucracy\interfaces\bureaucracy_handler_interface::class)) {
so the error report makes some sense.

To sum up:
1) Is there a bug in bureaucracy that is stopping it from handling action scripts?
2) Is the documented example at fault?
3) How on earth do you get DW to give meaningful debug messages/log entries?

Thanks.
Avatar
MartinR #2
Member since Jul 2015 · 190 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Bump?
Avatar
schplurtz (Moderator) #3
Member since Nov 2009 · 517 posts · Location: France, Finistère
Group memberships: Global Moderators, Members
Show profile · Link to this post
Hi,

[Sun Mar 15 15:09:00.592196 2020] [:error] [pid 31360] [client ::1:60242] PHP Parse error:  syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/html/dokuwiki/lib/plugins/bureaucracy/helper/actionscript.php on line 45, referer: http://localhost/dokuwiki/doku.php?id=playground:playground
Do you by any chance use a PHP older than 5.5 ? the ::class syntax appeared in 5.5.

I'm absolutely not sure I'm not suggesting something stupid here, but could you try to modify line 45 of /var/www/html/dokuwiki/lib/plugins/bureaucracy/helper/actionscript.php so it reads this :

if (!is_a($handler, 'dokuwiki\\plugin\\bureaucracy\\interfaces\\bureaucracy_handler_interface')) {
Avatar
MartinR #4
Member since Jul 2015 · 190 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Right, that's one problem solved: PHP 5.4.16 (cli) (built: Nov  1 2019 16:04:20)  I run CentOS and my main machine is on CentOS 7.7.1908.  I have a virtual machine for test purposes running PHP 7.2.11 (cli) (built: Oct  9 2018 15:09:36) ( NTS ) so I'll try development there.

That sorts out why bureaucracy is having problems, any ideas on getting debuggin to work?

Thanks
Avatar
schplurtz (Moderator) #5
Member since Nov 2009 · 517 posts · Location: France, Finistère
Group memberships: Global Moderators, Members
Show profile · Link to this post
That sorts out why bureaucracy is having problems, any ideas on getting debuggin to work?
whenever I need to debug my own little PHP  code, I use DW msg function. Say I need to check the content of $variable, I'll use this code :
msg('<pre>'.hsc(print_r($variable,true)).'</pre>');

Some may find this ugly, but it works well enough for me.
I have  absolutely no idea how to activate all the debugging things you try to turn on. Sorry.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-04-02, 21:00:35 (UTC +02:00)