Deprecate auto_detect_line_endings

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
This commit is contained in:
Nikita Popov 2021-07-08 16:41:15 +02:00
parent bed7139375
commit 232aa34b9f
4 changed files with 15 additions and 2 deletions

View File

@ -392,6 +392,9 @@ PHP 8.1 UPGRADE NOTES
instead (for locale-independent parsing) or IntlDateFormatter::parse() (for
locale-dependent parsing).
RFC: https://wiki.php.net/rfc/deprecations_php_8_1
. The auto_detect_line_endings ini setting has been deprecated. If necessary,
handle "\r" line breaks manually instead.
RFC: https://wiki.php.net/rfc/deprecations_php_8_1
. The FILE_BINARY and FILE_TEXT constants are deprecated. They already had
no effect previously.
RFC: https://wiki.php.net/rfc/deprecations_php_8_1

View File

@ -153,11 +153,19 @@ static void file_globals_dtor(php_file_globals *file_globals_p)
#endif
}
static PHP_INI_MH(OnUpdateAutoDetectLineEndings)
{
if (zend_ini_parse_bool(new_value)) {
zend_error(E_DEPRECATED, "auto_detect_line_endings is deprecated");
}
return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
}
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("user_agent", NULL, PHP_INI_ALL, OnUpdateString, user_agent, php_file_globals, file_globals)
STD_PHP_INI_ENTRY("from", NULL, PHP_INI_ALL, OnUpdateString, from_address, php_file_globals, file_globals)
STD_PHP_INI_ENTRY("default_socket_timeout", "60", PHP_INI_ALL, OnUpdateLong, default_socket_timeout, php_file_globals, file_globals)
STD_PHP_INI_BOOLEAN("auto_detect_line_endings", "0", PHP_INI_ALL, OnUpdateBool, auto_detect_line_endings, php_file_globals, file_globals)
STD_PHP_INI_BOOLEAN("auto_detect_line_endings", "0", PHP_INI_ALL, OnUpdateAutoDetectLineEndings, auto_detect_line_endings, php_file_globals, file_globals)
PHP_INI_END()
PHP_MINIT_FUNCTION(file)

View File

@ -16,6 +16,7 @@ var_dump(fgets(STDIN));
echo "Done\n";
?>
--EXPECT--
Deprecated: auto_detect_line_endings is deprecated in Unknown on line 0
string(1) "1"
string(8) "fooBar1 "
string(8) "fooBar2 "

View File

@ -16,7 +16,8 @@ var_dump(fgets($stdin));
echo "Done\n";
?>
--EXPECT--
--EXPECTF--
Deprecated: auto_detect_line_endings is deprecated in %s on line %d
string(2) "on"
string(8) "fooBar1 "
string(8) "fooBar2 "