Page MenuHomePhabricator

Access to undeclared static property: GeSHi::$compatibleLexers
Closed, ResolvedPublic

Description

Hi all,

I've upgraded to latest Mediawiki 1.27 and used latest SyntaxHighlight_GeSHi plugin (SyntaxHighlight_GeSHi-REL1_27-20c4ad5.tar.gz).

I'm having the following error :

[Thu Jul 07 14:02:38 2016] [error] [client 10.20.33.235] PHP Fatal error: Access to undeclared static property: GeSHi::$compatibleLexers in /home/prodmediawiki-1.27.0/extensions/SyntaxHighlight_GeSHi/ResourceLoaderGeSHiVisualEditorModule.php on line 52, referer: <censored adress>

Do you have a clue what could go wrong here?

Thanks!

Event Timeline

Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJul 7 2016, 12:06 PM
Paladox added a subscriber: Paladox.Jul 7 2016, 1:07 PM
TheDJ closed this task as Invalid.Apr 27 2017, 1:50 PM
TheDJ added a subscriber: TheDJ.

We've not had further reports on this, and this part of the code has since changed.

Please reopen if this still occurs with current versions of the extension

Alwaysink added a comment.EditedApr 27 2017, 2:42 PM

Hello,

The problem still exists even after having upgraded and reloaded httpd :

[Thu Apr 27 16:40:05 2017] [error] [client <ip>] PHP Fatal error: Access to undeclared static property: GeSHi::$compatibleLexers in /home/<folder>/extensions/SyntaxHighlight_GeSHi/ResourceLoaderGeSHiVisualEditorModule.php on line 52, referer: <referer>

[root@<server> extensions]# cat SyntaxHighlight_GeSHi/version
SyntaxHighlight_GeSHi: REL1_27
2017-04-06T23:10:32

a88c5e1

Can you please reopen ?

TheDJ reopened this task as Open.Apr 27 2017, 2:51 PM
TheDJ added a comment.Apr 27 2017, 3:04 PM

@Alwaysink, do you perhaps have another extension installed that uses the original GeSHi library or something ? I can imagine that if you have the actual GeSHi class loaded somehow instead of our lib, that you might run into some trouble..

Oh, yes. Then the culprit should be this one:

[root@<server> MarkdownExtraGeshiSyntax]# ll
total 16
drwxr-xr-x. 5 apache apache 4096 Jul 5 2016 geshi
drwxr-xr-x. 2 apache apache 4096 Jul 5 2016 markdown_extra
-rw-r--r--. 1 apache apache 1495 Jul 5 2016 MarkdownExtraGeshiSyntax.php
drwxr-xr-x. 2 apache apache 4096 Jul 5 2016 markdown_geshi

Do you know how I could do?

TheDJ added a comment.EditedApr 27 2017, 3:46 PM

My first suggestion would be to not use extensions last updated in 2009 :(

If you need markdown support, you can update to master, since today the master branch of this extension has pygments 2.2, which supports markdown.

The GeSHi class ships with SyntaxHighlight in the SyntaxHighlight_GeSHi.compat.php file and is registered with the autoloader. GeSHi::$compatibleLexers exists and works when installing the extension.

The problem was that another extension installed (MarkdownExtraGeshiSyntax) registers the same class (but a much older version of it) which doesn't have this property.

Given the purpose of this class is compat with class-level detection, I suggest that we don't put this property on that class, but rather put it on SyntaxHighlight_GeSHi like we do for other lexers.

GeSHi::$compatibleLexers does relate to compatibility, but not for the Geshi class itself (since the original never had such property), but rather it relates to compatibilty for the Geshi version of the lexer names.

Krinkle triaged this task as Normal priority.Apr 28 2017, 9:12 PM
Krinkle moved this task from Backlog to Accepted on the SyntaxHighlight board.

Change 353065 had a related patch set uploaded (by TheDJ; owner: TheDJ):
[mediawiki/extensions/SyntaxHighlight_GeSHi@master] Do not extend GeSHi class with private modifications

https://gerrit.wikimedia.org/r/353065

Thank you!!!
If I understand correctly, this cannot be applied to my 1.27 instance but will be available in 1.29?

TheDJ added a comment.May 11 2017, 6:01 PM

@Alwaysink it still needs to be reviewed. And since 1.27 is an LTS, we can also consider backporting it to 1.27 for it's next patch release. Updates on that will be shared here.

Change 353342 had a related patch set uploaded (by Krinkle; owner: TheDJ):
[mediawiki/extensions/SyntaxHighlight_GeSHi@REL1_29] Do not extend GeSHi class with private modifications

https://gerrit.wikimedia.org/r/353342

Change 353065 merged by jenkins-bot:
[mediawiki/extensions/SyntaxHighlight_GeSHi@master] Do not extend GeSHi class with private modifications

https://gerrit.wikimedia.org/r/353065

@TheDJ Could you draft back-ports for 1.27 and 1.28?

Change 353342 merged by jenkins-bot:
[mediawiki/extensions/SyntaxHighlight_GeSHi@REL1_29] Do not extend GeSHi class with private modifications

https://gerrit.wikimedia.org/r/353342

Change 353500 had a related patch set uploaded (by TheDJ; owner: TheDJ):
[mediawiki/extensions/SyntaxHighlight_GeSHi@REL1_28] Do not extend GeSHi class with private modifications

https://gerrit.wikimedia.org/r/353500

Change 353503 had a related patch set uploaded (by TheDJ; owner: TheDJ):
[mediawiki/extensions/SyntaxHighlight_GeSHi@REL1_27] Do not extend GeSHi class with private modifications

https://gerrit.wikimedia.org/r/353503

FYI, after quick try:

PHP Fatal error:  Cannot redeclare class GeSHi in /home/prodmediawiki-1.27.0/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.compat.php on line 23

@TheDJ Ah, seems we should probably split this class file so that autoload of our map does not trigger the compat class. That's fair, right?

Change 353500 merged by jenkins-bot:
[mediawiki/extensions/SyntaxHighlight_GeSHi@REL1_28] Do not extend GeSHi class with private modifications

https://gerrit.wikimedia.org/r/353500

Change 353503 merged by jenkins-bot:
[mediawiki/extensions/SyntaxHighlight_GeSHi@REL1_27] Do not extend GeSHi class with private modifications

https://gerrit.wikimedia.org/r/353503

Change 353704 had a related patch set uploaded (by TheDJ; owner: TheDJ):
[mediawiki/extensions/SyntaxHighlight_GeSHi@master] GeSHi: Make sure the autoload of Compat doesn't load GeSHi

https://gerrit.wikimedia.org/r/353704

Change 353704 merged by jenkins-bot:
[mediawiki/extensions/SyntaxHighlight_GeSHi@master] GeSHi: Make sure the autoload of Compat doesn't load GeSHi

https://gerrit.wikimedia.org/r/353704

Change 354142 had a related patch set uploaded (by Legoktm; owner: TheDJ):
[mediawiki/extensions/SyntaxHighlight_GeSHi@REL1_29] GeSHi: Make sure the autoload of Compat doesn't load GeSHi

https://gerrit.wikimedia.org/r/354142

Change 354142 merged by jenkins-bot:
[mediawiki/extensions/SyntaxHighlight_GeSHi@REL1_29] GeSHi: Make sure the autoload of Compat doesn't load GeSHi

https://gerrit.wikimedia.org/r/354142

@TheDJ is there anything else left to do here?

Krinkle closed this task as Resolved.May 23 2017, 8:17 PM
Krinkle claimed this task.
Krinkle reassigned this task from Krinkle to TheDJ.
Krinkle removed a project: Patch-For-Review.