Skip to content

[RFC] Deprecate PHP's Short Open Tags in PHP 7.4 #3972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,10 @@ static FILE *zend_fopen_wrapper(const char *filename, zend_string **opened_path)
/* }}} */

#ifdef ZTS
static zend_bool short_tags_default = 1;
static zend_bool short_tags_default = 0;
static uint32_t compiler_options_default = ZEND_COMPILE_DEFAULT;
#else
# define short_tags_default 1
# define short_tags_default 0
# define compiler_options_default ZEND_COMPILE_DEFAULT
#endif

Expand Down
2 changes: 0 additions & 2 deletions ext/standard/tests/strings/strip_tags_basic1.phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
--TEST--
Test strip_tags() function : basic functionality - with default arguments
--INI--
short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/tests/strings/strip_tags_basic2.phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
--TEST--
Test strip_tags() function : basic functionality - with all arguments
--INI--
short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/tests/strings/strip_tags_variation10.phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
--TEST--
Test strip_tags() function : usage variations - single quoted strings
--INI--
short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/tests/strings/strip_tags_variation11.phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
--TEST--
Test strip_tags() function : obscure values within attributes
--INI--
short_open_tag = on
--FILE--
<?php

Expand Down
2 changes: 0 additions & 2 deletions ext/standard/tests/strings/strip_tags_variation2.phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
--TEST--
Test strip_tags() function : usage variations - unexpected values for 'allowable_tags'
--INI--
short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/tests/strings/strip_tags_variation4.phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
--TEST--
Test strip_tags() function : usage variations - invalid values for 'str' and valid 'allowable_tags'
--INI--
short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/tests/strings/strip_tags_variation5.phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
--TEST--
Test strip_tags() function : usage variations - heredoc strings
--INI--
short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/tests/strings/strip_tags_variation6.phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
--TEST--
Test strip_tags() function : usage variations - binary safe checking
--INI--
short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/tests/strings/strip_tags_variation7.phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
--TEST--
Test strip_tags() function : usage variations - invalid values for 'str' and 'allowable_tags'
--INI--
short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/tests/strings/strip_tags_variation8.phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
--TEST--
Test strip_tags() function : usage variations - valid value for 'str' and invalid values for 'allowable_tags'
--INI--
short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/tests/strings/strip_tags_variation9.phpt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
--TEST--
Test strip_tags() function : usage variations - double quoted strings
--INI--
short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
Expand Down
3 changes: 2 additions & 1 deletion ext/tokenizer/tests/002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ token_get_all()
--SKIPIF--
<?php if (!extension_loaded("tokenizer")) print "skip"; ?>
--INI--
short_open_tag=1
short_open_tag=On
--FILE--
<?php

Expand All @@ -22,6 +22,7 @@ foreach ($strings as $s) {
echo "Done\n";
?>
--EXPECTF--
Deprecated: Directive 'short_open_tag' is deprecated in Unknown on line 0
array(49) {
[0]=>
array(3) {
Expand Down
2 changes: 0 additions & 2 deletions ext/tokenizer/tests/token_get_all_variation15.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Test token_get_all() function : usage variations - heredoc string for 'source'
--SKIPIF--
<?php if (!extension_loaded("tokenizer")) print "skip"; ?>
--INI--
short_open_tag=On
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
Expand Down
1 change: 1 addition & 0 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2413,6 +2413,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
"Directive '%s' is deprecated",
{
"track_errors",
"short_open_tag",
NULL
}
},
Expand Down
11 changes: 2 additions & 9 deletions php.ini-development
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@
; Development Value: 5
; Production Value: 5

; short_open_tag
; Default Value: On
; Development Value: Off
; Production Value: Off

; variables_order
; Default Value: "EGPCS"
; Development Value: "GPCS"
Expand All @@ -173,18 +168,16 @@
; http://php.net/engine
engine = On

; This directive is DEPRECATED.
; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It is
; generally recommended that <?php and ?> should be used and that this feature
; should be disabled, as enabling it may result in issues when generating XML
; documents, however this remains supported for backward compatibility reasons.
; Note that this directive does not control the <?= shorthand tag, which can be
; used regardless of this directive.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = Off
;short_open_tag = Off

; The number of significant digits displayed in floating point numbers.
; http://php.net/precision
Expand Down
11 changes: 2 additions & 9 deletions php.ini-production
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@
; Development Value: 5
; Production Value: 5

; short_open_tag
; Default Value: On
; Development Value: Off
; Production Value: Off

; track_errors
; Default Value: Off
; Development Value: On
Expand Down Expand Up @@ -178,18 +173,16 @@
; http://php.net/engine
engine = On

; This directive is DEPRECATED.
; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It is
; generally recommended that <?php and ?> should be used and that this feature
; should be disabled, as enabling it may result in issues when generating XML
; documents, however this remains supported for backward compatibility reasons.
; Note that this directive does not control the <?= shorthand tag, which can be
; used regardless of this directive.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = Off
;short_open_tag = Off

; The number of significant digits displayed in floating point numbers.
; http://php.net/precision
Expand Down
1 change: 1 addition & 0 deletions tests/lang/short_tags.001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ echo "Used a short tag\n";
?>
Finished
--EXPECT--
Deprecated: Directive 'short_open_tag' is deprecated in Unknown on line 0
Used a short tag
Finished
2 changes: 1 addition & 1 deletion win32/build/config.w32.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/* PHP Runtime Configuration */
#define PHP_URL_FOPEN 1
#define USE_CONFIG_FILE 1
#define DEFAULT_SHORT_OPEN_TAG "1"
#define DEFAULT_SHORT_OPEN_TAG "0"

/* Platform-Specific Configuration. Should not be changed. */
#define PHP_SIGCHILD 0
Expand Down