Page MenuHomePhabricator

Mustache/TemplateParser should emit warning if property doesn't exist
Open, MediumPublic


Issues such as shouldn't be possible without leaving something behind in the PHP error log. It's essentially a PHP Notice for undefined variable, except that it's through indirection of TemplateParser (and LightNCandy).

These are still immature and shows in lack of error handling.

It seems LightNCandy has some error options. Not sure which ones to use and how we'll forward it to the appropiate logs.

Event Timeline

Krinkle created this task.Mar 4 2016, 3:20 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 4 2016, 3:20 PM
Krinkle added a comment.EditedApr 2 2019, 3:45 AM

Having actual error detection for this run-time failure would have prevented T219359: lang attribute of page title is empty.

Krinkle renamed this task from Template engine should emit warning if unconditional property doesn't exist to Mustache/TemplateParser should emit warning if property doesn't exist.Apr 2 2019, 3:45 AM
Krinkle triaged this task as Medium priority.
Krinkle moved this task from Unsorted to Add / Create on the Technical-Debt board.
Krinkle added a project: Wikimedia-Incident.
Krinkle moved this task from On-going to Follow-up prevention on the Wikimedia-Incident board.

So I suppose we'd be checking variables are defined. It would mean we'd have to ensure certain template values were defined as null (and not undefined) as null is a perfectly valid template value.

For this to be feasible we'd need a way to access the variable names used inside a template.
I have another use case for that - see addMessagesToTemplateData - but the solution I came up with there didn't seem very optimal:

I think having access to that information is the difficult part here. If that's in place however such complaints should be easy to deal with.

I came across this today - - seems this should be built into Lightncandy.

Jdlrobson moved this task from Incoming to Needs Prioritization on the Readers-Web-Backlog board.