rfc:deprecate_php_short_tags

This is an old revision of the document!


PHP RFC: Deprecate PHP Short open 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.01), however, PHP's 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 and default value changed to Off in PHP 7.4 and removal in PHP 8.0

RFC Impact

To SAPIs

None to my understanding.

To Existing Extensions

None to my understanding.

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 open tags in PHP 7.4?
Real name Yes No
ashnazg (ashnazg)  
bishop (bishop)  
bwoebi (bwoebi)  
carusogabriel (carusogabriel)  
colinodell (colinodell)  
cpriest (cpriest)  
danack (danack)  
daverandom (daverandom)  
derick (derick)  
diegopires (diegopires)  
duncan3dc (duncan3dc)  
emir (emir)  
galvao (galvao)  
gasolwu (gasolwu)  
girgias (girgias)  
guilhermeblanco (guilhermeblanco)  
heiglandreas (heiglandreas)  
jasny (jasny)  
jbnahan (jbnahan)  
jhdxr (jhdxr)  
kalle (kalle)  
kelunik (kelunik)  
kguest (kguest)  
kinncj (kinncj)  
klaussilveira (klaussilveira)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
laruence (laruence)  
levim (levim)  
malukenho (malukenho)  
marcio (marcio)  
mariano (mariano)  
mbeccati (mbeccati)  
mcmic (mcmic)  
mike (mike)  
narf (narf)  
nikic (nikic)  
ocramius (ocramius)  
pauloelr (pauloelr)  
peehaa (peehaa)  
petk (petk)  
pmjones (pmjones)  
pmmaga (pmmaga)  
pollita (pollita)  
rasmus (rasmus)  
reywob (reywob)  
rtheunissen (rtheunissen)  
salathe (salathe)  
santiagolizardo (santiagolizardo)  
sebastian (sebastian)  
sergey (sergey)  
stas (stas)  
svpernova09 (svpernova09)  
thekid (thekid)  
trowski (trowski)  
yunosh (yunosh)  
Final result: 38 18
This poll has been closed.
Remove PHP short open tags in PHP 8.0?
Real name Yes No
ashnazg (ashnazg)  
bwoebi (bwoebi)  
carusogabriel (carusogabriel)  
colinodell (colinodell)  
cpriest (cpriest)  
danack (danack)  
daverandom (daverandom)  
derick (derick)  
diegopires (diegopires)  
duncan3dc (duncan3dc)  
emir (emir)  
galvao (galvao)  
gasolwu (gasolwu)  
girgias (girgias)  
guilhermeblanco (guilhermeblanco)  
heiglandreas (heiglandreas)  
jasny (jasny)  
jbnahan (jbnahan)  
jhdxr (jhdxr)  
kalle (kalle)  
kelunik (kelunik)  
kguest (kguest)  
kinncj (kinncj)  
klaussilveira (klaussilveira)  
krakjoe (krakjoe)  
kriscraig (kriscraig)  
laruence (laruence)  
levim (levim)  
malukenho (malukenho)  
marcio (marcio)  
mariano (mariano)  
mbeccati (mbeccati)  
mcmic (mcmic)  
mike (mike)  
narf (narf)  
nikic (nikic)  
ocramius (ocramius)  
pauloelr (pauloelr)  
peehaa (peehaa)  
petk (petk)  
pmjones (pmjones)  
pmmaga (pmmaga)  
pollita (pollita)  
rasmus (rasmus)  
reywob (reywob)  
rtheunissen (rtheunissen)  
salathe (salathe)  
sammyk (sammyk)  
santiagolizardo (santiagolizardo)  
sebastian (sebastian)  
sergey (sergey)  
stas (stas)  
svpernova09 (svpernova09)  
thekid (thekid)  
trowski (trowski)  
yunosh (yunosh)  
zeev (zeev)  
Final result: 42 15
This poll has been 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 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

rfc/deprecate_php_short_tags.1553534286.txt.gz · Last modified: 2019/03/25 17:18 by girgias