Page MenuHomePhabricator

TemplateParser spewing eval() errors
Closed, ResolvedPublicPRODUCTION ERROR

Description

Spotted endlessly in production:

390 Invalid argument: function: not string, closure, or array in /srv/mediawiki/php-1.25wmf21/includes/TemplateParser.php on line 203
202 error: syntax error, unexpected T_STRING in /srv/mediawiki/php-1.25wmf21/includes/TemplateParser.php(136) : eval()'d code on line 1

Two bugs here:

  1. The broken template causing parse errors needs fixing ASAP
  2. We need a way to keep broken templates from hitting prod

It was suggested on IRC earlier this week that we could help avoid this happening by adding a unit test to test template compilation prior to committing. The other option would be catching the error condition and failing more gracefully.

Event Timeline

demon raised the priority of this task from to High.
demon updated the task description. (Show Details)
demon subscribed.
Krenair edited projects, added Web-Team-Backlog; removed MediaWiki-General.
Krenair set Security to None.

Change 198443 had a related patch set uploaded (by Kaldari):
Strip '?>' from lightncandy generated PHP code in TemplateParser

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

Looks like it's because Zend doesn't care about the closing PHP tag, but I guess HHVM does.

Change 198443 abandoned by Kaldari:
Strip '?>' from lightncandy generated PHP code in TemplateParser

Reason:
Doesn't fix bug.

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

Nevermind, looks like HHVM doesn't care about it either. Hmmm.

Change 198658 had a related patch set uploaded (by Krinkle):
Add breaking tests for fatal error in TemplateParser

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

Templates are not broken, the TemplateParser handler is broken. It produces invalid PHP for any template (no matter what) if there is no cache hit. This is a regression caused by the recent change that added a hashing token, but failed to cover this with unit tests. It never worked.

Change 198658 merged by jenkins-bot:
TemplateParser: Don't fatal on cache misses

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

Change 198671 had a related patch set uploaded (by Alex Monk):
TemplateParser: Don't fatal on cache misses

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

Change 198671 merged by jenkins-bot:
TemplateParser: Don't fatal on cache misses

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

Change 198672 had a related patch set uploaded (by Alex Monk):
TemplateParser: Don't fatal on cache misses

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

Change 198672 merged by jenkins-bot:
TemplateParser: Don't fatal on cache misses

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

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