Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
25 Sep 2015 at 11:04 UTC
Updated:
10 Oct 2015 at 23:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
wim leersComment #3
xjmDiscussed with @alexpott, @stefan.r, @lauriii, @joelittet, and @dawehner. At a minimum, clearly documenting that theme engines are expected to sanitize non-safe text in templates is critical, because module code now often relies on autoescape.
Comment #4
dawehnerAdded a piece of documentation + throwing a deprecation notice.
Comment #6
stefan.r commentedTalked with @dawehner and @tim.plunkett and we'll add a hook_requirements() as well as the deprecation in test error handler for the specific test.
Comment #7
eli-tShould be "Instead it is highly..." or "Instead it's highly..."
Comment #8
rainbowarrayPersonally I think it's confusing to still include phptemplate in core. Earlier in the D8 cycle, when I spoke to people about using Twig now, I had at least one person say "Sure, but you can still use phptemplate for themes." In reality that's going to be a bucket of pain. We can try to educate people to not use phptemplate through documentation, etc., but I think it would be much better to not provide that in core. If somebody really wants to make use of phptemplate, then taking that on could be a contrib task.
Comment #9
dawehnerWell, personally for me, its about the communication we agreed on at some point: We won't break any existing functionality anymore, unless really needed.
This here is an API removal, not just an API change. ... but yeah each phptemplate will be drastically unsafe. Especially for themes it just doesn't make sense to straightly convert them,
all variable names / templates changed anyway.
On the other hand IMHO to resolve the critical part of this issue it is simply enough to document and deprecated it. This gives us then an easy way forward to remove it in the future.
Comment #10
hongpong commentedIt seems wise to remove PHPTemplate if it's missing all these sanitization tools, but really this should have already been decided a couple years ago.
Comment #11
pwolanin commentedI think given how much is will admit bad ports from 7 if we leave it, we should remove it.
Comment #12
damontgomery commentedpwolanin++
I'm all for removing deprecated options. There are already enough "please don't do this" options in the theming system.
Comment #14
xjmI am also leaning toward removing it entirely, FWIW. As I mentioned to @dawehner in IRC, I feel a PHPTemplate theme is practically guaranteed to have an XSS vulnerability at this point, more so than even some of the other things we've made it critical to remove. And while this would totally break any PHPTemplate theme already ported... they are most likely already broken.
It is a big BC break though if you were expecting it to work still in D8. I'd suggest doing the thing we did with
checkPlain()where we deprecate and announce the removal because of the late beta BC break, except if we do have an RC soon then it wouldn't be much forewarning anyway. We should have deprecated it a year ago. Oops. =/Tweeted about the issue to try to get some visibility: https://twitter.com/xjmdrupal/status/647483540104478720
Comment #15
davidhernandezI agree it would be hard to even get it to work properly and you'd be in a world of hurt trying to use it to the same degree as Twig. Let that be handled outside of core, if really necessary. And if we leave it, +1 to what pwolanin said. People are going to try to port themes directly, which we don't want. We want them putting the effort into converting to Twig.
Comment #16
mikeker commentedYet another vote for removing it before the RC, even with the BC break @xjm describes in #14. Because if we don't now, we'll be supporting it until 9.0.0. Does anyone want to do that?
A little pain now vs. lots of pain over the next few years...
Comment #17
lauriiiThe most awesome test in progress.
Comment #18
davidhernandezAdding to what Mike said, the real question is are we going to support phptemplate? If a critical problem is found with it, who is going to fix it or care? If it stays we have a responsibility to support it, and I don't think anyone wants any part of that. And if you've been porting a theme to phptemplate in 8, you've literally been ignoring anything and everything everyone has been saying about theming in 8.
Comment #19
stefan.r commentedComment #20
dawehnerPair programming
Comment #21
lauriiiSending first time for the test bot. Removes phptemplate templating engine and replaces it with awesome Nyan cat templating engine!!
Comment #22
webchickDiscussed with @alexpott, @stefan.r, @dawehner, @Berdir, @pfrenssen, @lauriii.
One of the primary reasons that we focused on removing the ! t() placeholder is because we want to live by the mantra that the theme system auto-escapes for you. Leaving support for PHPTemplate in core leaves a glaring hole in this strategy, and if we don't remove it before RC1, we're stuck supporting it in D8 until Drupal 10.
What we did agree on is that it definitely is required to support multiple theme engines in core (Smarty, et al). So we can remove PHPTemplate as long as we have test coverage to confirm that theme engine support persists.
@stefan.r also brought up the point from @davidhernandez that we don't have the resources to commit to supporting two theme engines in core. I agree; much better to whole-ass Twig. :)
So consider it decided. :) Dawehner and lauriii are working on a patch.
Comment #23
webchickComment #24
xjmWe should also document... somewhere that any other templating engine would also need to handle sanitization of variables. And that should probably also get added to the change records, too. Speaking of. :)
Comment #25
xjmDoes #21 intentionally include the other patch from the other issue?
Comment #26
lauriiiYes, its for testing purposes. So this is blocked by that
Comment #27
davidhernandezDoes this need more than a change record? Its own core announcement or anything?
Comment #28
dawehnerThese parts can be pulled out from the earlier patch.
Comment #29
hussainwebJust fixing very small nitpicks.
Comment #31
davidhernandezAdded change record draft.
Comment #33
hussainwebComment #34
hussainwebFixing that error. It was a copy/paste issue.
Comment #35
hussainwebI agree on removing PHPTemplate. Is the reason to add nyan cat just to allow testing of multiple theme engines? If so, we should document that a bit more clearly.
Comment #36
lauriiiIts under testing module section so I dont personally see reason to add extra documentation beside what we already have. Anyway if you disagree, maybe you could add some docs?
Comment #37
dawehner@hussainweb this was coming from the theme function issue so its not up for this issue to discuss it.
Comment #38
longwave@hussainweb: I think that strlen check was there for a reason; consider the case where #markup is '0'.
Comment #39
hussainweb@lauriii, @dawehner: I just wanted to understand this myself first, that's all. It's true that this being under tests directory is an indication enough. I didn't notice that earlier.
@longwave: You're right. I built a table in my head to see where it could be affected, but missed '0'. Reverting that change now.
Comment #40
pfrenssen___━*━___━━___━__*___━_*___┓━╭━━━━╮
__*_━━___━━___━━*____━━___┗┓|::::::^-------^
___━━___━*━___━━____━━*___━┗|::::|。◕‿‿◕。|
___*━__━━_*___━━___*━━___*━━╰O--O---O--O
Comment #41
davidhernandezChange record updated appropriately.
Comment #42
star-szrThis is so awesome!
Comment #43
David_Rothstein commentedThere's an older issue for that (linked) mentioning at least one more place where it needs documenting.
Comment #44
larowlanI think this is asking for trouble - can't the theme system/engine do this for us - i.e. it already knows which theme hooks are functions and which use a template - can't it call theme_escape_and_render on non templates automatically? We don't want to leave it to chance - it will be easy to forget.
Comment #45
larowlanRealised this is from #2572929: Document lack of auto-escape in theme functions and add a theme autoescape helper function, copying my comment over there.
Comment #46
xjmLooks like there is a lot of confusion about these two patches' overlap and dependency -- let's postpone this one explicitly.
Thanks for the CR. I'll draft an announcement for g.d.o/core.
Comment #47
dawehnerWe can still review the other bits of the patch.
Comment #48
pwolanin commentedok, here's a clean patch just for phptemplate removal and addition of the test engine.
I don't think we need to postpone this since is no overlap?
Comment #49
dawehner/me shakes head
Comment #50
pwolanin commentedsorry, I didn't realize it uses the new function.
Comment #52
dawehnerAnd I didn't read the code correctly :)
Comment #54
lauriiiComment #55
plachComment #56
xjmPosted on g.d.o: https://groups.drupal.org/node/482888
Comment #57
dawehnerJust some minimal changes.
Comment #58
dawehnerReroll
Comment #59
dawehnerSome issue summary update
Comment #61
dawehnerLooking into it
Comment #62
dawehnerThere we go.
Comment #63
dawehner.
Comment #64
borisson_This needs a change record but otherwise it looks really good.
Comment #65
dawehnerThank you @borisson_
working on that now.
Comment #66
davidhernandezThere is a change record draft. They are always listed in the sidebar.
Comment #67
dawehnerTst tss tsts tsts tststs @borisson_ open your eyes. I could not have created a better change record, this is for sure.
Comment #68
mortendk commentedthis is überawesome :)
Comment #69
dawehnerThe issue summary got updated in the meantime in #59
Comment #71
stefan.r commentedLooks great
Comment #76
lauriiiRTBC++ & Sorry Drupal, Nyan Cats gonna be in your HEAD till forever!
Comment #79
alexpottSo long and thanks for all the kittens, PHPTemplate.