Page MenuHomePhabricator

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



On various wikis

Request URL:


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

syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')'
#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}



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

From 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:

 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.

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.

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".Aug 28 2019, 11:06 PM
Restricted Application added a subscriber: Strainu. · View Herald TranscriptOct 16 2020, 5:38 PM