Index: plugin.php
===================================================================
--- plugin.php	(revision 15513)
+++ plugin.php	(working copy)
@@ -59,13 +59,16 @@
  * @param string $tag The name of the filter to hook the $function_to_add to.
  * @param callback $function_to_add The name of the function to be called when the filter is applied.
  * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
- * @param int $accepted_args optional. The number of arguments the function accept (default 1).
+ * @param int $accepted_args optional. The number of arguments the function accept (default: 1 for internal php functions).
  * @return boolean true
  */
-function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
+function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = null) {
 	global $wp_filter, $merged_filters;
 
 	$idx = _wp_filter_build_unique_id($tag, $function_to_add, $priority);
+	if ( null === $accepted_args && is_string( $function_to_add ) && is_internal_php_function( $function_to_add ) )
+		$accepted_args = 1;
+
 	$wp_filter[$tag][$priority][$idx] = array('function' => $function_to_add, 'accepted_args' => $accepted_args);
 	unset( $merged_filters[ $tag ] );
 	return true;
@@ -174,6 +177,25 @@
 }
 
 /**
+ * Whether function name is internal to PHP.
+ *
+ * @package WordPress
+ * @since 3.1
+ *
+ * @global array $php_internal_functions
+ * @param string $function_name
+ * @return bool
+ */
+function is_internal_php_function( $function_name ) {
+	global $php_internal_functions;
+	if ( !isset( $php_internal_functions ) ) {
+		$functions = get_defined_functions();
+		$php_internal_functions = array_flip( $functions['internal'] );
+	}
+	return isset( $php_internal_functions[$function_name] );
+}
+
+/**
  * Execute functions hooked on a specific filter hook, specifying arguments in an array.
  *
  * @see apply_filters() This function is identical, but the arguments passed to the
@@ -244,10 +266,9 @@
  * @param string $tag The filter hook to which the function to be removed is hooked.
  * @param callback $function_to_remove The name of the function which should be removed.
  * @param int $priority optional. The priority of the function (default: 10).
- * @param int $accepted_args optional. The number of arguments the function accpets (default: 1).
  * @return boolean Whether the function existed before it was removed.
  */
-function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
+function remove_filter( $tag, $function_to_remove, $priority = 10 ) {
 	$function_to_remove = _wp_filter_build_unique_id($tag, $function_to_remove, $priority);
 
 	$r = isset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]);
@@ -319,9 +340,9 @@
  * @param string $tag The name of the action to which the $function_to_add is hooked.
  * @param callback $function_to_add The name of the function you wish to be called.
  * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
- * @param int $accepted_args optional. The number of arguments the function accept (default 1).
+ * @param int $accepted_args Optional. The number of arguments the function accept (default: 1 for internal php functions).
  */
-function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
+function add_action($tag, $function_to_add, $priority = 10, $accepted_args = null) {
 	return add_filter($tag, $function_to_add, $priority, $accepted_args);
 }
 
@@ -507,11 +528,10 @@
  * @param string $tag The action hook to which the function to be removed is hooked.
  * @param callback $function_to_remove The name of the function which should be removed.
  * @param int $priority optional The priority of the function (default: 10).
- * @param int $accepted_args optional. The number of arguments the function accpets (default: 1).
  * @return boolean Whether the function is removed.
  */
-function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args = 1) {
-	return remove_filter($tag, $function_to_remove, $priority, $accepted_args);
+function remove_action( $tag, $function_to_remove, $priority = 10 ) {
+	return remove_filter( $tag, $function_to_remove, $priority );
 }
 
 /**
