Page MenuHomePhabricator

SyntaxHighlight via git missing Pigments
Closed, ResolvedPublic

Description

I'm seeing the following error when trying to use the master build of Syntaxhighlight with MW 1.26wmf16. I cloned the repo, ran composer install and even went in and ran 'python create_pygmentize_bundle' in SyntaxHighlight_GeSHi/pygments/pygmentize. Code blocks are showing up and unformatted <pre></pre> blocks and the ""Pages with syntax highlighting errors" category is being applied.

The most interesting chunk of the below error is this portion (to me at least).

[warning] Failed to invoke Pygments. Please check that Pygments is installed and that $wgPygmentizePath is accurate. [Called from SyntaxHighlight_GeSHi::highlight in /var/www/html/w/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php at line 2

Updated with a little easier to read error message.

[error-json] { id : 8b6b7ff2 ,
type : ErrorException ,
file : /var/www/html/w/extensions/SyntaxHighlight_GeSHi/vendor/symfony/process/Process.php ,
line :1102, message : PHP Deprecated: The Symfony\\Component\\Process\\Process::setStdin method is deprecated since version 2.5 and will be removed in 3.0. Use the setInput() method instead. ,
code :0, url : /wiki/Long_Term_Disability_Deductions_Roll-up_(Report) ,
suppressed :true, backtrace :[{ function : handleError ,
class : MWExceptionHandler ,
type : :: ,
args :[ integer ,
string ,
string ,
integer ,
array ]},{ file : /var/www/html/w/extensions/SyntaxHighlight_GeSHi/vendor/symfony/process/Process.php ,
line :1102, function : trigger_error ,
args :[ string ,
integer ]},{ file : /var/www/html/w/extensions/SyntaxHighlight_GeSHi/vendor/kzykhys/pygments/src/KzykHys/Pygments/Pygments.php ,
line :65, function : setStdin ,
class : Symfony\\Component\\Process\\Process ,
type : -&gt; ,
args :[ string ]},{ file : /var/www/html/w/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php ,
line :279, function : highlight ,
class : KzykHys\\Pygments\\Pygments ,
type : -&gt; ,
args :[ string ,
string ,
string ,
array ]},{ file : /var/www/html/w/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php ,
line :125, function : highlight ,
class : SyntaxHighlight_GeSHi ,
type : :: ,
args :[ string ,
string ,
array ]},{ function : parserHook ,
class : SyntaxHighlight_GeSHi ,
type : :: ,
args :[ string ,
array ,
Parser ,
PPTemplateFrame_DOM ]},{ file : /var/www/html/w/includes/parser/Parser.php ,
line :4232, function : call_user_func_array ,
args :[ array ,
array ]},{ file : /var/www/html/w/includes/parser/CoreParserFunctions.php ,
line :1007, function : extensionSubstitution ,
class : Parser ,
type : -&gt; ,
args :[ array ,
PPTemplateFrame_DOM ]},{ function : tagObj ,
class : CoreParserFunctions ,
type : :: ,
args :[ Parser ,
PPTemplateFrame_DOM ,
array ]},{ file : /var/www/html/w/includes/parser/Parser.php ,
line :3787, function : call_user_func_array ,
args :[ array ,
array ]},{ file : /var/www/html/w/includes/parser/Parser.php ,
line :3521, function : callParserFunction ,
class : Parser ,
type : -&gt; ,
args :[ PPTemplateFrame_DOM ,
string ,
array ]},{ file : /var/www/html/w/includes/parser/Preprocessor_DOM.php ,
line :1177, function : braceSubstitution ,
class : Parser ,
type : -&gt; ,
args :[ array ,
PPTemplateFrame_DOM ]},{ file : /var/www/html/w/includes/parser/Parser.php ,
line :3663, function : expand ,
class : PPFrame_DOM ,
type : -&gt; ,
args :[ PPNode_DOM ]},{ file : /var/www/html/w/includes/parser/Preprocessor_DOM.php ,
line :1177, function : braceSubstitution ,
class : Parser ,
type : -&gt; ,
args :[ array ,
PPFrame_DOM ]},{ file : /var/www/html/w/includes/parser/Parser.php ,
line :3340, function : expand ,
class : PPFrame_DOM ,
type : -&gt; ,
args :[ PPNode_DOM ,
integer ]},{ file : /var/www/html/w/includes/parser/Parser.php ,
line :1236, function : replaceVariables ,
class : Parser ,
type : -&gt; ,
args :[ string ]},{ file : /var/www/html/w/includes/parser/Parser.php ,
line :439, function : internalParse ,
class : Parser ,
type : -&gt; ,
args :[ string ]},{ function : parse ,
class : Parser ,
type : -&gt; ,
args :[ string ,
Title ,
ParserOptions ,
boolean ,
boolean ,
integer ]},{ file : /var/www/html/w/includes/StubObject.php ,
line :105, function : call_user_func_array ,
args :[ array ,
array ]},{ file : /var/www/html/w/includes/StubObject.php ,
line :129, function : _call ,
class : StubObject ,
type : -&gt; ,
args :[ string ,
array ]},{ file : /var/www/html/w/includes/content/WikitextContent.php ,
line :331, function : __call ,
class : StubObject ,
type : -&gt; ,
args :[ string ,
array ]},{ file : /var/www/html/w/includes/content/WikitextContent.php ,
line :331, function : parse ,
class : StubObject ,
type : -&gt; ,
args :[ string ,
Title ,
ParserOptions ,
boolean ,
boolean ,
integer ]},{ file : /var/www/html/w/includes/content/AbstractContent.php ,
line :497, function : fillParserOutput ,
class : WikitextContent ,
type : -&gt; ,
args :[ Title ,
integer ,
ParserOptions ,
boolean ,
ParserOutput ]},{ file : /var/www/html/w/includes/poolcounter/PoolWorkArticleView.php ,
line :140, function : getParserOutput ,
class : AbstractContent ,
type : -&gt; ,
args :[ Title ,
integer ,
ParserOptions ]},{ file : /var/www/html/w/includes/poolcounter/PoolCounterWork.php ,
line :123, function : doWork ,
class : PoolWorkArticleView ,
type : -&gt; ,
args :[]},{ file : /var/www/html/w/includes/page/Article.php ,
line :676, function : execute ,
class : PoolCounterWork ,
type : -&gt; ,
args :[]},{ file : /var/www/html/w/includes/actions/ViewAction.php ,
line :44, function : view ,
class : Article ,
type : -&gt; ,
args :[]},{ file : /var/www/html/w/includes/MediaWiki.php ,
line :456, function : show ,
class : ViewAction ,
type : -&gt; ,
args :[]},{ file : /var/www/html/w/includes/MediaWiki.php ,
line :255, function : performAction ,
class : MediaWiki ,
type : -&gt; ,
args :[ Article ,
Title ]},{ file : /var/www/html/w/includes/MediaWiki.php ,
line :680, function : performRequest ,
class : MediaWiki ,
type : -&gt; ,
args :[]},{ file : /var/www/html/w/includes/MediaWiki.php ,
line :474, function : main ,
class : MediaWiki ,
type : -&gt; ,
args :[]},{ file : /var/www/html/w/index.php ,
line :41, function : run ,
class : MediaWiki ,
type : -&gt; ,
args :[]}]}
[warning] Failed to invoke Pygments. Please check that Pygments is installed and that $wgPygmentizePath is accurate. [Called from SyntaxHighlight_GeSHi::highlight in /var/www/html/w/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php at line 285]

Event Timeline

Ckoerner created this task.Aug 24 2015, 5:56 PM
Ckoerner raised the priority of this task from to Needs Triage.
Ckoerner updated the task description. (Show Details)
Ckoerner added a project: SyntaxHighlight.
Ckoerner added a subscriber: Ckoerner.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 24 2015, 5:56 PM
Ckoerner updated the task description. (Show Details)Sep 2 2015, 9:20 PM
Ckoerner set Security to None.
Paladox added a subscriber: ori.Sep 4 2015, 11:01 AM

Without doing anything, grabbing the master repo from git and visiting a page with a <syntaxhighligh> tag I get the following error:

Fatal error: Class 'KzykHys\Pygments\Pygments' not found in /var/www/html/w/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php on line 278

Legoktm added a subscriber: Legoktm.Sep 9 2015, 4:54 PM

I don't think running python create_pygmentize_bundle is necessary. Try a fresh clone from git plus only composer update?

I did a mediawiki update, with:

cd core
git pull
php maintenance/update.php
composer install --no-dev
cd extensions
git submodule update --init --recursive

I ended up with this error:

PHP Fatal error:  Class 'KzykHys\\Pygments\\Pygments' not found in /home/mapmaking/core/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php

To solve this problem, I did:

cd extensions/SyntaxHighlight_GeSHi
composer update
Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptNov 19 2015, 9:51 PM
Florian closed this task as Resolved.Nov 25 2015, 11:05 PM
Florian claimed this task.
Florian added a subscriber: Florian.

So this seems resolved now.

Hint: you can add composer.jsons of extensions to composer.local.json in your mediawiki root directory as an extra json for the composer merge plugin. Something like (untested):

"extra": {
    "merge-plugin": {
        "include": [
            "extensions/Syntaxhighlight_GeSHi/composer.json"
         ]
    }
}

Now, anytime you run composer update, the requirements of Syntaxhighlight should bebinstalled, too. This works as long as an extension (if you have other extensions with composer, too) doesn't require a a file of a composer managed package to be saved in the extensions vendor directory (which should normally the case, because all classes are added to the autoloaders, and it shouldn't be required to include them directly).

Florian removed Florian as the assignee of this task.Nov 25 2015, 11:06 PM