From 91aa9fbb473a51d62cd90faf5dda73245c9572ef Mon Sep 17 00:00:00 2001 From: Kalle Sommer Nielsen Date: Sat, 5 Apr 2014 06:43:41 +0200 Subject: [PATCH] Remove call_user_method() and call_user_method_array() from master, long time deprecated in favour of call_user_func*(). --- NEWS | 3 + UPGRADING | 2 + ext/standard/basic_functions.c | 97 ------------------- ext/standard/basic_functions.h | 2 - .../tests/general_functions/bug44487.phpt | 24 ----- .../general_functions/call_user_method.phpt | 20 ---- .../call_user_method_002.phpt | 12 --- 7 files changed, 5 insertions(+), 155 deletions(-) delete mode 100644 ext/standard/tests/general_functions/bug44487.phpt delete mode 100644 ext/standard/tests/general_functions/call_user_method.phpt delete mode 100644 ext/standard/tests/general_functions/call_user_method_002.phpt diff --git a/NEWS b/NEWS index 904168c747..f5dbef1d77 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,9 @@ PHP NEWS - DBA: . Fixed bug #62490 (dba_delete returns true on missing item (inifile)). (Mike) +- Standard: + . Removed call_user_method() and call_user_method_array() functions. (Kalle) + - XSL: . Fixed bug #64776 (The XSLT extension is not thread safe). (Mike) diff --git a/UPGRADING b/UPGRADING index f5e36fefc8..4c49485725 100755 --- a/UPGRADING +++ b/UPGRADING @@ -78,3 +78,5 @@ PHP X.Y UPGRADE NOTES 11. Other Changes ======================================== +- Standard + . call_user_method() and call_user_method_array() no longer exists. diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 14acccff96..b524760072 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -702,18 +702,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_call_user_func_array, 0, 0, 2) ZEND_ARG_INFO(0, parameters) /* ARRAY_INFO(0, parameters, 1) */ ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_call_user_method, 0, 0, 2) - ZEND_ARG_INFO(0, method_name) - ZEND_ARG_INFO(1, object) - ZEND_ARG_VARIADIC_INFO(0, parameters) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_call_user_method_array, 0) - ZEND_ARG_INFO(0, method_name) - ZEND_ARG_INFO(1, object) - ZEND_ARG_INFO(0, params) /* ARRAY_INFO(0, params, 1) */ -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_forward_static_call, 0, 0, 1) ZEND_ARG_INFO(0, function_name) ZEND_ARG_VARIADIC_INFO(0, parameters) @@ -2960,8 +2948,6 @@ const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(error_get_last, arginfo_error_get_last) PHP_FE(call_user_func, arginfo_call_user_func) PHP_FE(call_user_func_array, arginfo_call_user_func_array) - PHP_DEP_FE(call_user_method, arginfo_call_user_method) - PHP_DEP_FE(call_user_method_array, arginfo_call_user_method_array) PHP_FE(forward_static_call, arginfo_forward_static_call) PHP_FE(forward_static_call_array, arginfo_forward_static_call_array) PHP_FE(serialize, arginfo_serialize) @@ -4786,89 +4772,6 @@ PHP_FUNCTION(call_user_func_array) } /* }}} */ -/* {{{ proto mixed call_user_method(string method_name, mixed object [, mixed parameter] [, mixed ...]) - Call a user method on a specific object or class */ -PHP_FUNCTION(call_user_method) -{ - zval ***params = NULL; - int n_params = 0; - zval *retval_ptr; - zval *callback, *object; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/z*", &callback, &object, ¶ms, &n_params) == FAILURE) { - return; - } - - if (Z_TYPE_P(object) != IS_OBJECT && - Z_TYPE_P(object) != IS_STRING - ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument is not an object or class name"); - if (params) { - efree(params); - } - RETURN_FALSE; - } - - convert_to_string(callback); - - if (call_user_function_ex(EG(function_table), &object, callback, &retval_ptr, n_params, params, 0, NULL TSRMLS_CC) == SUCCESS) { - if (retval_ptr) { - COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); - } - } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", Z_STRVAL_P(callback)); - } - if (n_params) { - efree(params); - } -} -/* }}} */ - -/* {{{ proto mixed call_user_method_array(string method_name, mixed object, array params) - Call a user method on a specific object or class using a parameter array */ -PHP_FUNCTION(call_user_method_array) -{ - zval *params, ***method_args = NULL, *retval_ptr; - zval *callback, *object; - HashTable *params_ar; - int num_elems, element = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/zA/", &callback, &object, ¶ms) == FAILURE) { - return; - } - - if (Z_TYPE_P(object) != IS_OBJECT && - Z_TYPE_P(object) != IS_STRING - ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Second argument is not an object or class name"); - RETURN_FALSE; - } - - convert_to_string(callback); - - params_ar = HASH_OF(params); - num_elems = zend_hash_num_elements(params_ar); - method_args = (zval ***) safe_emalloc(sizeof(zval **), num_elems, 0); - - for (zend_hash_internal_pointer_reset(params_ar); - zend_hash_get_current_data(params_ar, (void **) &(method_args[element])) == SUCCESS; - zend_hash_move_forward(params_ar) - ) { - element++; - } - - if (call_user_function_ex(EG(function_table), &object, callback, &retval_ptr, num_elems, method_args, 0, NULL TSRMLS_CC) == SUCCESS) { - if (retval_ptr) { - COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); - } - } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call %s()", Z_STRVAL_P(callback)); - } - - efree(method_args); -} -/* }}} */ - /* {{{ proto mixed forward_static_call(mixed function_name [, mixed parmeter] [, mixed ...]) U Call a user function which is the first parameter */ PHP_FUNCTION(forward_static_call) diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h index 3af85b3d40..3324427088 100644 --- a/ext/standard/basic_functions.h +++ b/ext/standard/basic_functions.h @@ -81,8 +81,6 @@ PHP_FUNCTION(error_get_last); PHP_FUNCTION(call_user_func); PHP_FUNCTION(call_user_func_array); -PHP_FUNCTION(call_user_method); -PHP_FUNCTION(call_user_method_array); PHP_FUNCTION(forward_static_call); PHP_FUNCTION(forward_static_call_array); diff --git a/ext/standard/tests/general_functions/bug44487.phpt b/ext/standard/tests/general_functions/bug44487.phpt deleted file mode 100644 index 10c52c6b3f..0000000000 --- a/ext/standard/tests/general_functions/bug44487.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -Bug #44487 (call_user_method_array issues a warning when throwing an exception) ---INI-- -error_reporting = E_ALL & ~E_DEPRECATED ---FILE-- - ---EXPECT-- -test diff --git a/ext/standard/tests/general_functions/call_user_method.phpt b/ext/standard/tests/general_functions/call_user_method.phpt deleted file mode 100644 index cc54ff9544..0000000000 --- a/ext/standard/tests/general_functions/call_user_method.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Basic behaviour of call_user_method() test ---CREDITS-- -Sebastian Schürmann -sebs@php.net -Testfest 2009 Munich ---FILE-- - ---EXPECTF-- -Deprecated: Function call_user_method() is deprecated in %s on line 8 -bool(true) diff --git a/ext/standard/tests/general_functions/call_user_method_002.phpt b/ext/standard/tests/general_functions/call_user_method_002.phpt deleted file mode 100644 index 054bc3edeb..0000000000 --- a/ext/standard/tests/general_functions/call_user_method_002.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -call_user_method() Invalid free ---FILE-- - ---EXPECTF-- -Deprecated: Function call_user_method() is deprecated in %s on line %d - -Warning: call_user_method(): Second argument is not an object or class name in %s on line %d -- 2.40.0