From 9e240a859ffef76602f8309c5e5ccbff09593cf5 Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 8 Sep 2006 23:18:03 +0000 Subject: [PATCH] Specify number of accepted args. git-svn-id: http://svn.automattic.com/wordpress/trunk@4176 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-functions.php | 4 ++-- wp-includes/plugin.php | 13 ++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index ee3bc36f6b..21e7926c65 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -2075,7 +2075,7 @@ function update_home_siteurl($old_value, $value) { wp_setcookie($user_login, $user_pass_md5, true, get_option('home'), get_option('siteurl')); } -add_action('update_option_home', 'update_home_siteurl'); -add_action('update_option_siteurl', 'update_home_siteurl'); +add_action('update_option_home', 'update_home_siteurl', 10, 2); +add_action('update_option_siteurl', 'update_home_siteurl', 10, 2); ?> diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php index 266c271ab0..f4b5e3e1e6 100644 --- a/wp-includes/plugin.php +++ b/wp-includes/plugin.php @@ -102,11 +102,9 @@ function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) function do_action($tag, $arg = '') { global $wp_filter; - $extra_args = array_slice(func_get_args(), 2); - if ( is_array($arg) ) - $args = array_merge($arg, $extra_args); - else - $args = array_merge(array($arg), $extra_args); + $args = array($arg); + for ( $a = 2; $a < func_num_args(); $a++ ) + $args[] = func_get_args($a); merge_filters($tag); @@ -121,10 +119,7 @@ function do_action($tag, $arg = '') { $accepted_args = $function['accepted_args']; if ( $accepted_args == 1 ) { - if ( is_array($arg) ) - $the_args = $arg; - else - $the_args = array($arg); + $the_args = array($arg); } elseif ( $accepted_args > 1 ) { $the_args = array_slice($args, 0, $accepted_args); } elseif ( $accepted_args == 0 ) {