rfc:deprecate_php_short_tags

This is an old revision of the document!


PHP 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

Deprecate PHP short tags in PHP 7.4?
Real name Yes No
Final result: 0 0
This poll has been closed.
Remove PHP short tags in PHP 8.0?
Real name Yes No
Final result: 0 0
This poll has been closed.

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

  1. the version(s) it was merged into
  2. a link to the git commit(s)
  3. a link to the PHP manual entry for the feature
  4. a link to the language specification section (if any)

References

rfc/deprecate_php_short_tags.1553209251.txt.gz · Last modified: 2019/03/21 23:00 by girgias