PHP RFC: Deprecate PHP Short open tags
- Version: 0.1
- Date: 2019-03-20
- Author: George Peter Banyard, firstname.lastname@example.org
- Status: Accepted on 2019-04-24, rendered obsolete by PHP RFC: Deprecate short open tags, again on 2019-07-23
- Target Version: PHP 7.4
- Implementation: https://github.com/php/php-src/pull/3972
- First Published at: http://wiki.php.net/rfc/deprecate_php_short_tags
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.01), however, PHP's short open tags still remain.
Deprecate and disable
short_open_tag in PHP 7.4 and remove PHP's short open tags in PHP 8.0.
- The PHP documentation discourages their usage.
- PHP's short open tags clash with XML
<?xml ?>and can mean two different things depending on the INI configuration.
- PHP's short open tags depend on an INI directive and as such are non-portable.
- As such source code may leak if PHP relying on the short open tags is executed on a configuration where this isn't enabled.
- PHP's parser simplification.
Backward Incompatible Changes
Every script which currently uses the discouraged short
<? open tag will need to convert to the standard
<?php open tag.
This can be automatically achieved by using the
“full_opening_tag” fixer from PHP-CS-Fixer.
Proposed PHP Version(s)
Deprecation notice and default value changed to Off in PHP 7.4 and removal in PHP 8.0.
To Existing Extensions
Readline and Tokenizer have been updated in the implementations patches.
None to my understanding.
Unaffected PHP Functionality
<?= short tag is unaffected because as of PHP 5.4 it is always available.
Facebook poll 2) created by Peter Kokot: 73 for, 2 against.
Proposed Voting Choices
Yes/No for boths votes.
Primary vote: Deprecate PHP's short open tags in PHP 7.4.
Requires a 2/3 majority.
Secondary vote: Remove PHP's short open tags in PHP 8.0.
Requires a 2/3 majority.
Voting started on 2019-04-10 at 10:40 UTC and ran until 2019-04-24 11:20 UTC (for two (2) weeks)
Patches and Tests
https://github.com/php/php-src/pull/3972 PHP 7.4 Deprecation Notice Implementation
https://github.com/php/php-src/pull/3975 PHP 8.0 Removal Implementation
TBD Documentation patch
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)
Initial feedback on Internals (link to External.io)
RFC Announcement on Internals (link to External.io)
RFC Vote Announcement on Internals (link to External.io)