Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working on Hogfather rc #5

Closed
timatengage opened this issue Jun 2, 2020 · 15 comments
Closed

Not working on Hogfather rc #5

timatengage opened this issue Jun 2, 2020 · 15 comments
Labels

Comments

@timatengage
Copy link

Updated my wiki to the Hogfather release candidate and my columns are no longer columns. They wrap under each other.

@gdighton
Copy link

gdighton commented Jun 2, 2020

I don't even get that much - upon update to Hogfather, I can no longer access my wiki at all, as the webserver (nginx) receives a fatal error from PHP and returns nothing but an empty page for all pages.

From the webserver's error log (with identifying information censored):

2020/06/02 16:13:01 [error] 28576#28576: *274 FastCGI sent in stderr: "PHP message: PHP Fatal error: Declaration of syntax_plugin_columnlist::handle$($match, $state, $pos, &$handler) must be compatible with dokuwiki\Extension\SyntaxPlugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/wiki/dokuwiki/lib/plugins/columnlist/syntax.php on line 0" while reading response header from upstream, client: XXX.XXX.X.XXX, server: XXXXX, request: "GET /dokuwiki/ HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.3-fpm.sock:", host: "XXX.XXXX.XXX"

@timatengage
Copy link
Author

I don't even get that much - upon update to Hogfather, I can no longer access my wiki at all, as the webserver (nginx) receives a fatal error from PHP and returns nothing but an empty page for all pages.

From the webserver's error log (with identifying information censored):

2020/06/02 16:13:01 [error] 28576#28576: *274 FastCGI sent in stderr: "PHP message: PHP Fatal error: Declaration of syntax_plugin_columnlist::handle$($match, $state, $pos, &$handler) must be compatible with dokuwiki\Extension\SyntaxPlugin::handle($match, $state, $pos, Doku_Handler $handler) in /var/www/wiki/dokuwiki/lib/plugins/columnlist/syntax.php on line 0" while reading response header from upstream, client: XXX.XXX.X.XXX, server: XXXXX, request: "GET /dokuwiki/ HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.3-fpm.sock:", host: "XXX.XXXX.XXX"

I had a similar error with another plugin, removed the plugin folder and it started working again. It doesn't look like @dwp-forge has been active on github since 2016 so unlikely to be fixed.

@arlt
Copy link

arlt commented Jun 3, 2020

Content is displayed, but no columns and no alignment. One empty line after each column/row.

Example code:

<columns 100% 50% - ->
First column text (50% width).
<newcolumn>
Second column text.
<newcolumn>
Third column text.
</columns>
<columns 100% 25% 25%* *-* *->
First column with justified text.
<newcolumn>
Second column is aligned on the left side.
<newcolumn>
Third column is center-aligned.
<newcolumn>
Fourth column is aligned on the right side.
</columns>

Log (warnings only):

PHP message: PHP Warning:  Use of undefined constant DOKU_LEXER_ENTER - assumed 'DOKU_LEXER_ENTER' (this will throw an Error in a future version of PHP) in /var/www/dokuwiki/lib/plugins/columns/syntax.php on line 49
PHP message: PHP Warning:  Use of undefined constant DOKU_LEXER_MATCHED - assumed 'DOKU_LEXER_MATCHED' (this will throw an Error in a future version of PHP) in /var/www/dokuwiki/lib/plugins/columns/syntax.php on line 50
PHP message: PHP Warning:  Use of undefined constant DOKU_LEXER_EXIT - assumed 'DOKU_LEXER_EXIT' (this will throw an Error in a future version of PHP) in /var/www/dokuwiki/lib/plugins/columns/syntax.php on line 51', referer: https://fqdn/wiki/plugins

@splitbrain
Copy link
Contributor

The problem @gdighton is describing is not a Hogfather related problem but simply the result of PHP's stricter signature checking since 7.x. Signatures of the plugins need adjustment.

@arlt's problem is indeed a problem, however I have no idea why those constants shouldn't be defined. They still exist in Hogfather.

@dwp-forge
Copy link
Owner

@splitbrain, now I got you where I want you ;)

I saw this issue months ago but I was waiting for release to see if it will get resolved somehow. Actually, I expected that lots of syntax plugins will be affected by it, but apparently I do something not according to the book even though I pretty much follow the skeleton (BTW, it's time to update the deprecated require_once).

The thing is that before refactoring syntax plugins would require lib/plugins/syntax.php, which would auto-load inc/parser/parser.php, which would require inc/parser/lexer.php. This way DOKU_LEXER_* constants would be defined by just requiring syntax.php.

Now in our new shiny auto-load land syntax.php is deprecated and per my understanding inc/Extension/SyntaxPlugin.php auto-loads bunch of stuff related to Handler and Renderer, but Lexer somehow is not involved at that stage. So it looks like by the time plugin's constructor is executed, no one yet asked for Lexer class and it didn't get auto-loaded. And as a side effect the constants are not defined. Unfortunately, auto-loader doesn't know anything about them.

I can work it around by explicitly requiring inc/Parsing/Lexer/Lexer.php but that goes against the auto-loading paradigm. Also to me this looks like a broken contract between framework and plugin, so I was wondering if something will be done on the framework side to address this issue.

Any thoughts on that?

splitbrain added a commit to dokuwiki/dokuwiki that referenced this issue Jun 4, 2020
As described in
dwp-forge/columns#5 (comment)
sometime the Lexer constants have not been (auto)loaded when a syntax plugin
is invoked (I'm not sure why).

In general PSR2 discourages a mix of main code and function/class setup
with the call to define() being considered main code.

This patch moves these the define calls to a separate new file, solving
both of the above problems.

These are not all our defines. Instead I focused on the ones that are
ENUM-like.

In the future we should think about what defines can be replaced by
class constants and what other define() calls should be moved.
@dwp-forge dwp-forge added the bug label Jun 4, 2020
@gdighton
Copy link

gdighton commented Jun 9, 2020

Still not working on latest RC due to the signature issue. @splitbrain claims this is a php issue, but php version is the same whether I'm using Greebo or Hogfather, and it's only a fatal error on Hogfather:

$ php --version
PHP 7.3.14-1deb10u1 (cli) (built: Feb 16 2020 15:07:23) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.14, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.14-1
deb10u1, Copyright (c) 1999-2018, by Zend Technologies

@dwp-forge
Copy link
Owner

Fixed upstream in Hogfather RC3.

@dwp-forge
Copy link
Owner

@gdighton, I tested on PHP 7.2 and that seem to work fine. Based on my analysis of the issue and the way it was addressed in RC3 it looks to me that the problem should be properly fixed. Unless someone else will be able to reproduce it, I would assume there's some local problem on your setup.

If you feel like debugging it, you could check which files are included before you run into the problem. Per my understanding, new file inc/defines.php is included unconditionally, so it should be there:

  0 => '/home/dwp-forge/hogfather/doku.php',
  1 => '/home/dwp-forge/hogfather/inc/init.php',
  2 => '/home/dwp-forge/hogfather/inc/config_cascade.php',
  3 => '/home/dwp-forge/hogfather/conf/dokuwiki.php',
  4 => '/home/dwp-forge/hogfather/conf/local.php',
  5 => '/home/dwp-forge/hogfather/conf/license.php',
  6 => '/home/dwp-forge/hogfather/vendor/autoload.php',
  7 => '/home/dwp-forge/hogfather/vendor/composer/autoload_real.php',
  8 => '/home/dwp-forge/hogfather/vendor/composer/ClassLoader.php',
  9 => '/home/dwp-forge/hogfather/vendor/composer/autoload_static.php',
  10 => '/home/dwp-forge/hogfather/vendor/openpsa/universalfeedcreator/lib/constants.php',
  11 => '/home/dwp-forge/hogfather/vendor/paragonie/random_compat/lib/random.php',
  12 => '/home/dwp-forge/hogfather/vendor/phpseclib/phpseclib/phpseclib/bootstrap.php',
  13 => '/home/dwp-forge/hogfather/inc/load.php',
  14 => '/home/dwp-forge/hogfather/inc/defines.php',  <------ This one
  15 => '/home/dwp-forge/hogfather/inc/actions.php',
  16 => '/home/dwp-forge/hogfather/inc/changelog.php',
  17 => '/home/dwp-forge/hogfather/inc/common.php',
...

@gdighton
Copy link

Unfortunately, going back to PHP7.2 is not an option.

RC3 might have fixed the "Use of undefined constant" warnings, but it hasn't fixed the "Declaration of syntax_plugin_columnlist::handle$($match, $state, $pos, &$handler) must be compatible with dokuwiki\Extension\SyntaxPlugin::handle($match, $state, $pos, Doku_Handler $handler)" issue.

@dwp-forge
Copy link
Owner

But that's a different issue, right? ;)

@dwp-forge dwp-forge reopened this Jun 10, 2020
@dwp-forge
Copy link
Owner

@gdighton, the issue you are referring to was fixed back in 2016 (ba67726). Please make sure that you run latest version of the plugin. Verified on PHP 7.4.

@gdighton
Copy link

According to the Extension Manager, I am using the latest (and I installed the plugin less than a year ago.)

Plugin.info.txt says:
base columns
author Mykola Ostrovskyy
email spambox03@mail.ru
date 2016-09-07
name Columns Plugin
desc Arrange information in multiple columns.
url http://www.dokuwiki.org/plugin:columns

@dwp-forge
Copy link
Owner

That looks good. Now what about plugin name in your problem report? Let's make sure it's named "columns" and not something else. Like "columnlist" or something ;)

@arlt
Copy link

arlt commented Jun 16, 2020

@splitbrain @dwp-forge fixed with RC3

@gdighton
Copy link

@dwp-forge Ah, dang - looks like I misread it way back when... Now I have to find their github page :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants