Bug #16838 Updated: PHP short_open_tags and <?xml .. ?>

From: Date: Fri, 26 Apr 2002 15:10:08 +0000
Subject: Bug #16838 Updated: PHP short_open_tags and <?xml .. ?>
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-6126@lists.php.net to get a copy of this message
ID: 16838 Updated by: hholzgra@php.net Reported By: sloetz@web.de Status: Suspended Bug Type: Feature/Change Request Operating System: all PHP Version: 4.2.0 New Comment: people have been warned for *ages* now that short tags are *not* xml-compliant, so everybody still using them should be blamed for doing so and not benn supported in continuing using bad style ... instead of adding extra magic i'd suggest to emmit warnings for uses of '<?' even if short_tags are enabled ... Previous Comments: ------------------------------------------------------------------------ [2002-04-26 06:28:43] sloetz@web.de Hi, turning off short tags is not a real solution as long as PHP offically supports them. There are tons of code out there using short tags and there will be even more new code with short tags if this feature will not be abolished. Furthermore, and I have to repeat this, there is huge group of PHP users that has no access to the php.ini settings (e.g. mod_php with safe_mode in a shared hosting environment). Should these users be forced to modify third-party code over and over again because the developers of this code insist on (offically supported) short tags? For companies and groups that offer web hosting services this is simply not viable. You can't over web hosting with mutual exclusion of XHTML and PHP. And I also have to stress that again: PHP, a *hypertext preprocessor*, is not able to parse standard compliant XHTML! I think there are only two solutions: Doing it the hard way by wholly removing short tags or changing PHP in a way that allows the usage of XHTML and short tags. A third approach to this problem is not a real solution but an option for the user, namely switching to another scripting language. Sascha ------------------------------------------------------------------------ [2002-04-26 05:51:35] derick@php.net Then just turn off short-tags. And there won't be any change in this, as: 1. It came up numerous times on php-dev 2. It makes little sense Derick ------------------------------------------------------------------------ [2002-04-26 05:45:45] icarus@dabo.de Hi! I find this an extremly annoying behaviour, too. Since you can use PHP to parse every file with nearly no loss of performance (whether it contains PHP code or not) and only when it contains PHP-code it would be really parsed through the PHP-parser. To my optinion it is often done that you simply let php parse every html-file, so the visitor cannot see if its generated dynamically or static. Since you will have pages that are _really_ static you would have to add php-code to simply add this "<?xml ..." which would cost much performance. Bye! Michael ------------------------------------------------------------------------ [2002-04-26 04:27:18] sloetz@web.de It is definitely not extraneous, as today PHP, despite its claim to be a hypertext preprocessor, is not capable of handling standard conforming XHTML documents. Of course you can echo the ?xml-tag but that was not my point. That would be just another workaround for situations where your single goal is to produce XML compliant *output*. There is an increasing demand to keep the input files in a format that can be processed by XML tools - most users I know of use XHTML exactly for this reason and not for the mere fun of adding closing tags all over the document :-) But that is not the only problem. With the advent of Apache 2 it will become common practice to apply multiple filters successively to a source document, e.g. use XSLT to produce XHTML with PHP from XML sources and the send it to the PHP parser. What will be PHP's answer? Don't use XML? Or enable PHP usage through pre- and postprocessing filters that first remove and then add xml-tags again? To be honest, I think my suggested solution is neither elegant nor very clever, but it should do its job. Definitely the best solution would be to abolish all kinds of short tag and asp tag syntax and only allow the '<?php' and '<script..' styles. As far as I know, there have been various discussions on that topic in the past, so I decided not to suggest this again. Thanks, Sascha ------------------------------------------------------------------------ [2002-04-25 20:56:41] rasmus@php.net This seems extraneous to me. You can simply echo the one <?xml tag that is usually needed. No need to turn off short_tags. Just do: <?echo '<?xml ...'?> at the top. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/16838 -- Edit this bug report at http://bugs.php.net/?id=16838&edit=1

« previous php.bugs (#6126) next »