# RFC: Deprecate PHP's Short Open Tags

- Status: Obsolete
- Authors: George Peter Banyard, girgias@php.net
- Date: 2019-03-20
- Version: 0.1
- Target: PHP 7.4
- Implementation: https://github.com/php/php-src/pull/3972
- Original: https://wiki.php.net/rfc/deprecate_php_short_tags
- Page: https://externals.io/rfc/deprecate_php_short_tags
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

## Votes

### Deprecate PHP short open tags in PHP 7.4? (closed)

Yes: 38 · No: 18

Voters: ashnazg (Yes), bishop (Yes), bwoebi (Yes), carusogabriel (No), colinodell (Yes), cpriest (Yes), danack (No), daverandom (Yes), derick (Yes), diegopires (No), duncan3dc (Yes), emir (Yes), galvao (Yes), gasolwu (Yes), girgias (Yes), guilhermeblanco (No), heiglandreas (Yes), jasny (Yes), jbnahan (Yes), jhdxr (No), kalle (No), kelunik (Yes), kguest (Yes), kinncj (No), klaussilveira (No), krakjoe (No), kriscraig (Yes), laruence (No), levim (Yes), malukenho (Yes), marcio (Yes), mariano (Yes), mbeccati (Yes), mcmic (Yes), mike (Yes), narf (No), nikic (No), ocramius (Yes), pauloelr (Yes), peehaa (Yes), petk (Yes), pmjones (Yes), pmmaga (No), pollita (No), rasmus (No), reywob (Yes), rtheunissen (Yes), salathe (No), santiagolizardo (Yes), sebastian (Yes), sergey (Yes), stas (No), svpernova09 (Yes), thekid (Yes), trowski (Yes), yunosh (No)

### Remove PHP short open tags in PHP 8.0? (closed)

Yes: 42 · No: 15

Voters: ashnazg (Yes), bwoebi (Yes), carusogabriel (Yes), colinodell (Yes), cpriest (Yes), danack (No), daverandom (Yes), derick (Yes), diegopires (Yes), duncan3dc (Yes), emir (Yes), galvao (Yes), gasolwu (Yes), girgias (Yes), guilhermeblanco (Yes), heiglandreas (Yes), jasny (Yes), jbnahan (Yes), jhdxr (Yes), kalle (No), kelunik (Yes), kguest (Yes), kinncj (Yes), klaussilveira (No), krakjoe (No), kriscraig (Yes), laruence (No), levim (Yes), malukenho (Yes), marcio (Yes), mariano (Yes), mbeccati (Yes), mcmic (Yes), mike (Yes), narf (No), nikic (No), ocramius (Yes), pauloelr (Yes), peehaa (Yes), petk (Yes), pmjones (Yes), pmmaga (No), pollita (No), rasmus (No), reywob (No), rtheunissen (Yes), salathe (No), sammyk (Yes), santiagolizardo (Yes), sebastian (Yes), sergey (Yes), stas (No), svpernova09 (Yes), thekid (Yes), trowski (Yes), yunosh (No), zeev (No)

## Discussions on the mailing list

- [Deprecate short_open_tag ini directive?](https://externals.io/message/104662.md) — started on 2019-03-11, 26 messages
- [\[RFC\] Deprecate PHP's short open tags](https://externals.io/message/104922.md) — started on 2019-03-25, 11 messages
- [\[RFC\] \[VOTE\] Deprecate PHP's short open tags](https://externals.io/message/105201.md) — started on 2019-04-10, 94 messages
- [\[RFC\] \[VOTE\] Deprecate PHP's short open tags](https://externals.io/message/106026.md) — started on 2019-06-22, 1 messages
- [\[RFC\] \[DISCUSSION\] Deprecate PHP's short open tags V2](https://externals.io/message/106256.md) — started on 2019-07-23, 33 messages

---

## 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[1)](#fn__1), however, PHP's short open tags still remain.

## Proposal

Deprecate and disable `short_open_tag` in PHP 7.4 and remove PHP's short open tags in PHP 8.0.

## Reasoning

- The PHP [documentation](https://php.net/manual/en/language.basic-syntax.phptags.php) 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](https://cs.symfony.com/).

## Proposed PHP Version(s)

Deprecation notice and default value changed to Off in PHP 7.4 and removal in PHP 8.0.

## RFC Impact

### To SAPIs

None.

### To Existing Extensions

Readline and Tokenizer have been updated in the implementations patches.

### 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.

## Feedback

Facebook poll [2)](#fn__2) created by Peter Kokot: 73 for, 2 against.

## Proposed Voting Choices

Yes/No for boths votes.

## Vote

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)

**Vote: Deprecate PHP short open tags in PHP 7.4?** — Yes: 38 · No: 18 (closed)

**Vote: Remove PHP short open tags in PHP 8.0?** — Yes: 42 · No: 15 (closed)

## 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

## 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

[Initial feedback on Internals (link to External.io)](https://externals.io/message/104662)
[RFC Announcement on Internals (link to External.io)](https://externals.io/message/104922)
[RFC Vote Announcement on Internals (link to External.io)](https://externals.io/message/105201)

[1)](#fnt__1)Remove alternative PHP tags RFC [https://wiki.php.net/rfc/remove\_alternative\_php\_tags](https://externals.io/rfc/remove_alternative_php_tags)

[2)](#fnt__2)<https://fb.com/groups/2204685680/permalink/10157687999015681/>
