Re:PHP in 2019
by pragmaticlurker on Wednesday May 15, 2019 @09:32AM
(#19919203)
funny, because it's what React.js allows to do nowadays
[ Parent
| on HN ]
The difference is React actually handles escaping properly. It won't just dump out raw HTML by default, so you won't have an XSS issue.
PHP, on the other hand, requires manual escaping with htmlentities() ... It is very, very error prone.
Re:PHP in 2019
by FranOntanaya on Wednesday May 15, 2019 @11:24AM
(#19920329)
You are comparing a framework to a language though. Escaping in PHP is usually handled by the templating component, you don't go around writing htmlentities() everywhere.
If you're dealing with decade old code that uses no framework, you certainly do. PHP is, by default, a primitive templating language...
Re:PHP in 2019
by chriswarbo on Wednesday May 15, 2019 @12:42PM
(#19921183)
PHP comes with a Web framework built in (that's what things like `$_GET`, `$_POST`, `htmlentities`, etc. are). It is also a templating language, that's why we need to write `<?` at the start (to open a PHP tag).