Page MenuHomePhabricator

php-1.34.0-wmf.6/includes/TemplateParser.php(149) : eval()'d code: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')'
Closed, DuplicatePublic

Description

Error

On various wikis

Request URL: https://ro.wikipedia.org/w/index.php?title=Categorie:Verbe_%C3%AEn_francez%C4%83&pagefrom=recommencer

Request ID: XOafCQpAAEEAAFdScroAAABK

message
/srv/mediawiki/php-1.34.0-wmf.6/includes/TemplateParser.php(149) : eval()'d code:11

syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')'
trace
#0 /srv/mediawiki/php-1.34.0-wmf.6/includes/TemplateParser.php(222): TemplateParser->getTemplate(string)
#1 /srv/mediawiki/php-1.34.0-wmf.6/skins/Vector/includes/VectorTemplate.php(167): TemplateParser->processTemplate(string, array)
#2 /srv/mediawiki/php-1.34.0-wmf.6/includes/skins/SkinTemplate.php(230): VectorTemplate->execute()
#3 /srv/mediawiki/php-1.34.0-wmf.6/includes/OutputPage.php(2749): SkinTemplate->outputPage()
#4 /srv/mediawiki/php-1.34.0-wmf.6/includes/MediaWiki.php(872): OutputPage->output(boolean)
#5 /srv/mediawiki/php-1.34.0-wmf.6/includes/MediaWiki.php(884): MediaWiki->{closure}()
#6 /srv/mediawiki/php-1.34.0-wmf.6/includes/MediaWiki.php(515): MediaWiki->main()
#7 /srv/mediawiki/php-1.34.0-wmf.6/index.php(42): MediaWiki->run()
#8 /srv/mediawiki/w/index.php(3): require(string)
#9 {main}

Impact

Notes

Apparently all the errors had php7.2. Maybe related to mustache templates? It is unclear since the stacktrace doesn't show the template being parsed :-(

Event Timeline

hashar created this task.May 23 2019, 2:23 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 23 2019, 2:23 PM

From https://www.php.net/eval eval beahves differently on PHP7:

As of PHP 7, if there is a parse error in the evaluated code, eval() throws a ParseError exception.
Before PHP 7, in this case eval() returned FALSE and execution of the following code continued normally. It is not possible to catch a parse error in eval() using set_error_handler().

And we have:

includes/TemplateParser.php
 96     protected function getTemplate( $templateName ) {

149         $renderer = eval( $code );
150         if ( !is_callable( $renderer ) ) {
151             throw new RuntimeException( "Requested template, {$templateName}, is not callable" );
152         }

With PHP7.0 a ParseError exception is emitted, which is what I found in logstash. With HHVM I guess we should have an exception statiting the name of the template but I could not find any :-(

Jdforrester-WMF added a subscriber: Jdforrester-WMF.

Not sure which of CPT and Parsing are responsible for this area.

cscott added a subscriber: cscott.May 23 2019, 2:55 PM

I don't think that anyone currently on @Parsing-Team knows anything about the mustache template code. I think all those folk were moved back into Platform.

Anomie added a subscriber: Anomie.

Mustache templating seems to be a Readers Web thing to me.

From the backtrace it seems likely to be parsing skins/Vector/includes/templates/index.mustache, but beyond that I don't know and I can't reproduce it.

Krinkle added a subscriber: Krinkle.Jul 1 2019, 4:51 PM

These are read as strings and as such subject to the PHP7 opcache bugs. Given it was limited to PHP 7, very likely duplicate of T224491. Merging for now.

mmodell changed the subtype of this task from "Task" to "Production Error".Wed, Aug 28, 11:06 PM