Re: [RFC Idea] Short echo tag with automatic HTML escaping (<?~ ... ?>)
| From: | Christian Schneider | Date: | Wed, 24 Dec 2025 13:31:37 +0000 |
| Subject: | Re: [RFC Idea] Short echo tag with automatic HTML escaping (<?~ ... ?>) | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129687@lists.php.net to get a copy of this message | ||
Am 24.12.2025 um 09:14 schrieb Rob Landers <rob@bottled.codes>:
> I know this is not your intent, but this will give people a false sense of security. Much like
> Twig and Blade do today.
I think this is an important point as many on this list will object to such a feature because of
this.
What I mean by this: The main obstacle is not the specific syntax but the feature in general.
I mean this as a heads-up for the original poster to be not too disappointed when (not
"if" - in my personal opinion) it gets shot down.
> Here's some examples where this breaks, written in the context of an html doc:
This is just the tip of the iceberg.
> Maybe, you should consider something like this:
>
> <?:html: or <?:h:
> <?:attr:
> <?:url:
> <?:js:
> <?:css:
I'm pretty sure for at least some of them one can find issues with a generic quoting, e.g.
character encoding other than UTF-8.
Or what schemes are allowed for a URL, e.g. you might want to disallow javascript:.
All in all I much prefer this to be part of a framework which knows about edge cases than to be a
language feature.
Or maybe something like the template strings t"foo" in Python but that's a different
approach to Twig-like templates.
Regards,
- Chris