This is an old revision of the document!
PHP RFC: Deprecate PHP Short tags
- Version: 0.1
- Date: 2019-03-20
- Author: George Peter Banyard, girgias@php.net
- Status: Draft
- First Published at: http://wiki.php.net/rfc/deprecate_php_short_tags
Introduction
PHP has provided over the years different ways to indicate the beginning of PHP code other than the standard <?php ... ?>
open tags. Most of these opening tags have been removed with PHP 7.0.0, however PHP short open tags still remain.
Proposal
Deprecate and disable short_open_tag
in PHP 7.4 and remove PHP short open tags in PHP 8.0.
Reasoning
- The PHP documentation discourages their usage.
- PHP short open tags clash with XML
<?xml ?>
and can mean two different things depending on the INI configuration. - PHP short open tags depend on an INI directive and as such are non-portable.
Backward Incompatible Changes
Every script which currently uses the discouraged short <?
open tag will need to convert to the standard <?php
open tag.
Proposed PHP Version(s)
Deprecation notice in PHP 7.4 and removal in PHP 8.0
RFC Impact
To SAPIs
None to my understanding.
To Existing Extensions
Extensions using <?
will need to convert to <?php
.
To Opcache
None to my understanding.
php.ini Defaults
Change short_open_tag
from “1”
to “0”
Unaffected PHP Functionality
The <?=
short tag is unaffected because as of PHP 5.4 it is always available.
Proposed Voting Choices
As with all new RFCs this proposal requires a 2/3 majority
Vote
Patches and Tests
https://github.com/php/php-src/pull/3972 PHP 7.4 Deprecation Notice Implementation TBD
Implementation
After the project is implemented, this section should contain
- the version(s) it was merged into
- a link to the git commit(s)
- a link to the PHP manual entry for the feature
- a link to the language specification section (if any)