Skip to content

Remove some deprecated functions #4927

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 7 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
19 changes: 11 additions & 8 deletions Zend/tests/call_to_deprecated_function_args.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
--TEST--
Check that arguments are freed when calling a deprecated function
--SKIPIF--
<?php
if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded');
--FILE--
<?php

Expand All @@ -8,36 +11,36 @@ set_error_handler(function($code, $msg) {
});

try {
ezmlm_hash(new stdClass);
zend_test_deprecated(new stdClass);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}

$ret = new stdClass;
try {
$ret = ezmlm_hash(new stdClass);
$ret = zend_test_deprecated(new stdClass());
} catch (Error $e) {
echo $e->getMessage(), "\n";
}

try {
$fn = 'ezmlm_hash';
$fn = 'zend_test_deprecated';
$fn(new stdClass);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}

$ret = new stdClass;
try {
$fn = 'ezmlm_hash';
$fn = 'zend_test_deprecated';
$ret = $fn(new stdClass);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}

?>
--EXPECT--
Function ezmlm_hash() is deprecated
Function ezmlm_hash() is deprecated
Function ezmlm_hash() is deprecated
Function ezmlm_hash() is deprecated
Function zend_test_deprecated() is deprecated
Function zend_test_deprecated() is deprecated
Function zend_test_deprecated() is deprecated
Function zend_test_deprecated() is deprecated
3 changes: 0 additions & 3 deletions Zend/tests/unexpected_ref_bug.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ class Test {
}
$my_var = str_repeat("A",64);
$data = call_user_func_array("explode",array(new Test(), &$my_var));
$my_var=array(1,2,3);
$data = call_user_func_array("implode",array(&$my_var, new Test()));
echo "Done.\n";
?>
--EXPECTF--
Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
Done.
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,6 @@ statfs \
statvfs \
std_syslog \
strcasecmp \
strfmon \
strnlen \
strptime \
strtok_r \
Expand Down
2 changes: 0 additions & 2 deletions ext/filter/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ static const filter_list_entry filter_list[] = {
{ "url", FILTER_SANITIZE_URL, php_filter_url },
{ "number_int", FILTER_SANITIZE_NUMBER_INT, php_filter_number_int },
{ "number_float", FILTER_SANITIZE_NUMBER_FLOAT, php_filter_number_float },
{ "magic_quotes", FILTER_SANITIZE_MAGIC_QUOTES, php_filter_magic_quotes },
{ "add_slashes", FILTER_SANITIZE_ADD_SLASHES, php_filter_add_slashes },

{ "callback", FILTER_CALLBACK, php_filter_callback },
Expand Down Expand Up @@ -213,7 +212,6 @@ PHP_MINIT_FUNCTION(filter)
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_URL", FILTER_SANITIZE_URL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_INT", FILTER_SANITIZE_NUMBER_INT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_FLOAT", FILTER_SANITIZE_NUMBER_FLOAT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_MAGIC_QUOTES", FILTER_SANITIZE_MAGIC_QUOTES, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_ADD_SLASHES", FILTER_SANITIZE_ADD_SLASHES, CONST_CS | CONST_PERSISTENT);

REGISTER_LONG_CONSTANT("FILTER_CALLBACK", FILTER_CALLBACK, CONST_CS | CONST_PERSISTENT);
Expand Down
1 change: 0 additions & 1 deletion ext/filter/filter_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
#define FILTER_SANITIZE_URL 0x0206
#define FILTER_SANITIZE_NUMBER_INT 0x0207
#define FILTER_SANITIZE_NUMBER_FLOAT 0x0208
#define FILTER_SANITIZE_MAGIC_QUOTES 0x0209
#define FILTER_SANITIZE_FULL_SPECIAL_CHARS 0x020a
#define FILTER_SANITIZE_ADD_SLASHES 0x020b
#define FILTER_SANITIZE_LAST 0x020b
Expand Down
1 change: 0 additions & 1 deletion ext/filter/php_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ void php_filter_url(PHP_INPUT_FILTER_PARAM_DECL);
void php_filter_number_int(PHP_INPUT_FILTER_PARAM_DECL);
void php_filter_number_float(PHP_INPUT_FILTER_PARAM_DECL);
void php_filter_add_slashes(PHP_INPUT_FILTER_PARAM_DECL);
void php_filter_magic_quotes(PHP_INPUT_FILTER_PARAM_DECL);

void php_filter_callback(PHP_INPUT_FILTER_PARAM_DECL);

Expand Down
14 changes: 0 additions & 14 deletions ext/filter/sanitizing_filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,17 +373,3 @@ void php_filter_add_slashes(PHP_INPUT_FILTER_PARAM_DECL)
ZVAL_STR(value, buf);
}
/* }}} */

/* {{{ php_filter_magic_quotes */
void php_filter_magic_quotes(PHP_INPUT_FILTER_PARAM_DECL)
{
zend_string *buf;
php_error_docref(NULL, E_DEPRECATED,
"FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead");

buf = php_addslashes(Z_STR_P(value));

zval_ptr_dtor(value);
ZVAL_STR(value, buf);
}
/* }}} */
6 changes: 2 additions & 4 deletions ext/filter/tests/008.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var_dump(filter_list());
echo "Done\n";
?>
--EXPECTF--
array(22) {
array(21) {
[0]=>
string(3) "int"
[1]=>
Expand Down Expand Up @@ -50,10 +50,8 @@ array(22) {
[18]=>
string(12) "number_float"
[19]=>
string(12) "magic_quotes"
[20]=>
string(11) "add_slashes"
[21]=>
[20]=>
string(8) "callback"
}
Done
27 changes: 0 additions & 27 deletions ext/filter/tests/020.phpt

This file was deleted.

21 changes: 0 additions & 21 deletions ext/filter/tests/033.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,5 @@ email PHP 1 [email protected] httpa.b.c 1.2.3.4 123 12
url PHP 1 [email protected] http://a.b.c 1.2.3.4 123 123abc<>() O'Henry aa:bb:cc:dd:ee:ff
number_int 1 1234 123 123
number_float 1 1234 123 123

Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d

Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d

Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d

Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d

Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d

Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d

Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d

Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d

Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d

Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d
magic_quotes PHP 1 [email protected] http://a.b.c 1.2.3.4 123 123abc<>() O\'Henry 하퍼 aa:bb:cc:dd:ee:ff
add_slashes PHP 1 [email protected] http://a.b.c 1.2.3.4 123 123abc<>() O\'Henry 하퍼 aa:bb:cc:dd:ee:ff
callback PHP 1 [email protected] HTTP://A.B.C 1.2.3.4 123 123ABC<>() O'HENRY 하퍼 AA:BB:CC:DD:EE:FF
4 changes: 1 addition & 3 deletions ext/opcache/Optimizer/sccp.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,9 +786,7 @@ static inline int ct_eval_func_call(
int overflow;

if (num_args == 0) {
if (zend_string_equals_literal(name, "get_magic_quotes_gpc")
|| zend_string_equals_literal(name, "get_magic_quotes_gpc_runtime")
|| zend_string_equals_literal(name, "php_sapi_name")
if (zend_string_equals_literal(name, "php_sapi_name")
|| zend_string_equals_literal(name, "imagetypes")
|| zend_string_equals_literal(name, "phpversion")) {
/* pass */
Expand Down
8 changes: 0 additions & 8 deletions ext/opcache/Optimizer/zend_func_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ static const func_info_t func_infos[] = {
F0("strripos", MAY_BE_FALSE | MAY_BE_LONG),
F1("strrev", MAY_BE_STRING),
F1("hebrev", MAY_BE_STRING),
F1("hebrevc", MAY_BE_STRING),
FN("nl2br", MAY_BE_STRING),
F1("basename", MAY_BE_STRING),
F1("dirname", MAY_BE_NULL | MAY_BE_STRING),
Expand All @@ -179,9 +178,6 @@ static const func_info_t func_infos[] = {
F1("str_split", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("strpbrk", MAY_BE_FALSE | MAY_BE_STRING),
F0("substr_compare", MAY_BE_FALSE | MAY_BE_LONG),
#ifdef HAVE_STRFMON
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also drop the strfmon check in configure.

F1("money_format", MAY_BE_FALSE | MAY_BE_STRING),
#endif
FN("substr", MAY_BE_FALSE | MAY_BE_STRING),
FN("substr_replace", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
F1("quotemeta", MAY_BE_STRING),
Expand Down Expand Up @@ -334,11 +330,8 @@ static const func_info_t func_infos[] = {
#endif
F1("quoted_printable_decode", MAY_BE_STRING),
F1("quoted_printable_encode", MAY_BE_STRING),
F1("convert_cyr_string", MAY_BE_STRING),
F1("get_current_user", MAY_BE_STRING),
F1("get_cfg_var", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
F0("get_magic_quotes_gpc", MAY_BE_FALSE),
F0("get_magic_quotes_runtime", MAY_BE_FALSE),
F0("error_log", MAY_BE_FALSE | MAY_BE_TRUE),
F1("error_get_last", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
FN("call_user_func", UNKNOWN_INFO),
Expand Down Expand Up @@ -537,7 +530,6 @@ static const func_info_t func_infos[] = {
F0("realpath_cache_size", MAY_BE_LONG),
F1("realpath_cache_get", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
F0("mail", MAY_BE_FALSE | MAY_BE_TRUE),
F0("ezmlm_hash", MAY_BE_LONG),
#ifdef HAVE_SYSLOG_H
F0("closelog", MAY_BE_TRUE),
#endif
Expand Down
2 changes: 1 addition & 1 deletion ext/spl/tests/bug75717.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function flatten(array $nestedArraysAndStrings){
$iter = new RecursiveIteratorIterator(
new RecursiveArrayIterator($nestedArraysAndStrings));
foreach($iter as $leaf){ $flat[] = $leaf; }
return join(NULL, $flat);
return join("", $flat);
}

$noRefs = [[[['some']]],[' nested '],"items"];
Expand Down
32 changes: 0 additions & 32 deletions ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(strripos, arginfo_strripos)
PHP_FE(strrev, arginfo_strrev)
PHP_FE(hebrev, arginfo_hebrev)
PHP_DEP_FE(hebrevc, arginfo_hebrevc)
PHP_FE(nl2br, arginfo_nl2br)
PHP_FE(basename, arginfo_basename)
PHP_FE(dirname, arginfo_dirname)
Expand All @@ -933,10 +932,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(utf8_decode, arginfo_utf8_decode)
PHP_FE(strcoll, arginfo_strcoll)

#ifdef HAVE_STRFMON
PHP_DEP_FE(money_format, arginfo_money_format)
#endif

PHP_FE(substr, arginfo_substr)
PHP_FE(substr_replace, arginfo_substr_replace)
PHP_FE(quotemeta, arginfo_quotemeta)
Expand Down Expand Up @@ -1136,15 +1131,11 @@ static const zend_function_entry basic_functions[] = { /* {{{ */

PHP_FE(quoted_printable_decode, arginfo_quoted_printable_decode)
PHP_FE(quoted_printable_encode, arginfo_quoted_printable_encode)
PHP_DEP_FE(convert_cyr_string, arginfo_convert_cyr_string)
PHP_FE(get_current_user, arginfo_get_current_user)
PHP_FE(set_time_limit, arginfo_set_time_limit)
PHP_FE(header_register_callback, arginfo_header_register_callback)
PHP_FE(get_cfg_var, arginfo_get_cfg_var)

PHP_DEP_FE(get_magic_quotes_gpc, arginfo_get_magic_quotes_gpc)
PHP_DEP_FE(get_magic_quotes_runtime, arginfo_get_magic_quotes_runtime)

PHP_FE(error_log, arginfo_error_log)
PHP_FE(error_get_last, arginfo_error_get_last)
PHP_FE(error_clear_last, arginfo_error_clear_last)
Expand Down Expand Up @@ -1421,7 +1412,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */

/* functions from mail.c */
PHP_FE(mail, arginfo_mail)
PHP_DEP_FE(ezmlm_hash, arginfo_ezmlm_hash)

/* functions from syslog.c */
#ifdef HAVE_SYSLOG_H
Expand Down Expand Up @@ -2888,28 +2878,6 @@ PHP_FUNCTION(get_cfg_var)
}
/* }}} */

/* {{{ proto false get_magic_quotes_runtime(void)
Get the current active configuration setting of magic_quotes_runtime */
PHP_FUNCTION(get_magic_quotes_runtime)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
RETURN_FALSE;
}
/* }}} */

/* {{{ proto false get_magic_quotes_gpc(void)
Get the current active configuration setting of magic_quotes_gpc */
PHP_FUNCTION(get_magic_quotes_gpc)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
RETURN_FALSE;
}
/* }}} */

/*
1st arg = error message
2nd arg = error option
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/basic_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ PHP_FUNCTION(set_time_limit);
PHP_FUNCTION(header_register_callback);

PHP_FUNCTION(get_cfg_var);
PHP_FUNCTION(get_magic_quotes_runtime);
PHP_FUNCTION(get_magic_quotes_gpc);

PHP_FUNCTION(error_log);
PHP_FUNCTION(error_get_last);
Expand Down
Loading