From 77518e9c7150764acf6eee7192536ea211491c25 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 4 Oct 2012 20:00:16 +0000 Subject: [PATCH] Objects no longer need to be explicitly passed by ref to call_user_func*() to be callable. Props wonderboymusic. fixes #21865 git-svn-id: http://core.svn.wordpress.org/trunk@22118 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/cache.php | 2 +- wp-includes/capabilities.php | 6 +++--- wp-includes/class-http.php | 2 +- wp-includes/class-oembed.php | 2 +- wp-includes/class-wp-walker.php | 8 ++++---- wp-includes/class-wp.php | 2 +- wp-includes/default-widgets.php | 12 ++++++------ wp-includes/nav-menu-template.php | 2 +- wp-includes/post-template.php | 4 ++-- wp-includes/taxonomy.php | 2 +- wp-includes/widgets.php | 8 ++++---- wp-includes/wp-db.php | 4 ++-- wp-includes/wp-diff.php | 2 +- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/wp-includes/cache.php b/wp-includes/cache.php index dc856992ae..d76ae3aeae 100644 --- a/wp-includes/cache.php +++ b/wp-includes/cache.php @@ -635,7 +635,7 @@ class WP_Object_Cache { * @todo This should be moved to the PHP4 style constructor, PHP5 * already calls __destruct() */ - register_shutdown_function( array( &$this, '__destruct' ) ); + register_shutdown_function( array( $this, '__destruct' ) ); } /** diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index e629cf4441..b493eee0d7 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -725,7 +725,7 @@ class WP_User { //Filter out caps that are not role names and assign to $this->roles if ( is_array( $this->caps ) ) - $this->roles = array_filter( array_keys( $this->caps ), array( &$wp_roles, 'is_role' ) ); + $this->roles = array_filter( array_keys( $this->caps ), array( $wp_roles, 'is_role' ) ); //Build $allcaps from role caps, overlay user's $caps $this->allcaps = array(); @@ -1331,7 +1331,7 @@ function author_can( $post, $capability ) { $args = array_slice( func_get_args(), 2 ); $args = array_merge( array( $capability ), $args ); - return call_user_func_array( array( &$author, 'has_cap' ), $args ); + return call_user_func_array( array( $author, 'has_cap' ), $args ); } /** @@ -1353,7 +1353,7 @@ function user_can( $user, $capability ) { $args = array_slice( func_get_args(), 2 ); $args = array_merge( array( $capability ), $args ); - return call_user_func_array( array( &$user, 'has_cap' ), $args ); + return call_user_func_array( array( $user, 'has_cap' ), $args ); } /** diff --git a/wp-includes/class-http.php b/wp-includes/class-http.php index 77a4a90803..b50909fd9f 100644 --- a/wp-includes/class-http.php +++ b/wp-includes/class-http.php @@ -1109,7 +1109,7 @@ class WP_Http_Curl { } if ( true === $r['blocking'] ) - curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( &$this, 'stream_headers' ) ); + curl_setopt( $handle, CURLOPT_HEADERFUNCTION, array( $this, 'stream_headers' ) ); curl_setopt( $handle, CURLOPT_HEADER, false ); diff --git a/wp-includes/class-oembed.php b/wp-includes/class-oembed.php index 553a660275..b625fc5872 100644 --- a/wp-includes/class-oembed.php +++ b/wp-includes/class-oembed.php @@ -53,7 +53,7 @@ class WP_oEmbed { ) ); // Fix any embeds that contain new lines in the middle of the HTML which breaks wpautop(). - add_filter( 'oembed_dataparse', array(&$this, '_strip_newlines'), 10, 3 ); + add_filter( 'oembed_dataparse', array($this, '_strip_newlines'), 10, 3 ); } /** diff --git a/wp-includes/class-wp-walker.php b/wp-includes/class-wp-walker.php index 5478da90d8..df9d9b61f0 100644 --- a/wp-includes/class-wp-walker.php +++ b/wp-includes/class-wp-walker.php @@ -126,7 +126,7 @@ class Walker { if ( is_array( $args[0] ) ) $args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] ); $cb_args = array_merge( array(&$output, $element, $depth), $args); - call_user_func_array(array(&$this, 'start_el'), $cb_args); + call_user_func_array(array($this, 'start_el'), $cb_args); $id = $element->$id_field; @@ -139,7 +139,7 @@ class Walker { $newlevel = true; //start the child delimiter $cb_args = array_merge( array(&$output, $depth), $args); - call_user_func_array(array(&$this, 'start_lvl'), $cb_args); + call_user_func_array(array($this, 'start_lvl'), $cb_args); } $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output ); } @@ -149,12 +149,12 @@ class Walker { if ( isset($newlevel) && $newlevel ){ //end the child delimiter $cb_args = array_merge( array(&$output, $depth), $args); - call_user_func_array(array(&$this, 'end_lvl'), $cb_args); + call_user_func_array(array($this, 'end_lvl'), $cb_args); } //end this element $cb_args = array_merge( array(&$output, $element, $depth), $args); - call_user_func_array(array(&$this, 'end_el'), $cb_args); + call_user_func_array(array($this, 'end_el'), $cb_args); } /** diff --git a/wp-includes/class-wp.php b/wp-includes/class-wp.php index f7e6b467e1..2e11ebac64 100644 --- a/wp-includes/class-wp.php +++ b/wp-includes/class-wp.php @@ -606,7 +606,7 @@ class WP_MatchesMapRegex { * @return string */ function _map() { - $callback = array(&$this, 'callback'); + $callback = array($this, 'callback'); return preg_replace_callback($this->_pattern, $callback, $this->_subject); } diff --git a/wp-includes/default-widgets.php b/wp-includes/default-widgets.php index 8630c75dc9..85a796e194 100644 --- a/wp-includes/default-widgets.php +++ b/wp-includes/default-widgets.php @@ -536,9 +536,9 @@ class WP_Widget_Recent_Posts extends WP_Widget { parent::__construct('recent-posts', __('Recent Posts'), $widget_ops); $this->alt_option_name = 'widget_recent_entries'; - add_action( 'save_post', array(&$this, 'flush_widget_cache') ); - add_action( 'deleted_post', array(&$this, 'flush_widget_cache') ); - add_action( 'switch_theme', array(&$this, 'flush_widget_cache') ); + add_action( 'save_post', array($this, 'flush_widget_cache') ); + add_action( 'deleted_post', array($this, 'flush_widget_cache') ); + add_action( 'switch_theme', array($this, 'flush_widget_cache') ); } function widget($args, $instance) { @@ -637,10 +637,10 @@ class WP_Widget_Recent_Comments extends WP_Widget { $this->alt_option_name = 'widget_recent_comments'; if ( is_active_widget(false, false, $this->id_base) ) - add_action( 'wp_head', array(&$this, 'recent_comments_style') ); + add_action( 'wp_head', array($this, 'recent_comments_style') ); - add_action( 'comment_post', array(&$this, 'flush_widget_cache') ); - add_action( 'transition_comment_status', array(&$this, 'flush_widget_cache') ); + add_action( 'comment_post', array($this, 'flush_widget_cache') ); + add_action( 'transition_comment_status', array($this, 'flush_widget_cache') ); } function recent_comments_style() { diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php index 7e790d186e..3963bce849 100644 --- a/wp-includes/nav-menu-template.php +++ b/wp-includes/nav-menu-template.php @@ -475,7 +475,7 @@ function walk_nav_menu_tree( $items, $depth, $r ) { $walker = ( empty($r->walker) ) ? new Walker_Nav_Menu : $r->walker; $args = array( $items, $depth, $r ); - return call_user_func_array( array(&$walker, 'walk'), $args ); + return call_user_func_array( array($walker, 'walk'), $args ); } /** diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 185af0eed0..a8e4f895c3 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -937,7 +937,7 @@ function walk_page_tree($pages, $depth, $current_page, $r) { $walker = $r['walker']; $args = array($pages, $depth, $r, $current_page); - return call_user_func_array(array(&$walker, 'walk'), $args); + return call_user_func_array(array($walker, 'walk'), $args); } /** @@ -954,7 +954,7 @@ function walk_page_dropdown_tree() { else $walker = $args[2]['walker']; - return call_user_func_array(array(&$walker, 'walk'), $args); + return call_user_func_array(array($walker, 'walk'), $args); } /** diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 54175e007c..921a5d97e4 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1410,7 +1410,7 @@ function get_terms($taxonomies, $args = '') { if ( $child_of ) { $children = _get_term_hierarchy($taxonomies[0]); if ( ! empty($children) ) - $terms = & _get_term_children($child_of, $terms, $taxonomies[0]); + $terms = _get_term_children($child_of, $terms, $taxonomies[0]); } // Update term counts to include children. diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 765bbffcfc..2277fad192 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -152,15 +152,15 @@ class WP_Widget { } function _get_display_callback() { - return array(&$this, 'display_callback'); + return array($this, 'display_callback'); } function _get_update_callback() { - return array(&$this, 'update_callback'); + return array($this, 'update_callback'); } function _get_form_callback() { - return array(&$this, 'form_callback'); + return array($this, 'form_callback'); } /** Generate the actual widget content. @@ -317,7 +317,7 @@ class WP_Widget_Factory { var $widgets = array(); function WP_Widget_Factory() { - add_action( 'widgets_init', array( &$this, '_register_widgets' ), 100 ); + add_action( 'widgets_init', array( $this, '_register_widgets' ), 100 ); } function register($widget_class) { diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 8361e15361..8f258f8157 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -534,7 +534,7 @@ class wpdb { * @param string $dbhost MySQL database host */ function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) { - register_shutdown_function( array( &$this, '__destruct' ) ); + register_shutdown_function( array( $this, '__destruct' ) ); if ( WP_DEBUG ) $this->show_errors(); @@ -1000,7 +1000,7 @@ class wpdb { $query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting $query = str_replace( '%f' , '%F', $query ); // Force floats to be locale unaware $query = preg_replace( '|(?