From: tcjohans at riseup dot net Operating system: Windows Vista PHP version: 5.2.10 PHP Bug Type: Feature/Change Request Bug description: Ability to set new/alternative PHP parse tags
Description: ------------ Hello, I would like to propose, as a new feature for PHP, the ability to set new or alternative start and end tags for PHP parsing (i.e. instead of the usual <?php and ?>). PHP tags are useful for including PHP inside HTML documents. Doing so makes it easier for designers to work directly inside PHP files with minimal risk that they mess up the code. However, a serious problem here is that PHP tags do not contrast clearly with the surrounding HTML code, since both the current PHP tags and HTML use brackets (< and >). One consequence for me is that I almost always tend to avoid writing PHP inside HTML; instead I print out long portions of HTML using PHP's echo statement. The solution to this dilemma would be to enable a function such as e.g. set_php_tags($new_start_tag, $new_end_tag), which would set new start and end tags for indicating start and end of PHP parsing. Using such a function somewhere at the top of my script, I could then perhaps write ##?php and ?## instead of <?php and ?> to start and end PHP parsing inside HTML code, which would make the PHP code contrast much clearer with the HTML code. Security consideration: As a security measure, I think that such optional tagging schemes perhaps only should be valid for the particular script files in which they are defined. (Otherwise, someone could perhaps set alternative tags in one script file, include a script file belonging to somebody else, and then have the whole script of that file be printed out as if it were HTML, since its PHP parsing tags would be ignored.) Thomas Reproduce code: --------------- <?php set_php_tags("##?php", "?##"); $string = "Hello World!"; ?> Here is some text:<br> ##?php echo $string; ?##<br> End Expected result: ---------------- Here is some text: Hello World! End -- Edit bug report at http://bugs.php.net/?id=48844&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48844&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48844&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48844&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48844&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48844&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48844&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48844&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48844&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48844&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48844&r=support Expected behavior: http://bugs.php.net/fix.php?id=48844&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48844&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48844&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48844&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48844&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48844&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48844&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48844&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48844&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48844&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48844&r=mysqlcfg