rfc:remove_alternative_php_tags

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rfc:remove_alternative_php_tags [2014/09/09 21:33]
nikic
rfc:remove_alternative_php_tags [2017/09/22 13:28] (current)
Line 2: Line 2:
   * Date: 2014-09-09   * Date: 2014-09-09
   * Author: Nikita Popov <nikic@php.net>   * Author: Nikita Popov <nikic@php.net>
-  * Status: Under Discussion+  * Status: Accepted
   * Targeting: PHP 7   * Targeting: PHP 7
   * Patch: https://github.com/php/php-src/pull/813   * Patch: https://github.com/php/php-src/pull/813
Line 8: Line 8:
 ===== Proposal ===== ===== Proposal =====
  
-This RFC proposes the removal of ASP tags (''<%'') and script tags ''<script language=php>'') as a means of entering or leaving PHP mode.+This RFC proposes the removal of ASP tags (''<%'') and script tags (''<script language=php>'') as a means of entering or leaving PHP mode.
  
 The following syntactical elements are removed: The following syntactical elements are removed:
  
   * ''<%'' opening tag   * ''<%'' opening tag
-  * ''<%='' short opening tag+  * ''<%='' opening tag with echo
   * ''%>'' closing tag   * ''%>'' closing tag
   * ''%%(<script\s+language\s*=\s*(php|"php"|'php')\s*>)i%%'' opening tag   * ''%%(<script\s+language\s*=\s*(php|"php"|'php')\s*>)i%%'' opening tag
Line 20: Line 20:
 The listed opening tags will no longer enter PHP mode and the listed closing tags will no longer leave PHP mode. The listed opening tags will no longer enter PHP mode and the listed closing tags will no longer leave PHP mode.
  
-Additionally the ''asp_tags'' ini directive is removed.+Additionally the ''asp_tags'' ini directive is removed. Trying to enable ''asp_tags'' will result in a core error. 
 + 
 +This RFC does //**not**// remove short opening tags (''<?'') or short opening tags with echo (''<?=''). 
 + 
 +===== Reasoning ===== 
 + 
 +  * The alternative PHP tags have never gained any significant degree of usage. Their usage has been discouraged since forever. 
 +  * The ASP tags depend on an ini directive and as such are non-portable. We generally try to move away from ini-dependent language behavior. With ASP tags removed, short open tags should be the last. 
 +  * ASP tags [[http://stackoverflow.com/questions/14694116/how-to-disable-asp-style-php-tags-within-a-specific-file|clash with underscore.js templates]] and it's not possible to disable asp tags using ''ini_set()''
 +  * Supporting different tags allows very weird mixing like ''%%<script language=php> echo "foo" %>%%'' 
 + 
 +===== Porting tool ===== 
 + 
 +To simplify porting of legacy code using the alternative tags, a [[https://gist.github.com/nikic/74769d74dad8b9ef221b|porting script]] is provided. The script takes a directory and will replace ASP and script tags in all ''.php'' files contained in this directory: 
 + 
 +<code> 
 +php -d asp_tags=1 portAlternativeTags.php dir/ 
 +</code>
  
 ===== Vote ===== ===== Vote =====
  
-As this is a language change a 2/3 majority is required.+The vote started on 2014-09-24 and ended on 2014-10-01. The required 2/3 majority has been reached, as such this RFC is accepted. 
 + 
 +<doodle title="Remove alternative PHP tags in PHP 7?" auth="nikic" voteType="single" closed="true"> 
 +   * Yes 
 +   * No 
 +</doodle>
rfc/remove_alternative_php_tags.1410298386.txt.gz · Last modified: 2017/09/22 13:28 (external edit)